The first thing to do is the/etc/sysctl.conf configuration file Net.ipv4.ip_forward = 1 default is 0.
This allows Iptalbes FORWARD.
Vi/etc/sysconfig/iptables adding *nat Segments
*nat
:P rerouting ACCEPT [0:0]
:P ostrouting ACCEPT [0:0]
: OUTPUT ACCEPT [0:0]
-A prerouting-d 202.168.349.101-p tcp--dport 16688-j DNAT--to-destination 192.168.2.35:16688
-A postrouting-d 192.168.2.35-p tcp--dport 16688-j SNAT--to 192.168.2.55
COMMIT
Among them, the 202.168.349.101 for the external network ip,192.168.2.35 for the intranet ip,16688 as the port to do forwarding, 192.168.2.55 for forwarding to the destination IP
Restart Iptables
Service Iptables Restart
Test forwarding
Telnet 192.168.2.35 16688
This article is from the "Guangzhou Linux operation and Maintenance" blog, please be sure to keep this source http://milenovo.blog.51cto.com/10554394/1719318
Linux System port mapping (route forwarding)