歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Ubuntu network is unreachable 解決記

Ubuntu network is unreachable 解決記

日期:2017/2/28 15:55:55   编辑:Linux教程

  由於自己的本本經常要在好幾個地方用,所以每到一個地方就得重新配置一下網絡。當配置完ip和DNS後,內網的機器都可以ping通,網關也能ping通,但是ping 外網的就是不行。

Ubuntu 專題 http://www.linuxidc.com/topicnews.aspx?tid=2

  一直提示 network is unreachable

  此問題的解決方法就是:增加一個缺省的網關。

  總結一下,步驟如下:

  1.配置ip,配置 /etc/network/interfaces 文件

  2.然後是DNS,配置 /etc/resolv.conf

  例如:

  配置靜態IP地址

  sudo vim /etc/network/interfaces

  內容如下:

  auto lo

  iface lo inet loopback

  iface eth0 inet static

  address 172.16.15.97

  netmask 255.255.248.0

  gateway 172.16.15.253

  auto eth0

  配置DNS

  vim /etc/resolv.conf

  增加以下內容:

  nameserver 211.95.193.97

  nameserver 211.92.8.161

  3.增加默認網關

  route add default gw 172.16.15.253

  4.重新啟動網絡配置

  sudo /etc/init.d/networking restart

Copyright © Linux教程網 All Rights Reserved