日期:2014-05-16  浏览次数:20756 次

linux 配置dns
[root@localhost ~]# echo "202.106.195.68">/etc/resolv.conf
[root@localhost ~]# cat /etc/resolv.conf
202.106.195.68
[root@localhost ~]# echo "nameserver 202.106.195.68">/etc/resolv.conf
--设置dns 
[root@localhost ~]# cat /etc/resolv.conf
nameserver 202.106.195.68
[root@localhost ~]# ping www.baidu.com
PING www.a.shifen.com (61.135.169.125) 56(84) bytes of data.
64 bytes from 61.135.169.125: icmp_seq=0 ttl=55 time=15.0 ms
64 bytes from 61.135.169.125: icmp_seq=1 ttl=55 time=16.4 ms

--- www.a.shifen.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 15.095/15.775/16.455/0.680 ms, pipe 2
[root@localhost ~]# service network restart--重启network服务
Shutting down interface eth0:  [  OK  ]
Shutting down loopback interface:  [  OK  ]
Setting network parameters:  [  OK  ]
Bringing up loopback interface:  [  OK  ]
Bringing up interface eth0:  [  OK  ]
[root@localhost ~]# 202.106.195.68