Configuring the iptables firewall
By default, Linux includes a firewall, iptables. This firewall should automatically be available on most (if not all) flavors of Linux. In this little activity, we'll set up a firewall on our Linux system. This should work fine regardless of which of the major distributions you use, but I'll call out anything that may be distribution specific. Before we get started though, I'll recommend that you play with this on a test machine, such as a VM or something you have physical access to. If you're using SSH, you may get disconnected when we enable the firewall, though I'll provide these steps in an order that hopefully, shouldn't drop your connection. Having a dedicated test machine to play around with is a good idea anyway.
With that out of the way, let's get started. Unfortunately, by default, iptables
is wide open. It's so open, in fact, that it blocks nothing. To see this for yourself, issue iptables -L
as root. Your output will probably look like this:
Chain...