无法在设备上配置 VLAN

无法在设备上配置 VLAN

我是 VLAN 实施方面的新手。

我正在尝试在目标设备上手动配置 vlan。我使用这两个 vlan 配置命令,然后 ping IP 地址并嗅探数据包以在消息中查找 vlan 标记。

vconfig add esw0
ifconfig esw0.10 10.93.1.2 netmask 255.255.255.0 

尽管我尝试标记不是出现在任何传出的数据包中。

然而,当我在 Ubuntu 工作站上尝试完全相同的方法和命令时,vlan 标记确实正常工作。

Target: mips32, Linux 2.6.39, 802.1Q driver version 1.8

提前感谢您的帮助。

以下是我所做事情的日志:

# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         10.93.1.1       0.0.0.0         UG    0      0        0 esw0
10.93.1.0       *               255.255.255.0   U     0      0        0 esw0
127.0.0.0       *               255.0.0.0       U     0      0        0 lo
#
#
# vconfig add esw0 10
esw0.10: Features changed: 0x00005800 -> 0x00005000
# ifconfig esw0.10 10.93.1.2 netmask 255.255.255.0
# ifconfig -a
esw0      Link encap:Ethernet  HWaddr 00:01:02:03:04:14  
          inet addr:10.93.1.2  Bcast:10.93.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1509 errors:0 dropped:646 overruns:0 frame:0
          TX packets:21 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:170634 (166.6 KiB)  TX bytes:2542 (2.4 KiB)

esw0.10   Link encap:Ethernet  HWaddr 00:01:02:03:04:14
          inet addr:10.93.1.2  Bcast:10.93.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:308 (308.0 B)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  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)

# ping 10.93.1.4
PING 10.93.1.4 (10.93.1.4): 56 data bytes
64 bytes from 10.93.1.4: icmp_seq=0 ttl=64 time=9.4 ms
64 bytes from 10.93.1.4: icmp_seq=1 ttl=64 time=0.6 ms
64 bytes from 10.93.1.4: icmp_seq=2 ttl=64 time=0.6 ms
64 bytes from 10.93.1.4: icmp_seq=3 ttl=64 time=0.5 ms
64 bytes from 10.93.1.4: icmp_seq=4 ttl=64 time=0.6 ms
64 bytes from 10.93.1.4: icmp_seq=5 ttl=64 time=0.6 ms
64 bytes from 10.93.1.4: icmp_seq=6 ttl=64 time=0.6 ms
64 bytes from 10.93.1.4: icmp_seq=7 ttl=64 time=0.6 ms
64 bytes from 10.93.1.4: icmp_seq=8 ttl=64 time=0.5 ms
64 bytes from 10.93.1.4: icmp_seq=9 ttl=64 time=0.6 ms
64 bytes from 10.93.1.4: icmp_seq=10 ttl=64 time=0.6 ms
64 bytes from 10.93.1.4: icmp_seq=11 ttl=64 time=0.6 ms
64 bytes from 10.93.1.4: icmp_seq=12 ttl=64 time=0.6 ms
^C
--- 10.93.1.4 ping statistics ---
13 packets transmitted, 13 packets received, 0% packet loss
round-trip min/avg/max = 0.5/1.2/9.4 ms

尽管没有添加 vlan 标签,esw0.10 vlan 接口似乎确实在传输 ping 数据包。

# cat /proc/net/vlan/esw0.10
esw0.10  VID: 10         REORDER_HDR: 1  dev->priv_flags: 1
         total frames received            0
          total bytes received            0
      Broadcast/Multicast Rcvd            0

      total frames transmitted            6
       total bytes transmitted          468
Device: esw0
INGRESS priority mappings: 0:0  1:0  2:0  3:0  4:0  5:0  6:0 7:0
 EGRESS priority mappings:

以下是 VLAN 配置后的路由表快照:

# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use  Iface
default         10.93.1.1       0.0.0.0         UG    0      0        0 esw0
10.93.1.0       *               255.255.255.0   U     0      0        0 esw0
10.93.1.0       *               255.255.255.0   U     0      0        0 esw0.10
127.0.0.0       *               255.0.0.0       U     0      0        0 lo
#

相关内容