NAT outgoing connections originated from 192.160.0.0/24

$ iptables -A POSTROUTING -t nat -s 192.160.0.0/24 -d \! 192.160.0.0/24 -o eth0 -j SNAT --to 10.1.2.3
(10.1.2.3 being the official IP to the outside world)

NAT incomming connections on port 5000 to the internal server 192.168.0.2

$ iptables -t nat -A PREROUTING -i eth0 -p udp -d 10.1.2.3 --dport 5000 -j DNAT --to 192.168.0.2

copyright © 1997-2024  Oliver Schroeder (remove XYZ)