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

Source: Internet
Author: User


Achieving the goal: in a virtual machine 2 Desk Linux System, 2 client to communicate, and can use the host name Ping Pass

Experiment Preparation: 1. 2 Linux Systems in the virtual machine , one win7, one win2008

2.linuxA and the LINUXB as a 2 router, Win7 and the win2008 as a 2 -Side Client

3.2 Desk Linux Add a network card 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 achieve through Ping host name can also be used for communication

in a virtual machine, be sure to set the client and LINUX A the network interface eth0 in the same VMS Network Segment 5

Set the network interface for linux A eth1 and linux B Network interface eth0 on the same network segment VM6

Set LINUX B 's network interface eth1 and clients VM7 in the same network segment

The purpose of the above is to separate 2 Station Router ( LINUX system acting) and 2 client, or the same network segment VMS , there is no value in the experiment without having to configure both client computers to communicate.

Experimental process:

Client Win7 Configuration

Client Win7 network address configuration see attachment map win7network

Client win7hosts folders also need to be configured      // Configuration DNS resolves the domain name, which is DNS The early days were all in this hosts Configuration in Files

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

LINUX A Configuration Details

[Email protected]~]# vim/etc/sysconfig/network-scripts/ifcfg-eth0// Configuration LINUX A the NIC interface eth0 of the IP to

Address 192.168.1.254 and Masks 255.255.255.0 and settings do not get automatically IP to be None . See annex Figure 1

[Email protected]~]# vim/etc/sysconfig/network-scripts/ifcfg-eth1// Configuration LINUX A the NIC interface eth1 of the IP to

Address 192.168.2.1 and Masks 255.255.255.0 and settings do not get automatically IP to be None . See annex Figure 2

[Email protected]~]# vim/etc/sysconfig/network// Configuration LINUX A host name See Figure 3

[Email protected]~]# vim/etc/hosts// Configuration DNS resolves the domain name, which is DNS The early days were all in this hosts Configuration in Files

DNS , we'll do the experiment for the moment.        // detailed configuration See attachment diagram 4

[Email protected]~]# vim/etc/sysctl.conf// will be LINUX A turn on the routing feature configuration See attachment Figure 5

[email protected] ~]# sysctl-p// enabled LINUX A Routing        

[[Email protected]~]# vim/etc/sysconfig/network-scripts/route-eth1    // Configure the gateway, also called the routing table, here Very

important, in /etc/sysconfig/network-scripts/ folders created under the directory route-eth1 have strict requirements, the file name must be

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

[[Email protected] ~]# Service Network restart// Restart Network service, let the configuration take effect, and generate IP , masks, and routing tables

[email protected]~] #ifconfig// Verify that the configuration is correct primary view NIC device eth0 and the eth1 the configuration

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



LINUX B Configuration Details

[Email protected]~]# vim/etc/sysconfig/network-scripts/ifcfg-eth0// Configuration LINUX B the NIC interface eth0 of the IP to

Address 192.168.2.2 and Masks 255.255.255.0 and settings do not get automatically IP to be None . See annex Figure 7

[Email protected]~]# vim/etc/sysconfig/network-scripts/ifcfg-eth1// Configuration LINUX B the NIC interface eth1 of the IP to

Address 10.0.0.2 and Masks 255.255.255.0 and settings do not get automatically IP to be None . See annex Figure 8

[Email protected]~]# vim/etc/sysconfig/network// Configuration LINUX B host name See Figure 9

[Email protected]~]# vim/etc/hosts// Configuration DNS Resolve domain name, detailed configuration see attachment diagram Ten

[Email protected]~]# vim/etc/sysctl.conf// will be LINUX B turn on the routing feature configuration See annex Diagram

[email protected] ~]# sysctl-p// enabled LINUX B Routing        

[[Email protected]~]# vim/etc/sysconfig/network-scripts/route-eth0 // The configuration gateway is also called the routing table, which is very

important, in /etc/sysconfig/network-scripts/ folders created under the directory Route-eth0 have strict requirements, the file name must be

Route , followed by - Port device number to the destination address eth0 . Detailed configuration in the file is shown in the Appendix

[[Email protected] ~]# Service Network restart// Restart Network service, let the configuration take effect, and generate IP , masks, and routing tables

[email protected]~] #ifconfig// Verify that the configuration is correct primary view NIC device eth0 and the eth1 the configuration

[[Email protected]r~]# chkconfig Network on// Let Network starts with system boot

Client win2008 Configuration

Client win2008 network address configuration see attachment map win2008network

Client win2008hosts folders also need to be configured           // Configuration DNS resolve domain name, see attachment map win2008hosts


Witness the moment of miracles:

in the client Win7 start in cmd , with the command tracert Track Our Clients Win7 The routing table is going according to our idea Ping Client win2008 . and using the client win7 to ping LINUX B 's hostname,

results See annex Diagram " Experimental Validation "

Pure hand fight!!!


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

2 Linux systems, 2 clients in the virtual machine are communicating, and can be 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.