Using IP tables for configuring a firewall
One of the essential steps while securing a Linux system is setting up a good firewall. Most Linux distributions come pre-installed with different firewall tools. Iptables is one such default firewall of Linux distributions. For older versions of Linux kernel, Ipchains was the default firewall.
Getting ready
Since Iptables ships with the Linux distribution, no extra tools need to be installed to use it. However, it is recommended that to use Iptables, we should not use the root account. Instead, use a normal account that has super user access to run the commands efficiently.
How to do it...
We can define different rules using Iptables. These rules are then followed by the kernel when checking the incoming and outgoing traffic packets:
- The first thing we shall do on our system is check which version of
iptables
is installed by using the following command:
- Now, we will check whether any rule already exists on the system for Iptables by using the
-L
option...