
我對 Ubuntu 上的網路非常陌生,所以我已經在這個問題上掙扎了幾個小時了。我正在運行全新安裝的 Ubuntu 12.10,但在使用無線連接時無法解析 DNS。我透過谷歌搜尋找到了許多解決方案,但仍然無法使其工作。我嘗試添加 Google 名稱伺服器,/etc/resolv.conf
但這沒有幫助。我還嘗試透過網路管理器新增靜態名稱伺服器,但也沒有成功。當我ifcongig -a
在命令行中輸入時,我得到以下資訊。
eth0 Link encap:Ethernet HWaddr 00:26:2d:7f:ea:7c
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)
Interrupt:16
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:16436 Metric:1
RX packets:247 errors:0 dropped:0 overruns:0 frame:0
TX packets:247 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:22898 (22.8 KB) TX bytes:22898 (22.8 KB)
wlan0 Link encap:Ethernet HWaddr 70:1a:04:e9:3a:4b
inet addr:10.0.0.28 Bcast:10.0.0.255 Mask:255.255.255.0
inet6 addr: fe80::721a:4ff:fee9:3a4b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:121 errors:0 dropped:0 overruns:0 frame:0
TX packets:403 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:41374 (41.3 KB) TX bytes:38438 (38.4 KB)
我的/etc/resolv.conf
目前看起來像這樣:
nameserver 8.8.8.8
nameserver 8.8.4.4
這樣做dig google.com
我得到:
; <<>> DiG 9.8.1-P1 <<>> google.com
;; global options: +cmd
;; connection timed out; no servers could be reached
在 上ping -c 10 8.8.8.8
,我得到:
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From 10.0.0.28 icmp_seq=1 Destination Host Unreachable
From 10.0.0.28 icmp_seq=2 Destination Host Unreachable
From 10.0.0.28 icmp_seq=3 Destination Host Unreachable
From 10.0.0.28 icmp_seq=5 Destination Host Unreachable
From 10.0.0.28 icmp_seq=6 Destination Host Unreachable
From 10.0.0.28 icmp_seq=7 Destination Host Unreachable
From 10.0.0.28 icmp_seq=8 Destination Host Unreachable
From 10.0.0.28 icmp_seq=10 Destination Host Unreachable
--- 8.8.8.8 ping statistics ---
10 packets transmitted, 0 received, +8 errors, 100% packet loss, time 8999ms
pipe 4
這是我的輸出sudo route -n
:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.0.0.1 0.0.0.0 UG 0 0 0 wlan0
10.0.0.0 0.0.0.0 255.255.255.0 U 9 0 0 wlan0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 wlan0
我的輸出traceroute -n 8.8.8.8
:
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
1 10.0.0.28 1804.234 ms !H 1804.210 ms !H 1804.199 ms !H
我還想指出的是,我能夠連接到其他裝置上以及同一台電腦上安裝的 Windows 上的無線網路。當我透過乙太網路連接時,我也可以上網。
ipconfig
當我在 Windows 機器上執行此操作時,我得到了以下無線連接片段:
Wireless LAN adapter Wireless Network Connection:
Connection-specific DNS Suffix . : hsd1.ma.comcast.net.
Description . . . . . . . . . . . : Atheros AR5B93 Wireless Network Adapter
Physical Address. . . . . . . . . : 70-1A-04-E9-3A-4B
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::b153:23b2:2384:d341%12(Preferred)
IPv4 Address. . . . . . . . . . . : 10.0.0.28(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Lease Obtained. . . . . . . . . . : Thursday, May 09, 2013 1:50:10 PM
Lease Expires . . . . . . . . . . : Thursday, May 16, 2013 3:39:12 PM
Default Gateway . . . . . . . . . : 10.0.0.1
DHCP Server . . . . . . . . . . . : 10.0.0.1
DHCPv6 IAID . . . . . . . . . . . : 225450500
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-17-D9-81-3A-00-26-2D-7F-EA-7C
DNS Servers . . . . . . . . . . . : 75.75.75.75
75.75.76.76
NetBIOS over Tcpip. . . . . . . . : Enabled
任何幫助將不勝感激,因為這確實令人沮喪。
答案1
您的 /etc/resolv.conf 顯示正確。這似乎是網路問題,而不是 DNS 問題。
嘗試關閉您的 eth0(某些 GUI 網路管理員更喜歡有線連接而不是無線連接,並且它可能會因為某些奇怪的原因認為您有訊號)。刪除它的命令是“sudo ifdown eth0”,然後嘗試挖掘 google.com。或者,如果 Ubuntu 取消了 ifdown 腳本(我不知道他們是否取消了),你可以執行「sudo ifconfig eth0 down」。
如果您想將其恢復,只需執行“sudo ifup eth0”或“sudo ifconfig eth0 up”即可。
答案2
您是否嘗試過讓 ubuntu 自動為您管理 DNS?
簡而言之:使用“resolvconf”
sudo apt-get install resolvconf
sudo dpkg-reconfigure resolvconf
參考: