RAETH 以太网交换机无法接收数据包/DHCP

RAETH 以太网交换机无法接收数据包/DHCP

我一直在使用常见的 RALINK 平台 (MT7621),在让以太网端口接收数据包时遇到了一些麻烦,我认为这是它们无法从路由器上的 DHCP 服务器 (DNSMASQ) 接收 IP 的主要原因。端口没有任何问题,并且以太网驱动程序在插入/拔出电缆时正确报告链路开启/关闭。

系统信息:

root@DD-WRT:~# uname -a
Linux DD-WRT 4.14.19 #946 SMP PREEMPT Wed Feb 14 11:25:30 MST 2018 mips GNU/Linux

有三个项目连接到桥接接口“br0”:两个无线电装置和千兆以太网交换机:

LAN(eth2)/WAN(eth3)接口:

eth2: flags=4163 < UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500  metric 1
      inet6 fe80::7a32:xxxx:xxxx:96fd  prefixlen 64  scopeid 0x20<link>
      ether 78:32:xx:xx:96:fd  txqueuelen 1000  (Ethernet)
      RX packets 0  bytes 0 (0.0 B)
      RX errors 0  dropped 0  overruns 0  frame 0
      TX packets 102  bytes 7444 (7.2 KiB)
      TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
      device interrupt 3  

eth3: flags=4931 < UP,BROADCAST,RUNNING,PROMISC,ALLMULTI,MULTICAST>  mtu 1500  metric 1
      inet6 fe80::7a32:xxxx:xxxx:9700  prefixlen 64  scopeid 0x20<link>
      ether 78:32:xx:xx:97:00  txqueuelen 1000  (Ethernet)
      RX packets 0  bytes 0 (0.0 B)
      RX errors 0  dropped 0  overruns 0  frame 0
      TX packets 13  bytes 1006 (1006.0 B)
      TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

桥:

bridge name     bridge id               STP enabled     interfaces
br0             8000.7832xxxx96fd       no              eth2
                                                        ra0
                                                        rai0

编辑:我应该提到没有调制解调器连接到 WAN 端口(即我只是尝试获取本地 DHCP)。'route'、/etc/resolv.conf 和 /etc/hosts 的内容如下:

root@DD-WRT:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
127.0.0.0       *               255.0.0.0       U     0      0        0 lo
169.254.0.0     *               255.255.0.0     U     0      0        0 br0
192.168.1.0     *               255.255.255.0   U     0      0        0 br0

root@DD-WRT:~# cat /etc/hosts
127.0.0.1       localhost
192.168.1.1     DD-WRT
root@DD-WRT:~# cat /etc/resolv.conf 
nameserver 192.168.1.1

两个无线接口在为连接的设备分配 IP 时都没有问题,这让我相信这与内核 3.x 和 4.x 在路由方面的一些变化有关

下面我提供了尽可能多的有关此问题的信息。我还将提到此特定千兆交换机 (MT7530) 的相关功能已启用 (NET_DSA_MT7530、CONFIG_BRIDGE_VLAN_FILTERING、CONFIG_BRIDGE_NETFILTER)

为了确保问题与 iptables 无关,我编译了没有任何 NAT/IPTABLES/NF 功能的内核,但仍然遇到此问题,这让我相信我遗漏了与“vlan tags”相关的某些内容。我没有偏离 RALINK 的配置脚本。

root@DD-WRT:~# cat /proc/net/vlan/config 
VLAN Dev name    | VLAN ID
Name-Type: VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD
eth2.1         | 1  | eth2
eth2.2         | 2  | eth2
eth2.3         | 3  | eth2
eth2.4         | 4  | eth2

其中每个vlan的配置相同,如下所示:

root@DD-WRT:~# cat /proc/net/vlan/eth2.1
eth2.1  VID: 1   REORDER_HDR: 1  dev->priv_flags: 1001
     total frames received            0
      total bytes received            0
  Broadcast/Multicast Rcvd            0

  total frames transmitted           14     
  total bytes transmitted          1076
Device: eth2
INGRESS priority mappings: 0:0  1:1  2:2  3:3  4:4  5:5  6:6 7:7
 EGRESS priority mappings: 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7 

补充说明:无论我是否将 vlan(eth2.1、eth2.2、eth2.3、eth2.4)添加到网桥,行为都不会改变(我怀疑这是预期的行为)。

对于熟悉 RALINK 交换机程序的人来说,这里有一些额外的信息,只是为了让他们了解交换机是如何设置的:

root@DD-WRT:~# switch dump
hash  port(0:6)   fid   vid  age   mac-address     filter my_mac
724:   ---1 ----    0     4  146  406c8xxxx9d2     -     -
found the last entry 1 (not ready)

root@DD-WRT:~# cat /proc/mt7621/port_status 
Port0: LinkDown
Port1: LinkDown
Port2: LinkDown
Port3: LinkUp
Port4: LinkDown

视频 4 上报告的设备连接到以太网端口 3(第四个端口,连接 0、1、2、3),检查下面的 VLAN 映射时这是正确的(eth2.4 是视频 4,即交换机上端口 3 的 VLAN):

root@DD-WRT:~# switch vlan dump
  vid  fid  portmap    s-tag
    1    0  1-----11       0
    2    0  -1----11       0
    3    0  --1---11       0
    4    0  ---1--11       0
    5    0  ----11--       0
    6    0  invalid
    7    0  invalid
    8    0  invalid
    9    0  invalid
   10    0  invalid
   11    0  invalid
   12    0  invalid
   13    0  invalid
   14    0  invalid  
   15    0  invalid
   16    0  invalid

如果有人想了解有关内核配置等的更多信息,我很乐意提供。事实上,我不知道缺少什么。我承认,在网络方面我不是专家(虽然我在计算领域确实有一些专业知识,但不是这个),所以我可能会错过一个简单的“echo 1 > /proc/net/”或类似的东西。

对我来说,一切看起来都正确。我只是不知道为什么没有收到数据包!

编辑(2018 年 2 月 22 日):这是一些 ethool 输出。如果有帮助的话,LAN 端口应该是“TRGMII”(不确定是否反映在 ethtool 中,可能没有),而 wan 端口是“RGMII”:

root@DD-WRT:~# ethtool eth2
Settings for eth2:
        Supported ports: [ TP MII ]
        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/Full     
        Advertised pause frame use: Symmetric
        Advertised auto-negotiation: Yes
    Speed: 10Mb/s
    Duplex: Half
    Port: MII
    PHYAD: 1
    Transceiver: internal
    Auto-negotiation: on
    Link detected: no

“婉”:

Settings for eth3:
        Supported ports: [ TP MII ]
        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/Full 
        Advertised pause frame use: Symmetric
        Advertised auto-negotiation: Yes
        Speed: 10Mb/s
        Duplex: Half
        Port: MII
        PHYAD: 4
        Transceiver: internal
        Auto-negotiation: on
        Link detected: no

以及 VLAN:

Settings for eth2.1:
        Supported ports: [ TP MII ]
        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/Full 
        Advertised pause frame use: Symmetric
        Advertised auto-negotiation: Yes
        Speed: 10Mb/s
        Duplex: Half
        Port: MII
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        Link detected: yes

当我使用 ethtool 时,我会添加更多信息(这是新手。抱歉!)

相关内容