Port forwarding mapping program called RINETD,, directly Manke compiled installation.
[[Email protected] src]# wget http://www.boutell.com/rinetd/http/rinetd.tar.gz[[email protected] src]# lsrinetd.tar.gz[[email protected] src]# tar -zxvf rinetd.tar.gz [[email protected] src]# cd rinetd [[email protected] rinetd]# makecc -dlinux -g -c -o rinetd.o rinetd.crinetd.c:176: warning: conflicting types for built-in function ' log ' Cc -dlinux -g -c -o match.o match.cgcc rinetd.o match.o -o rinetd[[email protected] rinetd]# make installinstall -m 700 rinetd / Usr/sbininstall -m 644 rinetd.8 /usr/man/man8install: cannot create regular file '/usr/man/man8 ': no such file or directorymake: *** [ Install] error 1[[email protected] rinetd]#
Run make may have errors, the following modifications, the Rinetd.c file in the Bindport >= 65536 and Connectport >= 65536 is modified to 65535, or when make will be prompted to exceed the maximum system definition port, Press N to find the next place
[[email protected] rinetd]# vim RINETD.C 544 if ((Bindport = = 0) | | (Bindport >= 65535)) {567 if (Connectport = = 0) | | (Connectport >= 65535)) {
Manual Build Directory/usr/man/man8
[[email protected] rinetd]# mkdir-p/usr/man/man8[[email protected] rinetd]# make installcc-dlinux-g-c-o rinetd.o R inetd.crinetd.c:176:warning:conflicting types for built-in function ' log ' gcc rinetd.o match.o-o rinetdinstall-m Netd/usr/sbininstall-m 644 Rinetd.8/usr/man/man8[[email Protected] rinetd]#
The file path is prompted after success
Install-m Rinetd/usr/sbin
Install-m 644 RINETD.8/USR/MAN/MAN8
Create profile/etc/rinetd.conf, content format: Source IP Source port to jump IP port to jump to
For example, forward all requests destined for the native 80 port to port 80 of 192.168.4.247
[[email protected] rinetd]# vim/etc/rinetd.conf 0.0.0.0 80 192.168.4.247 80
start the program and add rinetd to boot
[[email protected] rinetd]# /usr/sbin/rinetd [[email protected] rinetd]# netstat -anltup|grep rinetdtcp 0 0 0.0.0.0:80 0.0.0.0:* listen 25019/rinetd [[email protected] rinetd]# cat /etc/rc.d/ rc.local |grep -v "#"/usr/sbin/rinetd -c /etc/rinetd.conftouch /var/lock/subsys/ Local[[email protected] rinetd]# killall -9 rinetd[[email protected] rinetd ]# netstat -anltup|grep rinetd[[email protected] rinetd]# /usr/sbin/rinetd [[EMAIL PROTECTED]&Nbsp;rinetd]#
This way, as long as the access to any browser: http://192.168.4.154 (rinetd server address) and access to http://192.168.4.247 the same effect.
Precautions
1. The native port bound in the rinetd.conf must not be occupied by another program
2. The system firewall running rinetd should open the bound native port
-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport 2222-j ACCEPT
3. FTP-skipping is not supported
This article is from "I am not a rookie" blog, please be sure to keep this source http://pvbutler.blog.51cto.com/7662323/1621753
Linux RINETD Port Forwarding deployment