To list nat rules on Linux operating system, type the following command as root user:
# iptables -t nat -v -L -n --line-number
Sample outputs:
Chain PREROUTING (policy ACCEPT 180 packets, 15161 bytes) num pkts bytes target prot opt in out source destination Chain INPUT (policy ACCEPT 42 packets, 3562 bytes) num pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 94 packets, 6392 bytes) num pkts bytes target prot opt in out source destination Chain POSTROUTING (policy ACCEPT 94 packets, 6392 bytes) num pkts bytes target prot opt in out source destination 1 10 762 MASQUERADE all -- * eth1 10.8.0.0/24 0.0.0.0/0 2 0 0 MASQUERADE all -- * eth1 10.8.0.0/24 0.0.0.0/0 3 0 0 MASQUERADE all -- * eth1 10.0.0.0/8 0.0.0.0/0 4 0 0 MASQUERADE all -- * eth1 10.0.0.0/8 0.0.0.0/0 5 40 3360 SNAT all -- * * 10.8.0.0/24 0.0.0.0/0 to:202.54.1.5 |
How do I list iptables PREROUTING nat rules on Linux?
Type the following command:
# iptables -t nat -v -L PREROUTING -n --line-number
How do I list iptables POSTROUTING nat rules on Linux?
Type the following command as root user:
# iptables -t nat -v -L POSTROUTING -n --line-number
Examples and usage: Linux Iptables Delete postrouting Rule Command