Chapter 3. IPTables usage

Table of Contents

Selecting the Table
Append, Insert and Delete
Defining Options

Here is a short reference for the iptables commandline program. I'll try to explain most of the important options the iptables command allows. For more details please have a look at man iptables

Some (quiet a lot) of the descriptions are copy and paste from the iptables manpage, because the manpage is really good and I just added my own explanations where I thought this should be clearer. I'd like to say thanks to the iptables developers for this fabulous manpage.

Selecting the Table

Each rule you like to add to your firewall needs to be inserted or appended into an existing chain in one of the three tables “filter”, “nat” or “mangle”. Which of the tables are available depends on the configuration of your kernel.

Lets have a look at the following iptables commandline:

iptables -t filter -A INPUT --source -j DROP

As you can see the command has several parts to set the behavior of the rule. Lets start with iptables -t <tablename> ... The option “-t” tells iptables to add the rule to a chain in the table <tablename>. If no -t option is defined the rule will be inserted into the “filter” table which is the default.