Using RINETD to do port forwarding under Linux

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.