Port ing (route forwarding) in Linux)

Source: Internet
Author: User

Port ing (route forwarding) in Linux)

In Linux, port ing (route forwarding) should first be done in the/etc/sysctl. conf configuration file. net. ipv4.ip _ forward = 1. The default value is 0.

This allows iptalbes FORWARD.

Vi/etc/sysconfig/iptables add * nat segment

* Nat

: Prerouting accept [0: 0]

: Postrouting accept [0: 0]

: Output accept [0: 0]

-A prerouting-d 2018.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

202.16349.101 is an Internet ip address, 192.168.2.35 is an intranet ip address, 16688 is the forwarding port, and 192.168.2.55 is the destination ip address.

Restart iptables

Service iptables restart

Test forwarding

Telnet 192.168.2.35 16688

This article permanently updates the link address:

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.