centos configure DNS

1.yum download error

http://mirrors.163.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.163.com'"
Trying other mirror.

Solution:

Configure dns

vim /etc/resolv.conf

nameserver 8.8.8.8

service network restart

Restart not save

The original need to do:

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

Add the following:

PEERDNS = no
DNS1 = 8.8.8.8

Then run:

service network restart

ok!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Guess you like

Origin www.cnblogs.com/kwzblog/p/12619801.html