centOS7 can ping the host can not access the Internet

Preface:

  Suddenly open their own virtual machines shortly before centOS7 system installation, before the discovery can be networked suddenly can not access the Internet, read online in many ways, finally solved

Problem Description:

Connect to the Internet, but different ping outside the network, such as ping www.baodu.com

How to determine the DNS does not work?

# Ping www.qq.com #ping nowhere
# ping 8.8.8.8 # can ping

This time, DNS may not work in a state of normal.

       Usually can not resolve domain names are generally DNS domain configuration problem

Command cd / etc / sysconfig / network-scripts / Modify

f / etc / sysconfig / network- scripts / cfg-ethxxxxxxx, x may be other figures, but generally is ifcfg-eth0, the specific card determined according to your X, is added at the bottom:
the DNS1 #google DNS = 8.8.8.8 server, according to the actual replacement
DNS2 = 8.8.4.4 #google dns server, to replace the actual situation

esc + shift +: wq command to save and exit the editor, check whether the DNS setting
# cat /etc/resolv.conf. 

Restart Network

命令:systemctl restart NetworkManager.service

 

You can configure each network automatically in ifcfg_ens ~~~ "ONBOOT = no" change "ONBOOT = nyes", so every time you start linux system on the network without having to manually

 

 

Guess you like

Origin www.cnblogs.com/L-lingyi/p/12002705.html