iptables -Land get this
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere
ACCEPT all -- anywhere anywhere
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
For example I make rule to accept port 80, so I do this
iptables -I INPUT 3 -p tcp --dport 80 -j ACCEPTand then iptables -L give us this
Chain INPUT (policy ACCEPT)Look at third line, there is rule for accepting connection from port 80. The rule inserted in third line because I use 3 in this rule
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ACCEPT all -- anywhere anywhere
iptables -I INPUT 3 -p tcp --dport 80 -j ACCEPTIf we want to delete this single rule, do
iptables -D INPUT 3So iptables -L give us
Chain INPUT (policy ACCEPT)Source:
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere
ACCEPT all -- anywhere anywhere
http://major.io/2007/02/09/delete-single-iptables-rules/