| -A, -append |
| iptables -A INPUT... |
| This command appends at the end of the chain. |
| -D -delete |
| iptables -D INPUT -dport 80 -j DROP |
| iptables -D INPUT 1 |
| There are two ways to delete a rule in a chain. the first is to specify the rule to be deleted as in the first example. Or the second is to specify the number of the rule as in the second example. |
| -R -replace |
| iptables iptables -R INPUT 1 -s 192.168.0.1 -j DROP |
| This is used to replace the old entries at a specific line. |
| -I -insert |
| iptables -I INPUT 1 -dport 80 -j ACCEPT |
| This inserts the rule at the specified location. |
| -L -list |
| iptables -L INPUT |
| This command is used to list the rules in specified chain or table. |
| -F -flush |
| iptables -F INPUT |
| This flushes all the rules in the specified chain or table. It is equivalent to deleting all the rules at once. |
| -N -new-chain |
| iptables -N givenName |
| This adds a new chain in the specified table with "givenName". |
| -X -delete-chain |
| iptables -X givenName |
| This is used to delete the entire chain along with the rules in it. |
| -P -policy |
| iptables -P INPUT DROP |
| This sets the default policy for the specific chain. This applies to all the packets that do not match any rule in the chain. |