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 ...

Get Practical Linux Security Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.