To list all NAT (Network Address Translation) rules in the iptables
firewall on a Linux system, you can use the iptables
command with the -t
option to specify the NAT table and the -L
option to list the rules, like this:
sudo iptables -t nat -L
This will show a list of all NAT rules in the iptables
firewall, including the chain name, the rule number, the target of the rule, the protocol, and the source and destination addresses and ports.
You can also use the --line-numbers
option to include line numbers in the output, like this:
sudo iptables -t nat -L --line-numbers
This will show the line number of each rule in the list.
If you want to show more detailed information about each rule, you can use the -v
option to display the packet and byte counts for each rule, like this:
sudo iptables -t nat -L -v