Translated from: http://blog.chinaunix.net/uid-345389-id-2131648.html
Often encounter port forwarding situation, with iptable is often, but every time need to check the manual. See the article of the steamed bun, feel good, test feeling is very useful.
Port forwarding mapping program called RINETD, and did not find the version of the said, only one. Directly Manke compile and install.
[[email protected] tmp]# tar xvfz rinetd.tar.gz rinetd/ rinetd/getopt.h rinetd/rinetd.c rinetd/CHANGES rinetd/rinetd.8 rinetd/Makefile rinetd/README rinetd/index.html rinetd/rinetd.ncb rinetd/match.c rinetd/match.h rinetd/rinetd.opt rinetd/rinetd.dsw rinetd/rinetd.dsp rinetd/getopt.c rinetd/rinetd.plg rinetd/.CHANGES.swp rinetd/rinetd.exe [[email protected]
fan3838
tmp]# cd rinetd [[email protected]
fan3838
rinetd]# make cc -DLINUX -g -c -o rinetd.o rinetd.c rinetd.c:176: 警告:与内建函数 ‘log’ 类型冲突 rinetd.c: In function ‘readConfiguration’: rinetd.c:544: 警告:由于数据类型范围限制,比较结果永远为假 rinetd.c:567: 警告:由于数据类型范围限制,比较结果永远为假 rinetd.c: In function ‘log’: rinetd.c:1395: 警告:‘log’ 的地址总是等价为 ‘true’ cc -DLINUX -g -c -o match.o match.c gcc rinetd.o match.o -o rinetd [[email protected]
fan3838
rinetd]# make install install -m 700 rinetd /usr/sbin install -m 644 rinetd.8 /usr/man/man8
|
Installation complete only one binary file a Help file, through the man help can know that it needs a/etc/rinetd.conf configuration file, the content and format of the file is as follows:
Testing a simple example, the 172.16.86.113 113 port maps to the 172.16.81.88 80 port, the configuration file is as follows
[Email protected] etc]# cat/etc/rinetd.conf 172.16.86.113 113 172.16.81.88 80 Allow *.*.*.* Logfile/var/log/rinetd.log |
This way, as long as the access to any browser: http://172.16.86.113:113 and access to http://172.16.81.88 the same effect.
Startup is simple, rinetd can be executed.
Using RINETD to do port forwarding under Linux