Ping nowhere on a virtual machine outside the network, but can access the Internet (such as using curl www.baidu.com can return content)

Enter ping www.baidu.com in a virtual machine, the following may occur several error

1. ping: unknown host www.baidu.com 

2.PING www.a.shifen.com (183.232.231.172) 56(84) bytes of data.

These two are not properly configured DNS server

Solution: Open a command window, type ipconfig / all in the window 

    Find a place of your current internet connection, because my computer is connected to a wireless, so in Wi-Fi zone, if it is wired connection possible is called local connection to this area, then find dns server entries in this area and down.


Ping nowhere on a virtual machine outside the network, but can access the Internet (such as using curl www.baidu.com can return content)

Then open the network interface, click on the right properties vmnet 8, as FIG.

Ping nowhere on a virtual machine outside the network, but can access the Internet (such as using curl www.baidu.com can return content)

After vmnet8 Properties window will pop up, double-click Internet Protocol Version 4 Internet Protocol Version 4 Properties pop-up window, and then the focus here

Select "Use the following DNS server addresses" and the bottom thereof is provided of DNS, the DNS addresses just note the two respective input determination save

Ping nowhere on a virtual machine outside the network, but can access the Internet (such as using curl www.baidu.com can return content)

On the virtual machine, enter vi /etc/resolv.conf edit resolv.conf file

Add the following red box contents, two behind ip is just to let you remember, write after save and exit

Ping nowhere on a virtual machine outside the network, but can access the Internet (such as using curl www.baidu.com can return content)

Then enter vi / etc / sysconfig / network-scripts / ifcfg-ens33 edit ifcfg-ens33 file (note that this is not necessarily the file name is the name everyone, you VMs on the card what is, what is the name, but will be in under / etc / sysconfig / network-scripts / directory, you can look for myself and my file name similar document) is configured as shown on my virtual machine

Ping nowhere on a virtual machine outside the network, but can access the Internet (such as using curl www.baidu.com can return content)

BOOTPROTO find items to see is not equal to dhcp, then if it is coupled with PEERDNS = no phrase (this is to prevent lead to just restart the service resolv.conf configuration file will be changed, in order from the configuration again so add the phrase)

Finally, enter systemctl restart network.service restart network services

Now the external network ping www.baidu.com like you can ping the

 

Then when there may appear ping www.baidu.com been waiting for the return of the entire interface stuck, but no error ip ping other external networks is the same: ps addition.

Solution: this problem is likely to open a network share that you check your network is not shared.

Open Network and Sharing Center -> Change adapter settings in the following figure is open to share

Ping nowhere on a virtual machine outside the network, but can access the Internet (such as using curl www.baidu.com can return content)

How close? Right select Properties to bring up the following Wireless Network Connection Properties window, check the red box to cancel OK to save

Ping nowhere on a virtual machine outside the network, but can access the Internet (such as using curl www.baidu.com can return content)

Guess you like

Origin blog.51cto.com/12967094/2408314