[code="java"]
# echo "202.106.195.68">/etc/resolv.conf
# cat /etc/resolv.conf
202.106.195.68
# echo "nameserver 202.106.195.68">/etc/resolv.conf
--设置dns
# cat /etc/resolv.conf
nameserver 202.106.195.68
# 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
# 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 ]
# 202.106.195.68
[/code]
# echo "202.106.195.68">/etc/resolv.conf
# cat /etc/resolv.conf
202.106.195.68
# echo "nameserver 202.106.195.68">/etc/resolv.conf
--设置dns
# cat /etc/resolv.conf
nameserver 202.106.195.68
# 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
# 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 ]
# 202.106.195.68
[/code]