Use -D
command, this is how man
page explains it:
-D, --delete chain rule-specification
-D, --delete chain rulenum
Delete one or more rules from the selected chain.
There are two versions of this command:
the rule can be specified as a number in the chain (starting at 1 for the first rule) or a rule to match.
Do realize this command, like all other command(-A
, -I
) works on certain table. If you'are not working on the default table(filter
table), use -t TABLENAME
to specify that target table.
iptables -D INPUT -i eth0 -p tcp --dport 443 -j ACCEPT
Note: This only deletes the first rule matched. If you have many rules matched(this can happen in iptables), run this several times.
iptables -D INPUT 2
Other than counting the number you can list the line-number with --line-number
parameter, for example:
iptables -t nat -nL --line-number