Simple and easy to use tool RINETD Linux to implement port mapping/forwarding/redirection
Official website Address http://www.boutell.com/rinetd
Software downloads
wget http://www.boutell.com/rinetd/http/rinetd.tar.gz
Decompression Installation
Tar zxvf rinetd.tar.gz
Make
Make install
Edit Configuration
Vi/etc/rinetd.conf
0.0.0.0 8080 172.19.94.3 8080
0.0.0.0 2222 192.168.0.103 3389
1.2.3.4 80 192.168.0.10 80
Description (0.0.0.0 indicates that all available addresses are native bound)
Forward all requests to native 8080 ports to port 8080 of 172.19.94.3
Forward all requests to native 2222 ports to port 3389 of 192.168.0.103
Forward all 80 port requests sent to 1.2.3.4 to 192.168.0.10 80 ports
Command format is
Bindaddress Bindport connectaddress Connectport
Binding address-bound port connected to the address of the port connected
Or
[Source Address] [Source Port] [Destination Address] [Destination Port]
Source address source port destination Address destination port
Start Program
Pkill rinetd # #关闭进程
Rinetd-c/etc/rinetd.conf # #启动转发
Add this command to the/etc/rc.local and it will run automatically.
View status
Netstat-antup
Need to be aware
The native port bound in 1.rinetd.conf must not be occupied by another program
2. The system firewall running rinetd should open the bound native port
For example:
-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport 1111-jaccept
-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport 2222-jaccept