Using Iptables to configure a firewall
One of the essential steps required to secure a Linux system is to set up a good firewall. Most Linux distributions come preinstalled with different firewall tools. Iptables is one such default firewall in a Linux distribution. In older versions of the Linux kernel, Ipchains was the default firewall.
Getting Ready
Since Iptables ships with the Linux distribution, no extra tool needs to be installed to use it. However, it is recommended that when you use Iptables; do 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 incoming and outgoing traffic packets:
- The first thing we need to do on our system is check which version of Iptables is installed using the command shown here:
- Now, we will check whether any rule already exists on the system for Iptables using the
-L
option. - The...