Linux settings and host hosts ping each other under virtual machines

Source: Internet
Author: User

Virtual machine under Linux set up and host each other PING Pass


For some reason: the picture of this document did not get up, if you have the need to leave a message oh

Lab Environment:

VMware Workstation 9.0

Red Hat 5.4

Host: The computer on which the virtual machine is installed

Experimental Purpose:

It's installed under the virtual machine. Linux but can't ping each other with the host

1, first determine the way to the Internet:

Open it:

650) this.width=650; "Width=" 553 "height=" 459 "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" Spacer.gif "/>

as shown, I have put Network Adapter checked the

There are three ways to access the Internet from above: Bridged,NAT,host-only

and I picked it. host-only this way of surfing the internet

and then tap OK to Save the settings.

Host-onlyInternet access:in thehost-onlymode, the virtual network is a fully enclosed network, and the only access to it is the host. Actuallyhost-onlyNetwork andNATthe network is very similar, the different place ishost-onlyNetwork is notNATservice, so the virtual network cannot connect toInternet. Communication between the host and the virtual machine is throughVMware Network adepter VMnet1Virtual network card to achieve the.   Reference Links:

"Link: http://www.cnblogs.com/ggjucheng/archive/2012/08/19/2646007.html"

from the above you can know to set the host's VMware Network adepter VMnet1 "the latter abbreviation Vmnet1 "virtual network card to implement.

2, guest hostVmnet1Virtual network card

If you can see VMnet1 Virtual network card:

650) this.width=650; "border=" 0 "width=" 554 "height=" 313 "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" spacer.gif "/>

Click the above VMware Network adepter VMnet1 virtual network card such as:

650) this.width=650; "border=" 0 "width=" 372 "height=" 424 "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" spacer.gif "/>

and then tap Properties such as:

650) this.width=650; "border=" 0 "width=" 376 "height=" 442 "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" spacer.gif "/>

and then tap Internet protocol version 4 , which can be seen as:

650) this.width=650; "border=" 0 "width=" 411 "height=" 428 "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" spacer.gif "/>

as shown in the IP Address:192.168.4.1 if not, the format is: 192.168.*.1

oneself can set, I here is:192.168.4.1 PS:"This address in the back to be used as a virtual machine inside the Linux Gateway"

okay , the host is here first . "Remember IP:192.168.4.1 and subnet mask: 255.255.255.0"

3, virtual machine under theLinux:

Modify the NIC

I am here to modify the network card directly through the configuration file:

Vi/etc/sysconfig/network-scripts/ifcfg-eth0

Device=eth0 # NIC name eth0 and this file name ifcfg-eth0 corresponds

ipaddr=192.168.4.11 #Linux IP, and gateways in the same network segment can be 192.168.4.*

netmask=255.255.255.0 #Linux Subnet mask is the same as the host's VMnet1 .

gateway=192.168.4.1 #Linux Gateway, that is, the host VMnet1 IP

Onboot=yes # automatically starts with the system

Startmode=onboot # default on the line

Userconrol=no # default on the line

Bootproto=none # default on the line

Type=ethernet # default on the line

Delete the original content, add the above content, each line of comments do not, save

then restart the NIC

[Email protected] ~]# servicenetwork Restart

shutting down interface eth0: [ OK ]

To turn off the loopback interface: [ OK ]

Eject Loopback interface: [ OK ]

Popup interface eth0: [ OK ]

And then

[Email protected] ~]# ifconfig

eth0 Link encap:ethernet HWaddr 00:0c:29:ff:0f:fa

inet addr:192.168.4.11 bcast:192.168.4.255 mask:255.255.255.0

Inet6 ADDR:FE80::20C:29FF:FEFF:FFA/64 Scope:link

Up broadcast RUNNING multicast mtu:1500 metric:1

RX packets:46488 errors:0 dropped:0 overruns:0 frame:0

TX packets:34997 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:4073614 (3.8 MiB) txbytes:5376370 (5.1 MiB)

interrupt:67 Base address:0x2024

Lo Link encap:local Loopback

inet addr:127.0.0.1 mask:255.0.0.0

Inet6 addr::: 1/128 scope:host

Up LOOPBACK RUNNING mtu:16436 metric:1

RX packets:4125 errors:0 dropped:0 overruns:0 frame:0

TX packets:4125 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:208269 (203.3 KiB) txbytes:208269 (203.3 KiB)

then ping the host to the virtual machine .

650) this.width=650; "border=" 0 "width=" 442 "height=" "src=",/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" spacer.gif "/>

All right

look at the host's IP :172.19.159.2 , then ping the virtual machine inside :

Such as:

650) this.width=650; "border=" 0 "width=" 523 "height="-"src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" spacer.gif "/>

The problem comes, from the virtual machine inside cannotPingPass:

Start the solution:

or find:

650) this.width=650; "Width=" 554 "height=" 283 "src="/e/u261/themes/default/images/spacer.gif "hspace=" style= " Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" spacer.gif "/>
Click Wi-Fi internet access appears:

650) this.width=650; "border=" 0 "width=" 373 "height=" 423 "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" spacer.gif "/>

and then tap Properties , appears:

650) this.width=650; "border=" 0 "width=" 375 "height=" 437 "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" spacer.gif "/>

and then tap  shared option that appears:

650) this.width=650; "Width=" 376 "height=" 441 "src="/e/u261/themes/default/images/spacer.gif "hspace=" style= " Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" spacer.gif "/>
then select the drop-down box as shown in the following:

650) this.width=650; "border=" 0 "width=" 366 "height=" 431 "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" spacer.gif "/>

Then click OK and it will appear:

650) this.width=650; "border=" 0 "width=" 492 "height=" "" Src= "/e/u261/themes/default/images/spacer.gif" style= " Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" spacer.gif "/>

It means that if you set up sharing, Vmnet1 IP will change into 192.168.137.1, okay, first click Yes,

and then we're going to Vmnet1 IP changed to 192.168.4.1 Change method: Go to step 2 to find the last one, and then replace the 192.168.4.1"must be changed here, or it will not be successful."

so you can ping it .

650) this.width=650; "border=" 0 "width=" 546 "height=" "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" spacer.gif "/>

by now set up, can ping each other through;


This article is from the "You Devil" blog, please be sure to keep this source http://599184429.blog.51cto.com/5147223/1552711

Linux settings and host hosts ping each other under virtual machines

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.