Linux ping command reports name or service not known error solution

The installed centos7 can not access the Internet solution:

First, the installed centos7 cannot access the Internet solution

1. Select VMWare's NAT mode.

Navigation bar "Edit"-> "Virtual Network Editor"-> NAT mode-> NAT settings
2. Edit the network configuration file

vi / etc / sysconfig / network-scripts / ifcfg-ens33 The
file name suffix ens33 is random. Use the command ip addr to view your own network card.

Ifcfg-ens33 modified content:
BOOTPROTO = “static” #Enable static IP address
ONBOOT = “yes” The
new content is as follows:
Insert picture description here
3. Restart the network
service network restart

4. Successfully pinged
Insert picture description here

There are two points that need special attention:
1) The IPADDR of ifcfg-ens33 and the last IP in the NAT settings should be different, not in a network segment. Can try a few more
2) Some dns is invalid

I tried 192.29.29.29, ping www.baidu.com always reported an error.
3) VMware VMnet8 mode shared host network configuration static IP and DNS
reference https://blog.csdn.net/axing2015/article/details/81516627 If it
still does not work, close the firewall
systemctl stop firewalld
systemctl disable firewalld

Second, the cloned centos7 configuration

1. Modify the static Ip and add 1 to the original number.

2. Modify the UUID (just change one of the numbers)
3. Modify the host name, which is different from the original virtual machine
vi / etc / hostname
4.vi /etc/resolv.conf Add nameserver 192.168.81.2 (nat forwarding mode DNS and The gateway is the same, fill in your own)

5.vi / etc / sysconfig / network Add
NETWORKING = yes
GATEWAY = 192.168.81.2 (the DNS in nat forwarding mode is the same as the gateway, fill in your own)
6. service network restart Restart the network, ping test
7. If it still does not work, in the VM Toolbar virtual machine settings remove the network card in the current virtual machine. Then add another network card and save it in nat mode. You can connect to the Internet.
Reference:
1.https: //www.cnblogs.com/frankdeng/p/9027037.html
2.https: //www.cnblogs.com/Liang-jc/articles/8097667.html

Published 137 original articles · Like 123 · Visit 250,000+

Guess you like

Origin blog.csdn.net/lz20120808/article/details/103488186