Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check PREROUTING list from iptable in linux? [closed]

Tags:

I added 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 can see that the packet coming to port 1111 is correctly forwarded to 10.0.3.126:80. However if I list up 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 I added? Thank you in advance.

like image 612
John Doyle Avatar asked Jan 05 '17 07:01

John Doyle


People also ask

How do I view iptables list?

There are two different ways to view your active iptables rules: in a table or as a list of rule specifications. Both methods provide roughly the same information in different formats. To list out all of the active iptables rules by specification, run the iptables command with the -S option: sudo iptables -S.

How check NAT in Linux?

netstat-nat Displays NAT connections managed by netfilter/iptables which comes with the > 2.4. x linux kernels. The program reads its information from '/proc/net/ip_conntrack' or '/proc/net/nf_conntrack', which is the temporary conntrack-storage of netfilter.


Video Answer


1 Answers

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

like image 81
Yuriy Zhigulskiy Avatar answered Sep 24 '22 12:09

Yuriy Zhigulskiy