Ubuntu 有线以太网可以被检测到,但无法连接到任何其他设备,且 RX 数据传输始终为零

Ubuntu 有线以太网可以被检测到,但无法连接到任何其他设备,且 RX 数据传输始终为零

平台

  • CPU:RK3288 ARMv7嵌入式处理器
  • 内存:2GB
  • 网卡:板载RTL8211E芯片
  • 操作系统:Ubuntu 14.04.1 LTS
root@9tripod:~# uname -a
Linux 9tripod 3.10.0 #26 SMP PREEMPT Sat Mar 4 17:06:44 CST 2017 armv7l armv7l armv7l GNU/Linux
root@9tripod:~# cat /etc/issue
Ubuntu 14.04.1 LTS \n \l

症状

系统映像刷新并启动后,在 PC 和开发板之间连接网线。然后使用以下命令将静态 IP 地址设置为 PC 和开发板ifconfig

ifconfig eth0 192.168.1.XXX netmask 255.255.255.0

然后我尝试了ping我的电脑但无法访问:

root@9tripod:~# ping 192.168.1.107
PING 192.168.1.107 (192.168.1.107) 56(84) bytes of data.
From 192.168.1.233 icmp_seq=1 Destination Host Unreachable
From 192.168.1.233 icmp_seq=2 Destination Host Unreachable
From 192.168.1.233 icmp_seq=3 Destination Host Unreachable
From 192.168.1.233 icmp_seq=4 Destination Host Unreachable
From 192.168.1.233 icmp_seq=5 Destination Host Unreachable
From 192.168.1.233 icmp_seq=6 Destination Host Unreachable
^C
--- 192.168.1.107 ping statistics ---
7 packets transmitted, 0 received, +6 errors, 100% packet loss, time 6005ms
pipe 3

经过一番尝试,我发现板上RJ45连接器上的绿色LED闪烁,而黄色LED不亮。但一旦拔掉网线,两个 LED 就会继续亮起。然后通过输入ifconfig命令,我发现没有传输任何 RX 数据包:

root@9tripod:~# ifconfig
eth0      Link encap:Ethernet  HWaddr ee:e3:d4:01:f6:6f
          inet6 addr: fe80::ece3:d4ff:fe01:f66f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2133 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:524034 (524.0 KB)
          Interrupt:59
...

当使用 PC 反向 ping 时,显示“目标主机无法访问”,并且板也没有收到任何包。我尝试重新启动系统,更换另一根电缆并使用开关,甚至将 RJ45 连接器更换为新的,但都不起作用。顺便说一句,当我测试 ping 时,wlan0 已关闭,因此路由表应该没有问题。

诊断信息

  1. 使用ifconfig:参见症状部门。
  2. 使用ip link show
root@9tripod:~# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether ee:e3:d4:01:f6:6f brd ff:ff:ff:ff:ff:ff
3: sit0: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT group default
    link/sit 0.0.0.0 brd 0.0.0.0
4: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN mode DORMANT group default qlen 1000
    link/ether 00:90:4c:11:22:33 brd ff:ff:ff:ff:ff:ff
  1. 内容在/etc/network/interfaces
root@9tripod:~# cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

auto eth0
#iface eth0 inet dhcp
  1. 使用网络管理器:
root@9tripod:~# nmcli device status
DEVICE     TYPE              STATE
eth0       802-3-ethernet    disconnected
wlan0      802-11-wireless   connected
root@9tripod:~# nm-tool

NetworkManager Tool

State: connected (global)

- Device: eth0 -----------------------------------------------------------------
  Type:              Wired
  Driver:            stmmaceth
  State:             disconnected
  Default:           no
  HW Address:        EE:E3:D4:01:F6:6F

  Capabilities:
    Carrier Detect:  yes
    Speed:           1000 Mb/s

  Wired Properties
    Carrier:         on
...
  1. 使用mii-tool
root@9tripod:~# mii-tool
eth0: negotiated 1000baseT-FD flow-control, link ok
  1. 使用ethtool
root@9tripod:~# ethtool eth0
Settings for eth0:
        Supported ports: [ TP AUI BNC MII FIBRE ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 1
        Transceiver: external
        Auto-negotiation: on
        Supports Wake-on: ug
        Wake-on: d
        Current message level: 0x0000003f (63)
                               drv probe link timer ifdown ifup
        Link detected: yes
  1. 使用dmesg
root@9tripod:~# dmesg |grep -i eth0
[   17.685231] eth0: device MAC address ee:e3:d4:01:f6:6f
[   17.693782] eth0: PHY ID 001cc915 at 0 IRQ 0 (stmmac-0:00) active
[   17.693788] eth0: PHY ID 001cc915 at 1 IRQ 0 (stmmac-0:01) active

问题

既然系统检测到eth0并且可以无误地执行上述操作,并且IP地址静态设置正确,那么是什么原因导致板子无法通过eth0访问任何其他设备?

我猜测可能是网卡芯片有问题,但是Linux却可以无错误地操作它,这很奇怪。芯片是否有可能整体工作正常,但其某些功能(例如数据接收)被破坏?

如果需要提供任何其他诊断信息,请发表评论。任何提示表示赞赏。

相关内容