我正在使用 CentOS 6.5,并且在我的 iptables 中添加了以下命令以将端口 8088 上的所有传入流量转发到 4569:
iptables -A PREROUTING -t nat -p udp --dport 8088 -i eth0 -j DNAT --to-destination 127.0.0.1:4569
iptables -I FORWARD 1 -d 127.0.0.1 -p udp --dport 4569 -j ACCEPT
Run Code Online (Sandbox Code Playgroud)
iptables --list
显示以下输出:
iptables --list
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT udp -- anywhere localhost.localdomain udp dpt:iax
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Run Code Online (Sandbox Code Playgroud)
但是当我在 udp 端口 4569 上进行数据包跟踪时,我在该端口上看不到任何数据包。然后我添加了这个:
iptables …
Run Code Online (Sandbox Code Playgroud)