Linux environment, two different network segments of the machine interoperability

Source: Internet
Author: User

The environment is as follows:

Host1 single NIC Eth0 172.24.100.15/16

Host2 dual nic eth0 172.24.100.14/16 eth1 192.168.122.214/24

Host3 single NIC Eth0 192.168.122.215/24


The entire environment such as:

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/86/33/wKioL1e3yZ6DIIxTAAGXBSD_-Gc165.png "title=" 1.png " alt= "Wkiol1e3yz6diixtaagxbsd_-gc165.png"/>

Requirements: Let host1 and HOST3 interoperability, that is, host1 can ping host3,host3 can ping through host1

Solve:

First, on the HOST2, ensure that you can ping host1 and host3 at the same time

Second, on the host1, add the following route

Route add default GW 172.24.100.14 #添加默认网关路由 to ensure that requests from host1 to 192.168.122.0/24 network segment arrive first Host2

Third, on the HOST2, add the following route

Route add-net 172.24.0.0 netmask 255.255.0.0 dev eth0 #添加路由, actually refers to the road, designated to the 172.24.0.0/16 network segment to go to the request through the ETH0 network card out of the route ad D-net 192.168.122.0 netmask 255.255.255.0 dev eth1 #添加路由, specify the request to the 192.168.122.0/24 network segment to go out with the ETH1 network card

Four, or on the Host2, turn on route forwarding as follows

Echo 1 >/proc/sys/net/ipv4/ip_forward

Five, on Host3, add the following route

Route add default GW 192.168.122.214 #添加默认网关路由 to ensure that requests from HOST3 to 172.24.0.0/16 network segment arrive first Host2

It's amazing how you can ping each other.

Linux environment, two different network segments of the machine interoperability

Related Article

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.