How to fix receiving 802.1Q VLAN-prefixed packets from VLAN virtual interface on Linux

Problem

You are trying to receive raw packets from a network interface, which happens to be a VLAN interface, on Linux.

When you are looking at the packets, all packets are encapsulated in 802.1Q headers, even though you would expect the kernel to strip the VLAN tags

Solution

You need to set the network interface option reorder_hdr to on, eg

example.sh
sudo ip link set dev enp1s0.999 type vlan id 999 reorder_hdr on

where:


Check out similar posts by category: Networking