Not on ubuntu network: Configuring DNS Domain Name Service

 Ubuntu 16.04.1 LTS

ubuntu@ubuntu-W760-G20:~$ ping www.baidu.com
ping: unknown host www.baidu.com
ubuntu@ubuntu-W760-G20:~$ ping 192.168.205.122
PING 192.168.205.122 (192.168.205.122) 56(84) bytes of data.
64 bytes from 192.168.205.122: icmp_seq=1 ttl=64 time=0.107 ms

ubuntu@ubuntu-W760-G20:~$ ping 114.114.114.114
PING 114.114.114.114 (114.114.114.114) 56(84) bytes of data.
64 bytes from 114.114.114.114: icmp_seq=1 ttl=84 time=9.00 ms
64 bytes from 114.114.114.114: icmp_seq=2 ttl=75 time=8.62 ms

---ping通114,ping不通baidu. ping通内网


配置dns:

ubuntu@ubuntu-W760-G20:~$ cat /etc/resolv.conf 
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
DO the NOT EDIT THIS FILE # BY HAND - the CHANGES WILL BE YOUR Overwritten
@-W760 Ubuntu-Ubuntu the G20: ~ $ CAT / etc / Network / in the interfaces 
# in the interfaces (5) File Used by ifup (8) and ifdown (8) 
Auto LO 
iface LO the Loopback inet 
Auto ens2f1 
iface ens2f1 inet static 
address 192.168.205.11 
255.255.255.0 Netmask 
Gateway 192.168.205.254 

Ubuntu @ Ubuntu-w760 the G20-: ~ $ the sudo Nano / etc / Network / the interfaces 
add the following lines: 
DNS-the nameservers 192.168.1.100 

the sudo Nano /etc/resolv.conf 
add the following lines: 
nameserver 192.168 .1.100 

start interface card need to restart to take effect; resolv.conf need to restart the network card can take effect.

  

ubuntu@ubuntu-W760-G20:~$ ping www.baidu.com
PING www.a.shifen.com (220.181.38.150) 56(84) bytes of data.
64 bytes from 220.181.38.150: icmp_seq=1 ttl=48 time=4.76 ms
64 bytes from 220.181.38.150: icmp_seq=2 ttl=48 time=26.5 ms

  

Guess you like

Origin www.cnblogs.com/xhzd/p/12022623.html