首页 > 系统服务 > 详细

ubuntu 上不了网:配置DNS域名解析服务

时间:2019-12-11 15:59:22      阅读:110      评论:0      收藏:0      [点我收藏+]
 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 NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
ubuntu@ubuntu-W760-G20:~$ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto ens2f1
iface ens2f1 inet static
address 192.168.205.11
netmask 255.255.255.0
gateway 192.168.205.254

ubuntu@ubuntu-W760-G20:~$ sudo nano  /etc/network/interfaces
增加如下行:
dns-nameservers 192.168.1.100

sudo nano  /etc/resolv.conf
增加如下行:
nameserver 192.168.1.100

启动interface 需要重启网卡生效; resolv.conf 不需要重启网卡就能够生效。

  

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

  

ubuntu 上不了网:配置DNS域名解析服务

原文:https://www.cnblogs.com/xhzd/p/12022623.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!