Port forwarding under Windows is generally used with its own NAT and Porttunnel, Portmap
Linux Lower port forwarding mapping program called RINETD, Startup method Rinetd-c/etc/rinetd.conf, Pkill rinetd shutdown process
Tools Home: http://www.boutell.com/rinetd/
Software download, decompression and installation
wget http://www.boutell.com/rinetd/http/rinetd.tar.gz
Tar zxvf rinetd.tar.gz
Make
Make install
Map the 1.1.1.1 11 port to the 2.2.2.2 3389 port and the configuration file is as follows
[[email protected] ISO] #cat/etc/rinetd.conf
1.1.1.1 11 2.2.2.1 3389
1.1.1.1 12 2.2.2.2 3389
1.1.1.1 13 2.2.2.3 22
1.1.1.1 14 2.2.2.4 80
Allow *.*.*.*
Logfile/var/log/rinetd.log
Start the program
Pkill rinetd # #关闭进程
Rinetd-c/etc/rinetd.conf # #启动转发
Add this command to the/etc/rc.local and you can start the operation automatically.
View status
Netstat-antup
This article is from the Linux commune website (www.linuxidc.com) Source Link: http://www.linuxidc.com/Linux/2011-01/31287.htm
If you want to implement with iptables, you can use the command.
Wan_ip= "202.106.0.20″
Iptables-t nat-a prerouting-i eth0-p tcp–dport 2533-j dnat–to 192.168.1.88:80
Iptables-t nat-a postrouting-o eth0-s 192.168.1.88-p tcp–sport 80-j snat–to $WAN _ip:2533
The first sentence defines a variable
The second sentence implements a 80 port that forwards a request to port 2533 to 192.168.1.88
The third sentence modifies the source address of the output from Etho to 192.168.1.88, the source address of the packet with port 80 is the native 2533 port so that the other party receives
The packet is returned correctly after the packet.
Use rinetd to do port forwarding under CentOS