Use rinetd for port forwarding in CentOS

Source: Internet
Author: User

In windows, port forwarding generally uses built-in nat, porttunnel, and portmap.

The port forwarding ing program in linux is rinetd. The start method is rinetd-c/etc/rinetd. conf, and pkillrinetd is used to close the process.

Tools home: http://www.boutell.com/rinetd/

Download, decompress, and install the software


 
 
  1. wgethttp://www.boutell.com/rinetd/http/rinetd.tar.gz

  2. tarzxvfrinetd.tar.gz

  3. make

  4. makeinstall

Map port 11 of 1.1.1.1 to port 3389 of 2.2.2.2. The configuration file is as follows:

[Root @ localhostiso] # cat/etc/rinetd. conf

 
 
  1. 1.1.1.1112.2.2.13389

  2. 1.1.1.1122.2.2.23389

  3. 1.1.1.1132.2.2.322

  4. 1.1.1.1142.2.2.480

  5. allow*.*.*.*

  6. logfile/var/log/rinetd.log

Start the program
Pkillrinetd # Shut down the process
Rinetd-c/etc/rinetd. conf # start forwarding
Add this command to/etc/rc. local to run automatically upon startup.

View status
Netstat-antup


This article from the Linux community website (www.linuxidc.com) original link: http://www.linuxidc.com/Linux/2011-01/31287.htm

If you want to use iptables, you can use the following command.

 
 
  1. WAN_IP=”202.106.0.20″

  2. iptables-tnat-APREROUTING-ieth0-ptcp–dport2533-jDNAT–to192.168.1.88:80

  3. iptables-tnat-APOSTROUTING-oeth0-s192.168.1.88-ptcp–sport80-jSNAT–to$WAN_IP:2533


The first sentence defines a variable.
The second sentence is to forward requests with port 2533 to port 80 of 192.168.1.88.
Third, modify the source address output from etho to 192.168.1.88, and the source address of the packet with port 80 to port 2533 of the local machine so that the recipient can receive
The data packet can be returned correctly.

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.