Iptables same network segment port forwarding

Source: Internet
Author: User

Iptables and network segment port forwarding Environment Description: You need to submit all packets accessing port 80 of the 192.168.1.20 host to 192.168.1.31 host for processing. Therefore, you need to perform the following operations on the host 192.168.1.20: 1. enable the routing forwarding function 1 echo "1">/proc/sys/net/ipv4/ip_forward2. add iptables Rule 1 iptables-t nat-I PREROUTING-p tcp -- dport 80-j DNAT -- to-destination 192.168.1.31: 802 iptables-t nat-I POSTROUTING-p tcp-d 192.168.1.31-j SNAT -- to-source 192.168.1.203. other commands 1 iptables-L-n2iptables-F # clear rules of all rule chains in the filter of the preset Table 3 iptables-X # clear rules 4 iptables-Z5 in the User-Defined chain in the filter of the preset table /etc/init. d/iptables save/restart/status6/etc/sysconfig/iptables

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.