Chapter 3. IPTables usage

Table of Contents

Selecting the Table
Append, Insert and Delete
Defining Options
Targets

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

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