Under linux nice and simple port forwarding mapping tool rinetd

Under linux easy to use tool rinetd, implement port mapping / forwarding / redirection
official website address http://www.boutell.com/rinetd


Download
wget http://www.boutell.com/rinetd/http/rinetd.tar.gz

Extracting installer
tar zxvf rinetd.tar.gz
the make
the make install
[root @ PortForward02 rinetd] the make install #
install -m 700 rinetd / usr / sbin
install -m 644 rinetd.8 / usr / man / man8
install: CAN `not the Create Regular File / usr / man / man8 ': No file or Directory SUCH
make: *** [install] error 1
run may make mistakes, to be modified as follows, the rinetd.c file bindPort> = 65536 and connectPort> = 65536 modified 65535, or when you are prompted to make the system exceeds the maximum defined port, press n can search for the next
[root @ PortForward02 rinetd] # mkdir -p / usr / man /
[root @ PortForward02 rinetd] # make Clean
[root @ the rinetd localhost] the make #
CC -DLINUX -g -C -o rinetd.o rinetd.c
rinetd.c: 176: warning: conflicting types for Built-in function 'log'
CC -DLINUX -g -o match.o -C match.c
gcc rinetd.o match.o -o rinetd
[root@localhost rinetd]# make install
install -m 700 rinetd /usr/sbin
install -m 644 rinetd.8 /usr/man/man8

Edit Configuration
vi /etc/rinetd.conf
0.0.0.0 172.19.94.3 8080 8080
0.0.0.0 192.168.0.103 2222 3389
1.2.3.4 80 192.168.0.10 80

Explain (0.0.0.0 native binding indicates all available addresses)
of all requests sent to port 8080 of the unit 8080 forwarded to the port 172.19.94.3
forward all requests to port 2222 of the machine 3389 to 192.168.0.103 port
forwards all requests destined 1.2.3.4 port 80 to port 80 of 192.168.0.10

The command format is
bindaddress bindport connectaddress connectport
port address of the port address bound binding connector connection
or
[Source Address] [Source Port] [Destination Address] [Destination Port]
Source address Source Port Destination Address Destination Port

Start a program
pkill rinetd ## shutdown process
rinetd -c /etc/rinetd.conf ## starts forwarding
this command which can be added to /etc/rc.local to start automatically

View the status
netstat -antup

Note that
in the present binding machine 1.rinetd.conf port must not be used by another program
2. Run rinetd firewall system should be opened local port bound
example:
-A-Firewall-RH. 1 the INPUT -m-State - NEW -m -p TCP TCP -state --dport 1111 -j ACCEPT
-A RH-Firewall-State. 1---state the INPUT NEW -m -m -p TCP TCP --dport 2222 -j ACCEPT

Guess you like

Origin www.cnblogs.com/chenjw-note/p/10955224.html