How to list iptables rules

To view all rules in iptables, run

iptables -L

Or

iptables --list

To list iptables rules without resolving IP to hostname

iptables -L -n

To show the line number

iptables -L -n --line-number

To list NAT rules

iptables -t nat -L -n --line-number
iptables -t nat -L -n -v

If you run iptables-save command, it will list all iptables rules

iptables-save

You can redirect the result of the iptables-save command to a file. You can restore with iptables-restore command.

Back to iptables

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *