How to List All Iptables NAT Rules

Posted on November 6, 2020 at 7:20 pm

Use this iptables command-line to view all NAT rules:

iptables -t nat -S

Here is an example output:

-P PREROUTING ACCEPT
-P INPUT ACCEPT
-P POSTROUTING ACCEPT
-P OUTPUT ACCEPT
-A POSTROUTING -s 10.8.0.0/24 -o ens2 -j MASQUERADE

To view INPUT, FORWARD, OUTPUT iptables rules just use:

iptables -S

Here is an example output:

-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-A INPUT -i tun0 -j ACCEPT
-A INPUT -i ens2 -p udp -m udp --dport 1194 -j ACCEPT
-A FORWARD -i tun0 -o ens2 -j ACCEPT
-A FORWARD -i ens2 -o tun0 -j ACCEPT

Receive updates via email

Other Posts

Updated Posts