如何从 linux 中的 iptable 检查 PREROUTING 列表?
How to check PREROUTING list from iptable in linux?
我在我的 iptable 中添加了数据包转发规则
sudo iptables -t nat -A PREROUTING -p tcp --dport 1111 -j DNAT --to-destination 10.0.3.126:80
我可以看到到达端口 1111 的数据包已正确转发到 10.0.3.126:80。但是,如果我列出规则,则看不到我添加的规则。
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
如何查看我添加的规则?
提前谢谢你。
使用iptables -L -n -t nat
命令
因为PREROUTING链是NAT规则的一部分
我在我的 iptable 中添加了数据包转发规则
sudo iptables -t nat -A PREROUTING -p tcp --dport 1111 -j DNAT --to-destination 10.0.3.126:80
我可以看到到达端口 1111 的数据包已正确转发到 10.0.3.126:80。但是,如果我列出规则,则看不到我添加的规则。
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
如何查看我添加的规则? 提前谢谢你。
使用iptables -L -n -t nat
命令
因为PREROUTING链是NAT规则的一部分