今天重装了Ubuntu 14.04,使用的是之前刻录的系统,安装完成后无法上网。
现象:
1. 能ping通网关
2. 无法上网
3. 能ping通外网ip地址,使用ip可以访问外网
解决步骤:
1. 执行route,发现默认默认路由是旧的网关,执行route del default ,重启后恢复为现在的网关
2. 执行nslookup www.baidu.com, 提示未找到dns服务器
3. 百度一圈,提示配置/etc/resolv.conf ,但是在本机未找到该文件
还有的提示配置/etc/resolvconf/resolv.conf.d/base或/etc/resolvconf/resolv.conf.d/head
4. 在/etc/resolvconf/resolv.conf.d/head添加了 naseserver 114.114.114.114
执行resolvconf -u, 提示/etc/resolv.conf 未连接/run/resolvconf/resolv.conf
5. 参考其他服务器, ls -la /etc/resolv.conf 发现/etc/resolv.conf是个软连接
lrwxrwxrwx 1 root root 27 3月 31 11:25 /etc/resolv.conf -> /run/resolvconf/resolv.conf
6. 创建软连接 ln -s /run/resolvconf/resolv.conf /etc/resolv.conf ,重启可以访问外网了
PS:比较奇怪的是撤销第4步后又不能访问外网,但是其他服务器不用配置就可以。
网友评论