Nat of Iptables series and its filtering function

Source: Internet
Author: User

Nat:network address Transfer, a network address translation, converts the addresses of hosts on a network in which one of the NICs are connected to the address of a host in another network. Routing can also be implemented to convert a message in one network to another network

The application scenario is:

SNAT: Source address translation, conversion of IP messages in the source IP address

Dnat: Target address translation, conversion of IP address

The following describes how to implement message forwarding between hosts through routing

Example Analysis:

Prepare three virtual machines, one host is assumed to be C host (routing), there are two network cards, the first network card set to bridge, the second block set to Host-only

One host is assumed to be a host, the network card is set to bridge, the other host assumes B host, and the NIC is set to Host-only

C Host two network card IP is: 172.16.50.10;192.168.10.1

B Host IP: 172.16.50.5 Gateway: 172.16.50.10

A host IP is: 192.168.10.2 Gateway: 192.168.10.1

1, first on the B host can ping their own gateway 192.168.10.1

2, open the C host data forwarding function (modify the configuration file, can be permanently effective)

[Root@localhost ~]# vim/etc/sysctl.conf

Net.ipv4.ip_forward = 1

[Root@localhost ~]# sysctl-p Direct entry into force

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.