Packet filtering is a critical component in the security concept of all computer systems on a network. Controlling and managing incoming and outgoing traffic – often as part of a firewall – is designed to ensure that only data packets free of malware and spam are sent and received. In a Linux kernel, a packet filter is integrated by default, since it’s provided by modules of the software packet, Netfilter. However, an additional program is needed to configure it. For the Linux kernels 2.4 and 2.6, the free software iptables is required, which was also developed by the Netfilter project team.
As an administrator, iptables is used to set up, modify, or delete rules, while settings will be lost during the system reboot. The program’s tools, iptables-save and iptables-restore, are used to save and restore rule sets that have previously been set up. With a so-called init script this is done automatically even during the boot process. iptables is limited to the protocol IPv4, while for other protocols there are corresponding variants, such as ip6tables for IPv6, or ebtables for Ethernet packets, which are also contained in the kernel module.
In the following iptables tutorial, we present the basic functions and options of the packet filter software. We then explain the configuration of the tables by using different examples.