首页 > 系统服务 > 详细

ubuntu 18.04可以连接内网,无法连接外网

时间:2019-03-18 17:44:02      阅读:849      评论:0      收藏:0      [点我收藏+]

可以ping通内网,同时可以ping通8.8.8.8,114.114.114.114, 但是ping外网失败,以下是手动增加网关的一个解决方法,如果还不行就需要查看其它方法了。

10.219.91.1要填你的网关

1. 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

 

2. route或netstat -rn,获取网关10.219.91.1

$ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 10.219.91.1 0.0.0.0 UG 0 0 0 ens33
10.219.91.0 * 255.255.255.0 U 0 0 0 ens33
link-local * 255.255.0.0 U 1000 0 0 ens33

 

3. 修改/etc/resolvconf/resolv.conf.d/head, 增加如下3行

nameserver 10.219.91.1
nameserver 114.114.114.114
nameserver 8.8.8.8

 

4. 执行/etc/init.d/networking restart

5. 查看/etc/resolv.conf 

$ 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
nameserver 10.219.91.1
nameserver 114.114.114.114
nameserver 8.8.8.8

 

6. ping Bing,显示成功

$ ping cn.bing.com
PING cn-0001.cn-msedge.net (202.89.233.100) 56(84) bytes of data.
64 bytes from 202.89.233.100: icmp_seq=1 ttl=115 time=40.9 ms
64 bytes from 202.89.233.100: icmp_seq=2 ttl=115 time=40.6 ms
64 bytes from 202.89.233.100: icmp_seq=3 ttl=115 time=51.4 ms
64 bytes from 202.89.233.100: icmp_seq=4 ttl=115 time=49.2 ms

 

ubuntu 18.04可以连接内网,无法连接外网

原文:https://www.cnblogs.com/sciapex/p/10553532.html

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