Linux System port mapping (route forwarding)

Source: Internet
Author: User

The first thing to do is the/etc/sysctl.conf configuration file Net.ipv4.ip_forward = 1 default is 0.
This allows Iptalbes FORWARD.

Vi/etc/sysconfig/iptables adding *nat Segments

*nat
:P rerouting ACCEPT [0:0]
:P ostrouting ACCEPT [0:0]
: OUTPUT ACCEPT [0:0]

-A prerouting-d 202.168.349.101-p tcp--dport 16688-j DNAT--to-destination 192.168.2.35:16688
-A postrouting-d 192.168.2.35-p tcp--dport 16688-j SNAT--to 192.168.2.55

COMMIT


Among them, the 202.168.349.101 for the external network ip,192.168.2.35 for the intranet ip,16688 as the port to do forwarding, 192.168.2.55 for forwarding to the destination IP


Restart Iptables

Service Iptables Restart


Test forwarding

Telnet 192.168.2.35 16688


This article is from the "Guangzhou Linux operation and Maintenance" blog, please be sure to keep this source http://milenovo.blog.51cto.com/10554394/1719318

Linux System port mapping (route forwarding)

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.