I added packet forwarding rule in my iptablesudo 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.
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.
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.
Use iptables -L -n -t nat
command
Because PREROUTING chain is a part of NAT rules
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With