无法连接到互联网。 Debian Wheezy,ping DNS 地址有效

无法连接到互联网。 Debian Wheezy,ping DNS 地址有效

我已经从 Beaglebone Black 板上的 SD 卡启动了 Debian Wheezy。版本:debian-wheezy-7.0.0-armhf-3.8.13-bone20.img.xz,来自http://www.armhf.com/index.php/download/

我已经设置了 /etc/networks/interfaces 文件:

auto lo
iface lo inet loopback

auto eth2

iface eth2 inet static
    address 192.168.1.101
    netmask 255.255.255.0
    gateway 192.168.1.2
    dns-nameservers 8.8.8.8 8.8.8.9
# wireless network interface
#auto wlan0
#iface wlan0 inet dhcp

当我 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_req=1 ttl=44 time=32.3 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=44 time=29.3 ms
64 bytes from 8.8.8.8: icmp_req=3 ttl=44 time=30.3 ms

路线-n

0.0.0.0         192.168.1.2     0.0.0.0         UG    0      0        0 eth2
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth2

ifconfig-a

eth2      Link encap:Ethernet  HWaddr 90:59:af:5c:f9:ca
      inet addr:192.168.1.101  Bcast:192.168.1.255  Mask:255.255.255.0
      inet6 addr: fe80::9259:afff:fe5c:f9ca/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:463 errors:0 dropped:0 overruns:0 frame:0
      TX packets:182 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:91607 (89.4 KiB)  TX bytes:14680 (14.3 KiB)
      Interrupt:56

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:2 errors:0 dropped:0 overruns:0 frame:0
      TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0
      RX bytes:190 (190.0 B)  TX bytes:190 (190.0 B)

但是当我 ping google.com 时

ping: unknown host google.com

我也可以 ping 通网络上的其他设备,但无法访问互联网。

知道出了什么问题吗?

编辑1:

猫 /etc/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 8.8.8.8
nameserver 8.8.8.9

猫 /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 dns
networks:       files

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

netgroup:       nis

答案1

您需要将 DNS 设置添加到该/etc/resolv.conf文件中。如果您编辑该文件以包含类似以下内容,它应该可以工作:

nameserver 8.8.8.8

答案2

辅助服务器的地址是 8.8.4.4,而不是 8.8.8.9。

答案3

为了使该dns-nameservers指令起作用,/etc/network/interfaces您需要有一个单独的包resolvconf。您可以检查/etc/resolv.conf一下接口是否存在。如果不是,请安装该resolvconf软件包并重新启动界面:

apt-get install resolvconf
ifdown eth2
ifup eth2

相关内容