2 Linux systems, 2 clients in the virtual machine communicate, and can ping through the host name

Source: Internet
Author: User


Achieve the goal: 2 Linux systems, 2 clients in the virtual machine communicate, and can ping through the host name

Lab Preparation: 1.2 Linux systems, one Win7, one win2008 in the virtual machine

2.linuxA and LINUXB as 2 routers, Win7 and win2008 as 2-terminal clients

3.2 Linux installed with one NIC device

Introduction: This experiment uses Cisco routing switching technology.

The access path to the experiment we are implementing is as follows:

Client win7----->linux A----->linux B-----> Client win2008

And the implementation can also achieve communication by pinging the host name

In a virtual machine, be sure to set the client and Linux a network interface eth0 on the same VM segment 5

Set the network interface for Linux a eth1 and Linux B network interface eth0 on the same network segment VM6

Set the network interface for Linux b eth1 and client 2008 on the same network segment VM7

The purpose of the above is to separate 2 routers (Linux system to act as) and 2 clients, otherwise the same network segment VM, without the configuration of two clients can communicate, the experiment is worthless.





Experimental process:


Client Win7 Configuration

Client Win7 network address configuration see attachment map Win7network


The client win7hosts folder also needs to configure//Configure DNS resolution domain names, which are configured in this Hosts file earlier in the DNS

DNS, we do experiments for the first use this, see annex diagram win7hosts







LINUX a configuration details

[[Email protected]~]# vim/etc/sysconfig/network-scripts/ifcfg-eth0//Configure the NIC interface for Linux a eth0 IP ground

192.168.1.254 as well as the mask 255.255.255.0 and the set does not automatically get the IP to none. See annex Figure 1


[[Email protected]~]# vim/etc/sysconfig/network-scripts/ifcfg-eth1//Configure the NIC interface for Linux a eth1 IP ground

192.168.2.1 as well as the mask 255.255.255.0 and the set does not automatically get the IP to none. See annex Figure 2

[[Email protected]~]# vim/etc/sysconfig/network//Configure Linux a hostname see Figure 3


[[Email protected]~]# vim/etc/hosts//Configure DNS resolution domain name, which was configured in this Hosts file earlier in the DNS

DNS, we do experiments for the first use of this//detailed configuration see annex Figure 4


[[Email protected]~]# vim/etc/sysctl.conf//Turn Linux A on the routing feature configuration see attachment Figure 5

[[email protected] ~]# sysctl-p//enable Linux a routing


[[Email protected]~]# vim/etc/sysconfig/network-scripts/route-eth1 //config gateway also called routing table, here is very

Important, folders created under the/etc/sysconfig/network-scripts/directory are strictly route-eth1, and the file name must be

Route, followed by-the port device number eth1 to the destination address. Detailed configuration in the file is shown in the attached Figure 6


[[Email protected] ~]# Service Network restart//Restart network services for configuration to take effect and generate IP, mask and routing table

[[Email protected]~] #ifconfig//Verify that the configuration is correct primarily view the configuration of the NIC device eth0 and eth1


[[Email protected]~]# chkconfig Network on//Let network start with system boot









LINUX B Configuration Details

[[Email protected]~]# vim/etc/sysconfig/network-scripts/ifcfg-eth0//Configure the NIC interface of Linux b eth0 IP ground

192.168.2.2 as well as the mask 255.255.255.0 and the set does not automatically get the IP to none. See annex Figure 7


[[Email protected]~]# vim/etc/sysconfig/network-scripts/ifcfg-eth1//Configure the NIC interface of Linux b eth1 IP ground

10.0.0.2 as well as the mask 255.255.255.0 and the set does not automatically get the IP to none. See annex Figure 8

[[Email protected]~]# vim/etc/sysconfig/network//configure Linux B host name see Figure 9


[[Email protected]~]# vim/etc/hosts//Configure DNS resolution domain name, detailed configuration see attached Figure 10


[[Email protected]~]# vim/etc/sysctl.conf//Turn Linux B on the routing feature configuration see attached Figure 11

[[email protected] ~]# sysctl-p//enable Linux B routing


[[Email protected]~]# vim/etc/sysconfig/network-scripts/route-eth0 //config gateway also called routing table, here is very

Important, folders created under the/etc/sysconfig/network-scripts/directory are strictly Route-eth0, and the file name must be

Route, followed by-the port device number eth0 to the destination address. Detailed configuration in the file is shown in the attached Figure 12


[[Email protected] ~]# Service Network restart//Restart network services for configuration to take effect and generate IP, mask and routing table

[[Email protected]~] #ifconfig//Verify that the configuration is correct primarily view the configuration of the NIC device eth0 and eth1


[[Email protected]~]# chkconfig Network on//Let network start with system boot







Client win2008 Configuration

Client win2008 network address configuration see attachment map Win2008network


The client win2008hosts folder also needs to be configured//configured with DNS resolution domain name, see attachment Diagram win2008hosts





Witness the moment of miracles:

Start cmd in the client win7, and use command tracert to track whether our client Win7 's routing table pings the client win2008 as we think. and using the client win7 to ping LINUX B's hostname,

The results are shown in the Appendix "Experimental Verification"


Pure hand fight!!!





This article is from the "Sunandmoon" blog, make sure to keep this source http://ssunandmoon.blog.51cto.com/10047194/1633216

2 Linux systems, 2 clients in the virtual machine communicate, and can ping through the host name

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.