iptables -L #or iptables -L -n
#reject connections iptables -A <CHAIN> -d <IP>/32 -j REJECT --reject-with icmp-port-unreachable
#list rules in chain iptables -L <CHAIN> --line-numbers #remove line 1 in chain iptables -D <CHAIN> 1
Create a backup
iptables-save > /backup/iptables-lunetikk-20190604.bck
Restore from a backup
iptables-restore < /backup/iptables-lunetikk-20190604.bck
This method can also be used to edit rules via vi.
Command | Function |
---|---|
iptables -L | List all rules |
iptables -L --line-numbers | List all rules with numbers |
iptables -L -w | Use -w if iptables is already in use, your command will retry until the proc is unlocked |