In this tutorial, I will share my learning and understanding of IPTABLES.

There are a few things that will help in your understanding and configuration of: .

  1. TABLES
    Tables form the basis of the IPTABLES where chains and rules are created base on the tables that the packets fall under.
  2. CHAINS
    Each tables have the respective chains that look at the packets as it transverse the various table. Do take note that not all chains are present in all tables. I have highlighted below in another table what are the chains available for each tables.
  3. RULES
    Rules are what is configure to allow action to be perform on the packets that transverse the tables and chains.

Here is the list of CHAINS that are available to each TABLE.

You can use the following command to validate the default CHAINS available to each TABLE. You can add in -n to see the numeric representation of the ip and ports, and -v verbose to see additional informations such as packets count.

sudo iptables -t <table name> -L

Below is the basic transversal order of the packets through the chain.

You can look at the tutorial to configure the basic IPTABLES rule to get started.

https://dracocybersecurity.com/iptables-basic-configurations-ubuntu-20-04/