当我将以太网连接到我的台式机 (13.10) 时,它似乎建立了连接,但我无法访问任何网页。如果我将以太网连接到我的笔记本电脑 (12.04.4),它就可以正常工作。我以前在台式机上连接过以太网,但我最近搬家了,我正试图让它适应我的新居住安排。
桌面版(13.10)
$ uname -a
Linux jeffrey-desktop 3.11.0-20-generic #35-Ubuntu SMP Fri May 2 21:32:49 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
$ ifconfig
eth0 Link encap:Ethernet HWaddr c8:60:00:de:4f:bb
inet addr:10.212.9.183 Bcast:10.212.255.255 Mask:255.255.0.0
inet6 addr: fe80::ca60:ff:fede:4fbb/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7883 errors:0 dropped:0 overruns:0 frame:0
TX packets:2406 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:841589 (841.5 KB) TX bytes:240759 (240.7 KB)
Interrupt:20 Memory:f7f00000-f7f20000
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.212.0.1 0.0.0.0 UG 0 0 0 eth0
10.212.0.0 0.0.0.0 255.255.0.0 U 1 0 0 eth0
$ sudo lshw -class network
*-network
description: Ethernet interface
product: 82579V Gigabit Network Connection
vendor: Intel Corporation
physical id: 19
bus info: pci@0000:00:19.0
logical name: eth0
version: 04
serial: c8:60:00:de:4f:bb
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=10.212.9.183 latency=0 link=yes multicast=yes port=twisted pair speed=100Mbit/s
resources: irq:52 memory:f7f00000-f7f1ffff memory:f7f39000-f7f39fff ioport:f040(size=32)
笔记本电脑 (12.04.4)
$ uname -a
Linux jeffrey-Inspiron-3520 3.2.0-61-generic #93-Ubuntu SMP Fri May 2 21:31:50 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
$ ifconfig
eth0 Link encap:Ethernet HWaddr e0:db:55:84:bc:f0
inet addr:10.212.12.5 Bcast:10.212.255.255 Mask:255.255.0.0
inet6 addr: fe80::e2db:55ff:fe84:bcf0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7035 errors:0 dropped:0 overruns:0 frame:0
TX packets:2820 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4817604 (4.8 MB) TX bytes:444154 (444.1 KB)
Interrupt:41 Base address:0x4000
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.212.0.1 0.0.0.0 UG 0 0 0 eth0
10.212.0.0 0.0.0.0 255.255.0.0 U 1 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth0
$ sudo lshw -class network
*-network
description: Ethernet interface
product: RTL8101E/RTL8102E PCI Express Fast Ethernet controller
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:09:00.0
logical name: eth0
version: 05
serial: e0:db:55:84:bc:f0
size: 100Mbit/s
capacity: 100Mbit/s
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=full firmware=rtl_nic/rtl8105e-1.fw ip=10.212.12.5 latency=0 link=yes multicast=yes port=MII speed=100Mbit/s
resources: irq:41 ioport:e000(size=256) memory:f0004000-f0004fff memory:f0000000-f0003fff
答案1
显然,新网络阻止了我的桌面尝试使用的 DNS 服务器。
/编辑
每当我尝试ping google.com
在桌面上操作时,我都会注意到它挂起了,而不是抱怨未知主机。这意味着问题出在 DNS 查找期间。
我开始尝试dig
寻找问题所在。dig google.com
正如预期的那样挂了。dig @8.8.8.8 google.com
也挂了,这很奇怪,因为 Google 的 DNS 通常响应非常灵敏。我决定看看我正在使用的 DNS 服务器与 DHCP 告诉我使用的 DNS 服务器。
$ nm-tool
Device: eth0 [Ethernet connection 1] ----------------------------------------
Type: Wired
Driver: e1000e
State: connected
Default: yes
HW Address: C8:60:00:DE:4F:BB
Capabilities:
Carrier Detect: yes
Speed: 100 Mb/s
Wired Properties
Carrier: on
IPv4 Settings:
Address: 10.212.9.183
Prefix: 16 (255.255.0.0)
Gateway: 10.212.0.1
DNS: 208.67.220.220
DNS: 208.67.222.222
此输出显示 DHCP 告诉我使用的 DNS 服务器是208.67.220.220
和208.67.222.222
。但是,这些不是我的桌面配置使用的 DNS 服务器:
$ cat /etc/resolv.conf
nameserver 209.222.18.222
nameserver 209.222.18.218
我用巴基斯坦航空管理局的Linux 测试版并且它改变了我的 resolv.conf 来防止DNS 泄漏这通常不是问题。但是,由于 PIA 的 DNS 服务器在这个新网络上被阻止,我无法连接到 VPN,因为 PPTP 所需的端口在这个网络上被阻止,最终导致所有 DNS 查找失败。
我将其恢复/etc/resolv.conf
到其resolvconf
管理形式并重新启动以太网网络以解决问题。
$ sudo ln -sft /etc /run/resolvconf/resolv.conf