
When the defined pattern matches, the action that takes place is called a target. You can match the packet protocol type, the source or destination address or port, the interface that is being used, its relation to previous packets, and so on. There are many options to establish which packets match a specific rule. The rules define the characteristics that a network packet needs to have to match, and the action that should be taken for matching packets. The iptables firewall operates by comparing network traffic against a set of rules. How Iptables Worksįirst, let’s review some terminology and discuss how iptables works. For a more in-depth approach, you can read A Deep Dive into Iptables and Netfilter Architecture. In this guide, you will review how Iptables works.

It works by matching each packet that crosses the networking interface against a set of rules to decide what to do.

It is a command-line interface to the kernel-level netfilter hooks that can manipulate the Linux network stack. Iptables is a standard firewall included in most Linux distributions by default.

In this guide, we’ll be covering the iptables firewall. Most Linux distributions ship with a few different firewall tools that you can use to configure a firewall. Setting up a firewall is an essential step to take in securing any modern operating system.
