两天前升级到了Ubuntu14.04,结果发现firefox打不开百度了,但却能打开其他网站,这让我很是郁闷。于是乎我开始寻找问题。
猜想1:首先想到的是不是我的网络有问题
实验1:pingwww.baidu.com
[email protected]:~$ pingwww.baidu.com
PINGwww.a.shifen.com (220.181.111.188) 56(84) bytes of data.
^C
--- www.a.shifen.comping statistics ---
9 packetstransmitted, 0 received, 100% packet loss, time 8000ms
由于浏览器能够访问bing,于是我又pingwww.bing.com
[email protected]:~$ pingwww.bing.com
PINGcn.a-0001.a-msedge.net (202.89.233.101) 56(84) bytes of data.
^C
---cn.a-0001.a-msedge.net ping statistics ---
8 packetstransmitted, 0 received, 100% packet loss, time 7056ms
结论1:域名解析没有问题
问题2:域名解析没问题,但是ping不通是怎么回事呢?。
实验2:ping一下网关试试。
[email protected]:~$ route-n
Kernel IP routingtable
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 124.16.79.254 0.0.0.0 UG 0 0 0 eth0
124.16.76.0 0.0.0.0 255.255.252.0 U 1 0 0 eth0
[email protected]:~$ ping124.16.79.264
ping: unknown host124.16.79.264
结论2:原来ping不通是因为管理员对网关的设置问题。不用去管它了。
问题3:直接访问百度的IP行不行呢?
实验3:我直接把百度的ip地址写道firefox的地址栏里,没问题,能够打开!但是仍然没法打开二级页面。
问题4:这么奇葩的现象,是不是firefox本身的问题呢?
实验4:啥也别说了,换浏览器!安装chrome
[email protected]:~$ sudoapt-get install google-chrome
显示没有找到安装包,更新源试试。
[email protected]:~$ sudo sh -c'echo "deb http://dl.google.com/linux/chrome/deb/ stable main">> /etc/apt/sources.list.d/google-chrome.list'
[email protected]:~$ sudoapt-get update
安装[email protected]:~$sudo apt-get install google-chrome-stable
OK,安装成功。
迫不及待的代开chrome,输入www.baidu.com,我X居然神奇般的打开了!
结论4:看来果然是firefox本身的问题。
问题5:但是firefox到底哪里出了问题呢?
实验5:
在网上搜“ubuntufirefox无法打开百度”,遇到这类问题的人还不少。有的说要去aoubt:config添加某个字段,我尝试了一下,没有效果。
是不是安装的某个插件出了问题,于是我把所有的插件都禁用了,仍然不行。
怎么办呢,就在我无计可施的时候,我想到了firefox菜单栏上的Help菜单,Help->Restartwith Ads-on disabled,就是这里了!点击之后,出来一个对话框,选项中又一个“ResetFirefox”,重置吧,这样更彻底。点击重置之后,终于可以正常访问百度了。
结论5:最终我并没能够找到firefox哪里出了毛病,但是重置浏览器的方式确实是一个可行又非常简单的解决方式。firefox具体哪里出了问题,还望高人指点。
连上百度的感觉,就像在爆表的雾霾天里苟延残喘了一个月,终于见到了蓝天一样,终于可以自由的呼吸了。
几个常用的网络命令:
netstat -nap查看应用程序的端口使用情况
/etc/init.d/networkingstart | stop | restart启用或者关闭网络
route -n 参看本机网关
网络相关的配置文件:
/etc/network/interfaces网卡配置文件
/etc/resolv.confDSN服务器配置文件
/etc/hosts主机名和IP配置文件
我电脑的软件配置信息:
32位Ubuntu14.04
firefox 28.0 MozillaFirefox for Ubuntu canonical - 1.0
参考文献:
linux下查看网关的命令:http://blog.sina.com.cn/s/blog_674d87000100pzmh.html
Ubuntu安装Chrome步骤:http://www.douban.com/note/252982281/