以太网已连接但无法连接互联网

以太网已连接但无法连接互联网

我正在运行 Linux 的 Intel Galileo Gen 2 上尝试此操作Yocto,但无法使用以太网连接到互联网。我有 WiFi 卡,但也无法连接。我尝试过以下命令,它们的输出如下

ifconfig -a

输出:

enp0s20f6 Link encap:Ethernet  HWaddr 98:4F:EE:01:9E:CA
          inet addr:192.168.0.110  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::9a4f:eeff:fe01:9eca/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2731 errors:0 dropped:4 overruns:0 frame:0
          TX packets:599 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:276624 (270.1 KiB)  TX bytes:84524 (82.5 KiB)
          Interrupt:51 Base address:0x4000

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:5730 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5730 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:503288 (491.4 KiB)  TX bytes:503288 (491.4 KiB)

wlp1s0    Link encap:Ethernet  HWaddr 44:85:00:01:8A:D3
          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)

route -n

输出:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 enp0s20f6
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 enp0s20f6
192.168.0.1     0.0.0.0         255.255.255.255 UH    0      0        0 enp0s20f6

界面如下所示:

vi /etc/network/interfaces

auto enp0s20f6
iface enp0s20f6 inet static
  address 10.254.253.1
  netmask 255.255.255.0

auto wlan0
iface wlan0 inet dhcp
     wireless_mode managed
     wireless_essid any
     wpa-driver wext
     wpa-conf /etc/wpa_supplicant.conf

auto lo
iface lo inet loopback

经过尝试connmanctl services我得到,

*AR Wired                ethernet_984fee019eca_cable
*A  wifinw           wifi_448500018ad3_646c696e6b2d32333238_managed_psk

所以ping www.google.com失败了bad address。我尝试过ping 8.8.8.8,它给出了回应。根据@frarugi87,这是一个 DNS 问题,但我不知道如何解决这个问题。

/etc/resolv.conf以下名称服务器

# Generated by Connection Manager
nameserver 127.0.0.1
nameserver ::1

答案1

将 OpenDNS 服务器添加到我的/etc/resolv.conf文件中解决了这个问题。

vi /etc/resolv.conf

文件看起来像

nameserver 208.67.222.222
nameserver 208.67.220.220

此后,可以 ping 到 google.com。

相关内容