Internet over Ethernet:DNS工作,ping不工作(Windows工作,Linux不工作)


4

我有一台PC使用以太网连接连接到Internet。使用Ubuntu我能够使用nslookup解析域,但如果我尝试运行“ping google.com”或“ping 74.125.39.104”,它就无法正常工作。

我在两台上网本上使用了Arch Linux,Mint和Ubuntu Live,但都失败了。然而,Windows工作得很好。让我免于使用Windows!

使用ifconfig:

sudo ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:26:18:80:79:18  
          inet addr:10.20.6.180  Bcast:10.20.7.255  Mask:255.255.254.0
          inet6 addr: fe80::226:18ff:fe80:7918/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5751 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2397 errors:0 dropped:0 overruns:0 carrier:17
          collisions:0 txqueuelen:1000 
          RX bytes:659976 (659.9 KB)  TX bytes:253881 (253.8 KB)
          Interrupt:40

路线:

route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.20.6.0       0.0.0.0         255.255.254.0   U     1      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth0
0.0.0.0         10.20.6.1       0.0.0.0         UG    0      0        0 eth0
0.0.0.0         10.20.6.1       0.0.0.0         UG    202    0        0 eth0

netstat的:

netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
10.20.6.0       0.0.0.0         255.255.254.0   U         0 0          0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth0
0.0.0.0         10.20.6.1       0.0.0.0         UG        0 0          0 eth0
0.0.0.0         10.20.6.1       0.0.0.0         UG        0 0          0 eth0

iptables的:

sudo iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

resolv.conf的:

cat /etc/resolv.conf
# Generated by resolvconf 
search uni-mannheim.de 
nameserver 134.155.96.51 
nameserver 134.155.96.53

tracepath不起作用:

sudo tracepath www.google.com
 1:  laptop.local                                          0.342ms pmtu 1500
 1:  no reply
 2:  no reply
 3:  no reply
 4:  no reply

是/etc/host.conf

sudo cat /etc/host.conf
# The "order" line is only used by old versions of the C library.
order hosts,bind
multi on

/etc/nsswitch.conf中

sudo cat /etc/nsswitch.conf
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd:         compat
group:          compat
shadow:         compat

hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis

nslookup google.com

nslookup google.com
Server:     134.155.96.51
Address:    134.155.96.51#53

Non-authoritative answer:
Name:   google.com
Address: 74.125.39.104
Name:   google.com
Address: 74.125.39.105
Name:   google.com
Address: 74.125.39.106
Name:   google.com
Address: 74.125.39.147
Name:   google.com
Address: 74.125.39.99
Name:   google.com
Address: 74.125.39.103

wget google.com

wget google.com
--2011-08-17 11:05:01--  http://google.com/
Resolving google.com... 74.125.39.99, 74.125.39.103, 74.125.39.104, ...
Connecting to google.com|74.125.39.99|:80...

挖google.com

tracepath不起作用,但挖掘确实有效

dig google.com

; <<>> DiG 9.7.3 <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2643
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 4, ADDITIONAL: 4

;; QUESTION SECTION:
;google.com.            IN  A

;; ANSWER SECTION:
google.com.     175 IN  A   74.125.39.103
google.com.     175 IN  A   74.125.39.104
google.com.     175 IN  A   74.125.39.105
google.com.     175 IN  A   74.125.39.106
google.com.     175 IN  A   74.125.39.147
google.com.     175 IN  A   74.125.39.99

;; AUTHORITY SECTION:
google.com.     104161  IN  NS  ns4.google.com.
google.com.     104161  IN  NS  ns3.google.com.
google.com.     104161  IN  NS  ns1.google.com.
google.com.     104161  IN  NS  ns2.google.com.

;; ADDITIONAL SECTION:
ns1.google.com.     277325  IN  A   216.239.32.10
ns2.google.com.     277325  IN  A   216.239.34.10
ns3.google.com.     277325  IN  A   216.239.36.10
ns4.google.com.     277325  IN  A   216.239.38.10

;; Query time: 2 msec
;; SERVER: 134.155.96.51#53(134.155.96.51)
;; WHEN: Wed Aug 17 11:06:14 2011
;; MSG SIZE  rcvd: 260

我确定你实际上并没有通过以太网连接到互联网(除非你在同一地点设施)。那你连接的是什么?
基思

Answers:


1

不要过于担心ping,服务器基础设施阻止ping并不罕见。Ping和traceroute通常使用ICMP。更好的测试是wget http://www.google.com使用HTTP。

首先用于host www.google.com测试DNS(较旧的Linux系统将具有nslookupdig代替host

$ host www.google.com
www.google.com是www.l.google.com的别名。
www.l.google.com的地址为209.85.143.104
www.l.google.com的地址为209.85.143.99


$ wget http://www.google.com
--12:21:13-- http://www.google.com/
           =>`index.html'
解决www.google.com ...完成。
连接到www.google.com [209.85.143.99]:80 ...已连接。
发送HTTP请求,等待响应... 200 OK
长度:未指定[text / html]

    [] 9,931 167.21K / s

12:21:14(167.21 KB / s) - “index.html”已保存[9931]

执行命令“host google.com”给出正确的输出(ip和mail ip列表)运行“wget google.com ”给出以下输出:--2011-08-16 22:41:28-- google。 com解析www.google.com ...失败:名称或服务未知。wget:无法解析主机地址'www.google.com'原因是什么?我猜这与tracepath的问题有关,你怎么看?
Francesco

我觉得它奇怪。你有什么/etc/host.conf/etc/nsswitch.conf
RedGrittyBrick 2011年

我将输出添加到帖子中。感谢您的时间!这个问题让我发疯,叹了口气......它也发生在现场发行版上,所以在我的机器上不是一些错误的配置。让我生气的是窗户工作得很好只需插上电缆......谢谢
Francesco

我也注意到tracepath不起作用,但挖掘确实...
Francesco

0

你的/etc/resolve.conf是什么?它应该指向你的路由器

此文件对于连接到互联网非常重要。


resolv.conf #由resolvconf搜索生成uni-mannheim.de nameserver 134.155.96.51 nameserver 134.155.96.53这个文件是不是与dns有关?因为那是现在唯一有用的东西。谢谢你的时间!
Francesco

0

验证Firestarter防火墙:

chkconfig -l | grep firestarter

firestarter 0:off 1:off 2:off 3:off 4:off 5:off 6:off S:on

禁用Firestarter防火墙:

sudo chkconfig firestarter off

并再次检查:

chkconfig -l | grep firestarter

firestarter 0:off 1:off 2:off 3:off 4:off 5:off 6:off

并停止防火墙:

sudo firestarter -p

继续,再次尝试ping。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.