How to check PREROUTING list from iptable in linux?

I added a packet forwarding rule in my iptable sudo iptables -t nat -A PREROUTING -p tcp --dport 1111 -j DNAT --to-destination 10.0.3.126:80
and I see that the packet arriving at port 1111 is correctly redirected to 10.0.3.126:80. However, if I listed the rules, I cannot see the rule that I added.

sudo iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:domain
ACCEPT     udp  --  anywhere             anywhere             udp dpt:domain
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:bootps
ACCEPT     udp  --  anywhere             anywhere             udp dpt:bootps

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

How can I view the rule that I added? Thank you in advance.

+4
source share
1 answer

Use the command iptables -L -n -t nat
Because the PREROUTING chain is part of the NAT rules

+7
source

Source: https://habr.com/ru/post/1665836/


All Articles