我正在尝试使用 vconfig 在无线 IPTV STB(机顶盒)上的 2 个嵌入式 Linux SOC 之间设置一个 VLAN。SOC 之间的物理连接是 Marvell 88E60xx 交换机。问题是 VLAN 需要是私有的。如果有多个 IPTV STB,RPC(远程过程调用)会从错误的 STB 获得响应,并且我使用的静态 IP 地址在网络上重复。我在 Wireshark 上看到了这一点。
检测到 1.1.1.1 (28:c8:7a:b5:ad:50) 的重复 IP 地址 - 28:c8:7a:b5:ad:10 (框架 171) 也正在使用
我怀疑我漏掉了 1 或 2 个配置步骤,但这是我第一次尝试设置 vlan。这是我在控制 WiFi 的 SOC 上配置 vlan 的方法
vconfig add br0 12
ip link set br0.12 up
ifconfig br0.12 1.1.1.2 netmask 255.255.255.248
这是我在控制 IPTV 的 SOC 上配置 vlan 的方法
ifconfig eth0 0.0.0.0 multicast up
vconfig add eth0 0
ifconfig eth0.0 0.0.0.0 multicast up
brctl addbr br0
brctl addif br0 eth0.0
brctl addbr br6
brctl stp br6 0 # spanning tree protocol off
brctl setfd br6 0 # set bridge forward delay to 0 seconds
vconfig add eth0 12
ifconfig eth0.12 0.0.0.0 multicast up
brctl addif br6 eth0.12
ifconfig br6 1.1.1.1 up
这是 SOC 上控制 WiFi 的 ifconfig
br0 Link encap:Ethernet HWaddr 28:C8:7A:B5:AD:11
inet addr:192.168.1.230 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: /64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:10266 errors:0 dropped:0 overruns:0 frame:0
TX packets:130 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1032197 (1008.0 KiB) TX bytes:10459 (10.2 KiB)
br0.12 Link encap:Ethernet HWaddr 28:C8:7A:B5:AD:11
inet addr:1.1.1.2 Bcast:1.1.1.7 Mask:255.255.255.248
inet6 addr: /64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:178 errors:0 dropped:0 overruns:0 frame:0
TX packets:124 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:11585 (11.3 KiB) TX bytes:9991 (9.7 KiB)
eth1_0 Link encap:Ethernet HWaddr 28:C8:7A:B5:AD:13
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:9910 errors:0 dropped:0 overruns:0 frame:0
TX packets:47291704 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:512
RX bytes:927138 (905.4 KiB) TX bytes:1386129256 (1.2 GiB)
Interrupt:20
wifi0 Link encap:Ethernet HWaddr 28:C8:7A:B5:AD:11
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:47372174 errors:26 dropped:0 overruns:0 frame:0
TX packets:19386 errors:4 dropped:4 overruns:0 carrier:0
collisions:0 txqueuelen:1536
RX bytes:2526373464 (2.3 GiB) TX bytes:1626473 (1.5 MiB)
这是控制 IPTV 的 SOC 上的 ifconfig
br6 Link encap:Ethernet HWaddr 28:C8:7A:B5:AD:10
inet addr:1.1.1.1 Bcast:1.255.255.255 Mask:255.0.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:87 errors:0 dropped:0 overruns:0 frame:0
TX packets:120 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:5801 (5.6 KiB) TX bytes:8981 (8.7 KiB)
eth0 Link encap:Ethernet HWaddr 28:C8:7A:B5:AD:10
inet addr:10.70.246.245 Bcast:10.70.246.255 Mask:255.255.255.240
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:46704864 errors:140 dropped:0 overruns:0 frame:226
TX packets:19531 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:128
RX bytes:433498829 (413.4 MiB) TX bytes:821667 (802.4 KiB)
Interrupt:46
eth0.0 Link encap:Ethernet HWaddr 28:C8:7A:B5:AD:10
UP BROADCAST RUNNING 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:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
eth0.12 Link encap:Ethernet HWaddr 28:C8:7A:B5:AD:10
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:87 errors:0 dropped:0 overruns:0 frame:0
TX packets:120 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:6149 (6.0 KiB) TX bytes:9461 (9.2 KiB)
这是控制 WiFi 的 SOC 上的 cat /proc/net/vlan/*
br0.12 VID: 12 REORDER_HDR: 1 dev->priv_flags: 1
total frames received 266
total bytes received 16535
Broadcast/Multicast Rcvd 0
total frames transmitted 191
total bytes transmitted 20024
total headroom inc 0
total encap on xmit 191
Device: br0
INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0
EGRESS priority mappings:
VLAN Dev name | VLAN ID
Name-Type: VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD
br0.12 | 12 | br0
这是控制 IPTV 的 SOC 上的 cat /proc/net/vlan/*
VLAN Dev name | VLAN ID
Name-Type: VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD
eth0.0 | 0 | eth0
eth0.12 | 12 | eth0
eth0.0 VID: 0 REORDER_HDR: 1 dev->priv_flags: 1
total frames received 0
total bytes received 0
Broadcast/Multicast Rcvd 0
total frames transmitted 0
total bytes transmitted 0
total headroom inc 0
total encap on xmit 0
Device: eth0
INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0
EGRESSS priority Mappings:
eth0.12 VID: 12 REORDER_HDR: 1 dev->priv_flags: 1
total frames received 183
total bytes received 17613
Broadcast/Multicast Rcvd 6
total frames transmitted 252
total bytes transmitted 18699
total headroom inc 39
total encap on xmit 252
Device: eth0
INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0
EGRESSS priority Mappings:
答案1
我可以通过关闭 arp 来隔离 VLAN,如下所示
ifconfig br6 -arp #turn off arp
并像这样设置 arp
arp -s 1.1.1.2 $WMAC
在桥的另一边做类似的事情
ifconfig br0 -arp #turn off arp
ifconfig br0.12 -arp #turn off arp
和
arp -s 1.1.1.1 $EMAC