ubuntu17.04以及16.04中不能ping通域名只能ping通对应IP解决
2017-10-09 17:04
218 查看
今天将ubuntu进行了换源,换成了国内的阿里源,结果出现了ping百度出现不能ping通的问题,后来网上查找资料发现在/etc/resolv.conf中添加上固定ip时写的nameserver即可,结果却没发现resolv.conf文件中有一句话没仔细看,导致每次关机重启后,这个文件的修改内容被抹掉了,后来找到了一个解决办法,在固定ip时写上dns-nameservers 1.2.4.8 8.8.8.8 8.8.4.4等即可:我的/etc/network/interfaces下的原样文件如下:
1 # This file describes the network interfaces available on your system
2 # and how to activate them. For more information, see interfaces(5).
3
4 source /etc/network/interfaces.d/*
5
6 # The loopback network interface
7 auto lo
8 iface lo inet loopback
9
10 # The primary network interface
11 auto ens32
12 iface ens32 inet static
13 address 1.1.1.6
14 netmask 255.255.255.0
15 gateway 1.1.1.2
16 dns-nameservers 1.2.4.8 8.8.8.8 8.8.4.4
配置好了之后执行两个重启服务即可:
sudo /etc/init.d/resolvconf restart
sudo /etc/init.d/networking restart
再次关机后重启也不会出现以前的问题了,并且nameserver也配置到了resolv.conf文件中去了。
1 # This file describes the network interfaces available on your system
2 # and how to activate them. For more information, see interfaces(5).
3
4 source /etc/network/interfaces.d/*
5
6 # The loopback network interface
7 auto lo
8 iface lo inet loopback
9
10 # The primary network interface
11 auto ens32
12 iface ens32 inet static
13 address 1.1.1.6
14 netmask 255.255.255.0
15 gateway 1.1.1.2
16 dns-nameservers 1.2.4.8 8.8.8.8 8.8.4.4
配置好了之后执行两个重启服务即可:
sudo /etc/init.d/resolvconf restart
sudo /etc/init.d/networking restart
再次关机后重启也不会出现以前的问题了,并且nameserver也配置到了resolv.conf文件中去了。
相关文章推荐
- 域名与IP对应,解决只能IP访问不能域名访问的问题
- linux使用ip能ping通,但使用域名却不能访问的解决方法
- Ubuntu16.04 简单解决多版本python切换以及多版本pip对应问题
- Ubuntu16.04安装搜狗输入法,以及解决不能输入中文的办法
- centos能ping通外网ip不能解析域名的终极解决办法
- 关于只能IP访问,域名不能访问网站的解决
- Linux Ubuntu 能PING IP但不能PING主机域名的解决方法
- Linux Ubuntu 能PING IP但不能PING主机域名的解决方法
- Ubuntu16.04 on ThinkPad E455 不能识别耳机 的解决方法
- Ubuntu 设置固定ip,NetWork-Manager不能保存固定ip解决办法
- Ubuntu中文更改为英文方法解决以及相应IP 设置
- linux下能ping ip不能ping域名详解
- linux不能ping通域名能ping通ip
- linux不能ping通域名能ping通ip
- Ubuntu 16.04修改MAC地址以及网络常用设置(IP/DNS/网关)
- Ubuntu下不能解析域名( ping:unknown host )
- Ubuntu(17.04)使用过程中遇到的问题以及解决方法
- 开发板可以ping通百度IP,但是不能ping百度域名 提示ping: bad address 'www.baidu.com'
- Linux入门(12)——解决双系统下Ubuntu16.04不能访问Windows分区
- ubuntu 16.04系统完美解决pip不能升级的问题