如何修复在 Linux 上从 VLAN 虚拟接口接收到带 802.1Q VLAN 前缀的数据包
问题
你正在 Linux 上尝试从某个网络接口接收原始数据包,而该接口恰好是一个 VLAN 接口。
查看数据包时,你会发现所有数据包都被封装在 802.1Q 头中,尽管你期望内核会剥离 VLAN 标签。
解决方案
你需要将网络接口选项 reorder_hdr 设置为 on,例如:
enable-vlan-reorder-hdr.sh
sudo ip link set dev enp1s0.999 type vlan id 999 reorder_hdr on其中:
enp1s0.999是你的 VLAN 网络接口名称,999是你的 VLAN ID。
Check out similar posts by category:
Networking
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow