Ubuntu 14.04.01 LTS 上无法使用互联网

Ubuntu 14.04.01 LTS 上无法使用互联网

我无法从 Ubuntu(版本 14.04.01 LTS)连接到互联网。我尝试过相关论坛帖子中的解决方案,但到目前为止都没有奏效。任何帮助解决此问题的帮助都将不胜感激。

我可以打开 Firefox 并从那里使用互联网,但 ping 输出的一个示例是:

ping:未知主机 www.google.com

ifconfig 的输出是:

eth0      Link encap:Ethernet  HWaddr 00:25:90:58:f7:74  
          inet addr:172.21.3.42  Bcast:172.21.255.255  Mask:255.255.0.0
          inet6 addr: fe80::225:90ff:fe58:f774/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:78128 errors:0 dropped:35 overruns:0 frame:0
          TX packets:16658 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:9206366 (9.2 MB)  TX bytes:2853288 (2.8 MB)
          Memory:f0000000-f0020000

eth1      Link encap:Ethernet  HWaddr 00:25:90:58:f7:75  
          inet addr:172.21.10.67  Bcast:172.21.255.255  Mask:255.255.0.0
          inet6 addr: fe80::225:90ff:fe58:f775/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:61518 errors:0 dropped:30 overruns:0 frame:0
          TX packets:1359 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:7464478 (7.4 MB)  TX bytes:146052 (146.0 KB)
          Memory:f0040000-f0060000

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:84984 errors:0 dropped:0 overruns:0 frame:0
          TX packets:84984 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:9607658 (9.6 MB)  TX bytes:9607658 (9.6 MB)

netstat -r -n 的输出是:

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         172.21.0.1      0.0.0.0         UG        0 0          0 eth1
172.21.0.0      0.0.0.0         255.255.0.0     U         0 0          0 eth0
172.21.0.0      0.0.0.0         255.255.0.0     U         0 0          0 eth1

接口文件包含以下几行:

/etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
#auto lo eth0
#iface lo inet loopback
auto lo
iface lo inet loopback
iface eth0 inet static
address 172.21.3.42
netmask 255.255.0.0
gateway 172.21.0.1
#       dns-search www.google.com
dns-nameservers 172.21.3.1

nm-tool 的输出是:

nm-tool

NetworkManager Tool

State: connected (global)

- Device: eth1  [E2] -----------------------------------------------------------
  Type:              Wired
  Driver:            igb
  State:             connected
  Default:           yes
  HW Address:        00:25:90:58:F7:75

  Capabilities:
    Carrier Detect:  yes
    Speed:           1000 Mb/s

  Wired Properties
    Carrier:         on

  IPv4 Settings:
    Address:         172.21.10.67
    Prefix:          16 (255.255.0.0)
    Gateway:         172.21.0.1

    DNS:             172.21.3.103
    DNS:             172.21.3.1


- Device: eth0 -----------------------------------------------------------------
  Type:              Wired
  Driver:            igb
  State:             unmanaged
  Default:           no
  HW Address:        00:25:90:58:F7:74

  Capabilities:
    Carrier Detect:  yes
    Speed:           1000 Mb/s

  Wired Properties
    Carrier:         on

答案1

使用

路线-n

并且nm-tool

我可以看到 eth1 已设置为默认值,并指向网关地址。我们的设置要求 eth0 为默认值。使用以下命令解决了此问题:

sudo ip route change to default dev eth0 via 172.21.0.1

其中 172.21.0.1 是网关地址。

相关内容