First make sure you have done the following in the setting:
net.ipv4.ip_forward=1
Assume we want to listen to port 12345, and forward it to internal ip 192.168.1.100 with port 12345:
iptables -t nat -A PREROUTING -p tcp --dport 12345 -j DNAT --to-destination 192.168.1.100:12345 iptables -t nat -A POSTROUTING -j MASQUERADE
For udp protocol, change the first line with udp instead of tcp.
You might want to save the iptables by:
iptables-save