我最近从 Ubuntu 12.04 升级到了 Ubuntu 14.04。重启后,WiFi 已连接,或 LAN 已连接,但无法访问互联网。我使用的是 Toshiba Satellite C855D。
$ sudo lshw -C network
*-network
description: Wireless interface
product: RTL8188CE 802.11b/g/n WiFi Adapter
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:02:00.0
logical name: wlan0
version: 01
serial: c0:d9:62:8d:39:85
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=rtl8192ce driverversion=3.13.0-24-generic firmware=N/A ip=192.168.0.109 latency=0 link=yes multicast=yes wireless=IEEE 802.11bgn
resources: irq:16 ioport:3000(size=256) memory:f0200000-f0203fff
*-network
description: Ethernet interface
product: RTL8101E/RTL8102E PCI Express Fast Ethernet controller
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:06:00.0
logical name: eth0
version: 05
serial: 00:8c:fa:49:e0:4d
size: 10Mbit/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=half firmware=rtl_nic/rtl8105e-1.fw latency=0 link=no multicast=yes port=MII speed=10Mbit/s
resources: irq:41 ioport:2000(size=256) memory:f0104000-f0104fff memory:f0100000-f0103fff
$ ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:8c:fa:49:e0:4d
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
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:727 errors:0 dropped:0 overruns:0 frame:0
TX packets:727 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:56993 (56.9 KB) TX bytes:56993 (56.9 KB)
wlan0 Link encap:Ethernet HWaddr c0:d9:62:8d:39:85
inet addr:192.168.0.109 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::c2d9:62ff:fe8d:3985/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1934 errors:0 dropped:0 overruns:0 frame:0
TX packets:61 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=47 time=47.2 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=47 time=44.8 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=47 time=43.6 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=47 time=156 ms
$ ping google.com
ping: unknown host google.com
$ nslookup google.com 8.8.8.8
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
Name: google.com
Address: 190.167.241.187
Name: google.com
Address: 190.167.241.178
Name: google.com
Address: 190.167.241.163
Name: google.com
Address: 190.167.241.183
Name: google.com
Address: 190.167.241.177
Name: google.com
Address: 190.167.241.172
Name: google.com
Address: 190.167.241.153
Name: google.com
Address: 190.167.241.162
Name: google.com
Address: 190.167.241.167
Name: google.com
Address: 190.167.241.152
Name: google.com
Address: 190.167.241.168
Name: google.com
Address: 190.167.241.182
Name: google.com
Address: 190.167.241.157
Name: google.com
Address: 190.167.241.173
Name: google.com
Address: 190.167.241.148
Name: google.com
Address: 190.167.241.158
$ cat /etc/resolvconf/resolv.conf.d/head
# 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 8.8.8.8
$ sudo service networking restart
stop: Job failed while stopping
start: Job is already running: networking
$ nm-tool
NetworkManager Tool
State: connected (global)
- Device: eth0 -----------------------------------------------------------------
Type: Wired
Driver: r8169
State: unavailable
Default: no
HW Address: 00:8C:FA:49:E0:4D
Capabilities:
Carrier Detect: yes
Speed: 100 Mb/s
Wired Properties
Carrier: off
- Device: wlan0 [Honey Nut Cheerios] ------------------------------------------
Type: 802.11 WiFi
Driver: rtl8192ce
State: connected
Default: yes
HW Address: C0:D9:62:8D:39:85
Capabilities:
Speed: 18 Mb/s
Wireless Properties
WEP Encryption: yes
WPA Encryption: yes
WPA2 Encryption: yes
Wireless Access Points (* = current AP)
*Honey Nut Cheerios: Infra, 00:21:29:EF:11:2D, Freq 2437 MHz, Rate 54 Mb/s, Strength 78 WPA2
Claro8AD: Infra, 00:1A:2B:B0:69:CD, Freq 2462 MHz, Rate 54 Mb/s, Strength 27 WPA2
CLAROB5F570: Infra, 88:25:2C:B5:F5:70, Freq 2412 MHz, Rate 54 Mb/s, Strength 20 WEP
WIND30: Infra, 00:1F:FB:68:E3:6C, Freq 2427 MHz, Rate 54 Mb/s, Strength 37 WPA
dd-wrt_vap: Infra, 02:1C:10:34:41:15, Freq 2437 MHz, Rate 54 Mb/s, Strength 24 WPA
IPv4 Settings:
Address: 192.168.0.109
Prefix: 24 (255.255.255.0)
Gateway: 192.168.0.1
DNS: 8.8.8.8
DNS: 8.8.4.4
答案1
我在从 12.04 升级到 14.04 时遇到了同样的问题。我修复它的方法是完全删除并重新安装 resolv 配置。见下文
sudo apt-get remove --purge resolvconf && sudo apt-get install --reinstall resolvconf
看起来,您的升级没有正确安装 DNS 解析器。
答案2
您的 DNS 服务器未设置或无法正常工作。
DNS 服务器基本上将域名(如 google.com)转换(解析)为 IP 地址。没有 IP 地址,您就无法连接到任何网站。因此,如果无法解析域名,您就无法访问任何网站。
您可以使用 Google 的 DNS 服务器来解决此问题:
- 点击屏幕右上角的 WiFi 图标
- 点击
Edit connections...
- 在 下
Wi-Fi
,选择您的网络名称 - 点击
Edit...
- 点击
IPv4 Settings
- 设置
Additional DNS Servers
为8.8.8.8, 8.8.4.4
(注意点和逗号的区别) - 点击
Save
尝试访问谷歌验证您的连接是否正常。
答案3
这就是问题所在。Ubuntu 现在默认将 127.0.0.1 设置为您的名称服务器,并将其放在您的 resolv.conf 中。
您可以使用 resolvconf 标头功能添加标头以包含您首选的名称服务器,例如 google 的 dns。
将您首选的名称服务器添加到您的头文件中:
/etc/resolvconf/resolv.conf.d/head
nameserver 8.8.8.8
确保在行末放置换行符(按 ENTER)。然后重新启动网络,一切就绪。
这会将您首选的名称服务器置于网络启动时的默认设置的顶部。
您可以通过重新启动计算机来重新启动网络,或者发出此命令行:
sudo service networking restart
答案4
通过在终端 ( + + )/etc/resolv.conf
中运行以下命令重新创建,它应该可以解决 ping 问题:CtrlAltT
sudo dpkg-reconfigure resolvconf
或者
sudo ln -sf /run/resolvconf/resolv.conf /etc/resolv.conf