所有收到的VLAN数据包都变为Error Vlan Packets

时间:2014-09-05 11:33:00

标签: linux network-programming virtual-machine ethernet libpcap

我正在尝试发送和接收VLAN数据包,但我收到的每个数据包都会成为错误数据包。 是否有人可以将数据包作为错误接收给我,以便接收数据包。

这是状态......

Information about Ethernet interface 4, 10G_PLANE_A: Device State: UP Link State: UP Link Speed: 10000 Duplex Mode: FULL Flow Control: DISABLED ------ MAC address: 02:00:01:02:08:40 Packets Received: 5662 Bytes Received: 449816 Errored Packets Received: 0 Packets Without Client: 5655 Packets Sent: 1211 Bytes Sent: 41174 Vlan Packets Received: 1761 Vlan Packets Sent: 1211 Error Vlan Packets Received: 1761 Error Vlan Packets Sent: 0 Wred drop: 0

我发送的数据包是......

0000 02 00 01 02 08 40 00 01 ec 69 c7 b5 81 00 80 b4 .....@.. .i...... 0010 82 12 01 00 00 10 ab ba ac dc 07 ff 00 10 e9 ab ........ ........ 0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0030 00 00 00 00 00 00 00 00 00 00 00 00 31 0b fa 74 ........ ....1..t

我尝试更改VLNID,但没有用...

提前致谢 Murali krishna。

1 个答案:

答案 0 :(得分:1)

你的vlan 802.1Q标头是:0x8100 80b4,所以你的vlan id应该是0xb4 = 180十进制

请参阅此处的802.1Q标头: http://en.wikipedia.org/wiki/IEEE_802.1Q

ethertype / length在0x8100 80b4之后,所以它将是8212。 由于8212大于0x05DC,因此它被视为ethertype,但我无法找到0x8212作为有效的etype。

您的数据包很可能缺少长度字段。您应该在0x8212之前添加长度字段(2个字节)。试一试,看看它是否适合你。