I have PC A (192.168.255.126, eth1) and it will receive some UDP packets, port: 51000.
Now I wish the PC A will automatically forward the UDP packets to PC B (192.168.255.127)
I have found many solutions but all of them don't work.
Solution A:
iptables -A PREROUTING -t nat -i eth1 -p udp --dport 51000 -j DNAT --to-destination 192.168.255.127:51000
iptables -A FORWARD -p udp -d 192.168.255.127 --dport 51000 -j ACCEPT
iptables -A POSTROUTING -t nat -s 192.168.255.127 -o eth1 -j MASQUERADE
Solution B:
iptables -t nat -I PREROUTING -p udp --dport 51000 -j DNAT --to 192.168.255.126:51000
Solution C:
iptables -t nat -A PREROUTING -p udp --dport 51000 -j NETMAP --to 192.168.255.127
So what should I do?