NAT 和 UDP - IP 源广播

NAT 和 UDP - IP 源广播

我遇到了 UDP 和广播的 NAT 问题:

iptables 配置:(同一服务器的基本端口重定向,UDP 80 到 8080)

iptables -t nat -A PREROUTING -p udp --dport 80 -j REDIRECT --to-port 8080

设想 :

192.168.0.1:1234 broadcast "hello" to 192.168.0.255:80
192.168.0.2:80 receives (NAT) to port 8080
192.168.0.2:8080 answers "I'm here !" to sender (192.168.0.1:1234)
192.168.0.1:1234 get "I'm here" with the Source IP 192.168.0.255:80

问题:我需要源 IP192.168.0.2:80而不是广播192.168.0.255:80,我该怎么做呢?

我已经尝试通过 POSTROUTING SNAT 将 192.168.0.255 更改为 192.168.0.2,但数据包没有进入表。

答案1

由于各种奇怪的行为,我最终使用了索卡特重定向端口并且不再出现问题(它会消耗更多资源但没有问题)

相关内容