新装ubuntu14.04手动配置IP,无法上网,ping网关返回destination host unreachabl

包含网卡/无线网的网络问题和ADSL/校园网/宽带拨号支持及代理/共享等网络使用问题
arctan42
帖子: 9
注册时间: 2015-05-23 21:00
系统: ubuntu 14.04

新装ubuntu14.04手动配置IP,无法上网,ping网关返回destination host unreachabl

#1

帖子 arctan42 » 2015-05-23 21:24

Hi,大家好,
我的win7+ubuntu14.04双系统,手动配置IP、掩码、网关、DNS,同样的配置在win7下可以上网,但在ubuntu下无法上网。ping网关返回destination host unreachable。其实前天不知怎么折腾的可以上网了,但后来因为添加Synergy开机启动,导致系统无限重复登录界面,不得已重装系统。现在又无法上网,ubuntu新人,这两天花了大量时间查资料也无法搞定,求各位大神帮忙。
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 新装ubuntu14.04手动配置IP,无法上网,ping网关返回destination host unreac

#2

帖子 poloshiao » 2015-05-24 8:28

把下面指令 複製 貼進終端機 執行
0. uname -r
1. sudo lspci -knn
2. sudo lshw -numeric -class network
3. sudo ifconfig -a
4. sudo route -nv
5. sudo dhclient -v
6. sudo cat /etc/network/interfaces
7. sudo ls -al /etc/resolv.conf
8. sudo cat /run/resolvconf/resolv.conf
把結果直接 選取/複製/貼上
http://paste.ubuntu.com
再把回應網址貼上來
不必擷圖
arctan42
帖子: 9
注册时间: 2015-05-23 21:00
系统: ubuntu 14.04

Re: 新装ubuntu14.04手动配置IP,无法上网,ping网关返回destination host unreac

#3

帖子 arctan42 » 2015-05-24 11:16

[0]. uname -r

3.16.0-30-generic

[1]. sudo lspci -knn



[2]. sudo lshw -numeric -class network
*-network
description: Ethernet interface
product: Ethernet Connection I217-LM [8086:153A]
vendor: Intel Corporation [8086]
physical id: 19
bus info: pci@0000:00:19.0
logical name: eth0
version: 05
serial: 98:90:96:d9:c3:21
size: 100Mbit/s
capacity: 1Gbit/s
width: 32 bits
clock: 33MHz
capabilities: pm msi bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=2.3.2-k duplex=full firmware=0.13-4 ip=192.168.5.66 latency=0 link=yes multicast=yes port=twisted pair speed=100Mbit/s
resources: irq:93 memory:d7100000-d711ffff memory:d7139000-d7139fff ioport:7020(size=32)


[3]. sudo ifconfig -a

eth0 Link encap:以太网 硬件地址 98:90:96:d9:c3:21
inet 地址:192.168.5.66 广播:192.168.5.255 掩码:255.255.255.0
inet6 地址: fe80::9a90:96ff:fed9:c321/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 跃点数:1
接收数据包:8442 错误:0 丢弃:0 过载:0 帧数:0
发送数据包:761 错误:0 丢弃:0 过载:0 载波:0
碰撞:0 发送队列长度:1000
接收字节:1334744 (1.3 MB) 发送字节:62562 (62.5 KB)
中断:20 Memory:d7100000-d7120000

lo Link encap:本地环回
inet 地址:127.0.0.1 掩码:255.0.0.0
inet6 地址: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 跃点数:1
接收数据包:1269 错误:0 丢弃:0 过载:0 帧数:0
发送数据包:1269 错误:0 丢弃:0 过载:0 载波:0
碰撞:0 发送队列长度:0
接收字节:102957 (102.9 KB) 发送字节:102957 (102.9 KB)

[4]. sudo route -nv

内核 IP 路由表
目标 网关 子网掩码 标志 跃点 引用 使用 接口
0.0.0.0 192.168.5.1 0.0.0.0 UG 0 0 0 eth0
192.168.5.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0

[5]. sudo dhclient -v

Internet Systems Consortium DHCP Client 4.2.4
Copyright 2004-2012 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/98:90:96:d9:c3:21
Sending on LPF/eth0/98:90:96:d9:c3:21
Sending on Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 3 (xid=0x219b76e4)
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 6 (xid=0x219b76e4)
No DHCPOFFERS received.
No working leases in persistent database - sleeping.

[6]. sudo cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

[7]. sudo ls -al /etc/resolv.conf
lrwxrwxrwx 1 root root 29 5月 23 21:11 /etc/resolv.conf -> ../run/resolvconf/resolv.conf

[8]. sudo cat /run/resolvconf/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 127.0.1.1

关于interfaces和resolv.conf,我试过手动添加IP 掩码 网关 和 DNS,但修改之后遇到了无法识别的问题(具体错误提示记不清了),所以又修改回原来的样子。
上次由 arctan42 在 2015-05-24 16:20,总共编辑 1 次。
arctan42
帖子: 9
注册时间: 2015-05-23 21:00
系统: ubuntu 14.04

Re: 新装ubuntu14.04手动配置IP,无法上网,ping网关返回destination host unreac

#4

帖子 arctan42 » 2015-05-24 11:19

回应网址是指这个吗?
http://paste.ubuntu.com/11319184/
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 新装ubuntu14.04手动配置IP,无法上网,ping网关返回destination host unreac

#5

帖子 poloshiao » 2015-05-24 12:36

回应网址是指这个吗?
http://paste.ubuntu.com/11319184/
下次 #3 的內容不必貼上來
只要貼上
http://paste.ubuntu.com/11319184/
即可
這樣 可以節省本論壇空間 並且提高可讀性
sudo cat /run/resolvconf/resolv.conf
...
nameserver 127.0.1.1
在 /run/resolvconf/resolv.conf 最後 加上兩行
nameserver 8.8.8.8
nameserver 8.8.4.4

然後
把下面指令 複製 貼進終端機 執行
ping -c 3 forum.ubuntu.org.cn
把結果複製 貼上來

補充
上述只是一次性暫時解決方案
重開機 就恢復原來的情況
有效 請再貼文
arctan42
帖子: 9
注册时间: 2015-05-23 21:00
系统: ubuntu 14.04

Re: 新装ubuntu14.04手动配置IP,无法上网,ping网关返回destination host unreac

#6

帖子 arctan42 » 2015-05-24 13:27

谢谢!
ping -c 3 forum.ubuntu.org.cn
返回的是:
ping: unknown host forum.ubuntu.org.cn
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 新装ubuntu14.04手动配置IP,无法上网,ping网关返回destination host unreac

#7

帖子 poloshiao » 2015-05-24 17:05

ping: unknown host forum.ubuntu.org.cn
1. 把下面指令 複製 貼進終端機 執行
1-1. ping -c 3 127.0.0.1
1-2. ping -c 3 192.168.5.66
1-3. ping -c 3 192.168.5.1
1-4. ping -c 3 198.71.86.201
把結果直接 選取/複製/貼上來
看看 從哪裡開始 實體網路不通
ubuntu14.04手动配置IP
[5]. sudo dhclient -v
No DHCPOFFERS received.
No working leases in persistent database - sleeping.
2. 你的電腦 到 DHCP Server 之間 連線可能有問題
2-1. 檢查 實體線路 是否有正常
2-2. 檢查 手動設定 是否正確
arctan42
帖子: 9
注册时间: 2015-05-23 21:00
系统: ubuntu 14.04

Re: 新装ubuntu14.04手动配置IP,无法上网,ping网关返回destination host unreac

#8

帖子 arctan42 » 2015-05-24 17:51

1. ping -c 3 127.0.0.1
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.017 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.012 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.021 ms

--- 127.0.0.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 0.012/0.016/0.021/0.006 ms

2. ping -c 3 192.168.5.66
PING 192.168.5.66 (192.168.5.66) 56(84) bytes of data.
64 bytes from 192.168.5.66: icmp_seq=1 ttl=64 time=0.021 ms
64 bytes from 192.168.5.66: icmp_seq=2 ttl=64 time=0.012 ms
64 bytes from 192.168.5.66: icmp_seq=3 ttl=64 time=0.019 ms

--- 192.168.5.66 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 0.012/0.017/0.021/0.005 ms

3. ping -c 3 192.168.5.1
PING 192.168.5.1 (192.168.5.1) 56(84) bytes of data.
From 192.168.5.66 icmp_seq=1 Destination Host Unreachable
From 192.168.5.66 icmp_seq=2 Destination Host Unreachable
From 192.168.5.66 icmp_seq=3 Destination Host Unreachable

--- 192.168.5.1 ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2016ms
pipe 3

4.ping -c 3 198.71.86.201
PING 198.71.86.201 (198.71.86.201) 56(84) bytes of data.
From 192.168.5.66 icmp_seq=1 Destination Host Unreachable
From 192.168.5.66 icmp_seq=2 Destination Host Unreachable
From 192.168.5.66 icmp_seq=3 Destination Host Unreachable

--- 198.71.86.201 ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2016ms
pipe 3

我切换到windows 7,同样的配置,可以上网。所以可能不是线路和设定的问题。
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 新装ubuntu14.04手动配置IP,无法上网,ping网关返回destination host unreac

#9

帖子 poloshiao » 2015-05-24 18:53

3. ping -c 3 192.168.5.1
From 192.168.5.66 icmp_seq=1 Destination Host Unreachable
...
[4]. sudo route -nv
0.0.0.0 192.168.5.1 0.0.0.0 UG 0 0 0 eth0
1. 表示 你的電腦 到 192.168.5.1 不通
我切换到windows 7,同样的配置,可以上网。所以可能不是线路和设定的问题。
2. 檢查 你的 DHCP 設定

3. 如果設定沒問題
3-1. 重新安裝 驅動 e1000e
使用 關鍵字
bug e1000e I217-LM
上網搜尋
有許多文章
你試試看
3-2. 重新安裝 network-manager network-manager-gnome
sudo apt-get install --reinstall network-manager network-manager-gnome
sudo reboot
arctan42
帖子: 9
注册时间: 2015-05-23 21:00
系统: ubuntu 14.04

Re: 新装ubuntu14.04手动配置IP,无法上网,ping网关返回destination host unreac

#10

帖子 arctan42 » 2015-05-25 20:15

目前可以上网了,但是我什么都没有做。昨天看到您的回复,有别的事要忙,还没来得及检查DHCP设定和重装驱动。

今天重启机器之后,发现可以上网了。不知道是为什么。试着ping了一下:

1. ping -c 3 192.168.5.1
PING 192.168.5.1 (192.168.5.1) 56(84) bytes of data.
64 bytes from 192.168.5.1: icmp_seq=1 ttl=255 time=1.68 ms
64 bytes from 192.168.5.1: icmp_seq=2 ttl=255 time=1.66 ms
64 bytes from 192.168.5.1: icmp_seq=3 ttl=255 time=1.70 ms

--- 192.168.5.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 1.665/1.684/1.705/0.037 ms


2. ping -c 3 198.71.86.201
PING 198.71.86.201 (198.71.86.201) 56(84) bytes of data.

--- 198.71.86.201 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2014ms
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 新装ubuntu14.04手动配置IP,无法上网,ping网关返回destination host unreac

#11

帖子 poloshiao » 2015-05-25 20:23

2. ping -c 3 198.71.86.201
PING 198.71.86.201 (198.71.86.201) 56(84) bytes of data.
--- 198.71.86.201 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2014ms
1. 我實作結果 沒問題
ping -c 3 192.157.249.221
PING 192.157.249.221 (192.157.249.221) 56(84) bytes of data.
64 bytes from 192.157.249.221: icmp_seq=1 ttl=44 time=216 ms
64 bytes from 192.157.249.221: icmp_seq=2 ttl=44 time=229 ms
64 bytes from 192.157.249.221: icmp_seq=3 ttl=44 time=222 ms
--- 192.157.249.221 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 216.076/222.923/229.789/5.598 ms

2. 你等網路情況好一點 再試試
arctan42
帖子: 9
注册时间: 2015-05-23 21:00
系统: ubuntu 14.04

Re: 新装ubuntu14.04手动配置IP,无法上网,ping网关返回destination host unreac

#12

帖子 arctan42 » 2015-05-26 10:04

从昨天到今天一直可以正常上网,但ping以下两个地址一直ping不通,不知道原因是什么?是否没有关系?

1. ping -c 3 198.71.86.201
PING 198.71.86.201 (198.71.86.201) 56(84) bytes of data.

--- 198.71.86.201 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2014ms

2. ping -c 3 192.157.249.221
PING 192.157.249.221 (192.157.249.221) 56(84) bytes of data.

--- 192.157.249.221 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 1999ms
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 新装ubuntu14.04手动配置IP,无法上网,ping网关返回destination host unreac

#13

帖子 poloshiao » 2015-05-26 11:08

但ping以下两个地址一直ping不通
1. ping -c 3 198.71.86.201
2. ping -c 3 192.157.249.221
試了一下

1. ping -c 3 198.71.86.201
PING 198.71.86.201 (198.71.86.201) 56(84) bytes of data.
64 bytes from 198.71.86.201: icmp_seq=1 ttl=51 time=160 ms
64 bytes from 198.71.86.201: icmp_seq=2 ttl=51 time=162 ms
64 bytes from 198.71.86.201: icmp_seq=3 ttl=51 time=157 ms
--- 198.71.86.201 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 157.844/160.347/162.328/1.924 ms

2. ping -c 3 192.157.249.221
PING 192.157.249.221 (192.157.249.221) 56(84) bytes of data.
64 bytes from 192.157.249.221: icmp_seq=1 ttl=44 time=217 ms
64 bytes from 192.157.249.221: icmp_seq=2 ttl=44 time=216 ms
64 bytes from 192.157.249.221: icmp_seq=3 ttl=44 time=216 ms
--- 192.157.249.221 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 216.234/216.692/217.496/0.783 ms

3. 都沒問題

4. 試試
4-1. tracepath 198.71.86.201
4-2. tracepath 192.157.249.221
看看 停在哪裡

5. 上面指令 回應的每一個 xxx.xxx.xxx.xxx 可以稱為 1 個 hop (跳一次)
預設 最多 30 hops 超過 30 還沒到達目的網址 就不再往前了
5-1. -m 50 可以延長到 最多 50 hops 這個數目 你可以隨時修正
5-2. 試試
5-2-1. tracepath -m 50 198.71.86.201
5-2-2. tracepath -m 50 192.157.249.221
5-3. 追根究底 看看 到底停在哪裡
arctan42
帖子: 9
注册时间: 2015-05-23 21:00
系统: ubuntu 14.04

Re: 新装ubuntu14.04手动配置IP,无法上网,ping网关返回destination host unreac

#14

帖子 arctan42 » 2015-05-26 14:40

1. tracepath 198.71.86.201
1?: [LOCALHOST] pmtu 1500
1: no reply
2: 192.168.1.2 1.884ms
3: no reply
4: 219.239.83.157 6.280ms
5: 10.255.112.65 4.959ms
6: 218.241.166.45 3.238ms
7: 218.241.165.129 3.364ms
8: 202.99.1.145 3.341ms
9: 202.99.1.153 4.731ms
10: 221.239.18.33 8.893ms asymm 12
11: 219.150.51.181 6.907ms asymm 12
12: 219.150.52.113 11.642ms
13: 202.97.79.221 8.610ms asymm 14
14: 202.97.53.42 12.779ms
15: 202.97.58.110 16.120ms
16: 202.97.58.126 161.362ms
17: 202.97.49.154 172.016ms
18: 10ge3-17.core1.lax1.he.net 287.175ms asymm 19
19: 100ge11-1.core1.lax2.he.net 291.999ms asymm 18
20: 64.71.153.34 263.673ms asymm 19
21: dist01.dc03.lax.ip4.scalabledns.com 281.958ms asymm 20
22: 36.93-71-198.rdns.scalabledns.com 270.312ms asymm 21
23: 198.71.86.201 260.792ms reached
Resume: pmtu 1500 hops 23 back 21

2. tracepath 192.157.249.221
1?: [LOCALHOST] pmtu 1500
1: no reply
2: 192.168.1.2 1.305ms
3: no reply
4: 219.239.83.157 6.379ms
5: 10.255.112.65 4.058ms
6: 218.241.166.45 3.085ms
7: 218.241.165.129 3.136ms
8: 202.99.1.145 3.455ms
9: 202.99.1.117 3.497ms
10: 221.239.18.125 8.382ms asymm 12
11: 219.150.51.181 6.631ms asymm 12
12: 221.238.222.209 8.268ms
13: 202.97.79.241 10.217ms
14: 202.97.53.82 10.397ms
15: 202.97.53.234 15.597ms
16: 202.97.52.254 163.858ms
17: 202.97.50.54 152.077ms
18: xe-1-3-3.mpr1.lax12.us.zip.zayo.com 163.924ms asymm 22
19: be2000.ccr21.sjc01.atlas.cogentco.com 216.548ms asymm 26
20: ae4.mpr3.las1.us.zip.zayo.com 189.428ms asymm 22
21: be2132.ccr21.mci01.atlas.cogentco.com 225.757ms asymm 24
22: be2156.ccr41.ord01.atlas.cogentco.com 247.207ms asymm 25
23: be2005.ccr21.ord03.atlas.cogentco.com 245.415ms asymm 26
24: be2617.rcr12.b002281-5.ord03.atlas.cogentco.com 241.770ms asymm 27
25: enzu.com-gw.chi.ip4.cpe.cogentco.com 245.098ms asymm 28
26: border01-core.dc02.chi.ip4.scalabledns.com 225.864ms
27: 199.231.209.9 242.645ms
28: 192.157.249.221 220.463ms reached
Resume: pmtu 1500 hops 28 back 27

两个都reached。但是ping依然不通。
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 新装ubuntu14.04手动配置IP,无法上网,ping网关返回destination host unreac

#15

帖子 poloshiao » 2015-05-26 16:48

两个都reached。但是ping依然不通。
這個可能原因很多
例如
ping
http://zh.wikipedia.org/wiki/Ping
程式會按時間和成功響應的次數估算遺失封包率(丟包率)和 封包往返時間(網路時延,Round-trip delay time)。
回复