If you wish to use vlan sub-interfaces in linux, and sub-sub-interfaces, and sub-sub-sub-… and if you wish to ping something — sure, you may wish to have them only for switching, but if you wish to ping — don’t forget to re-set REORDER_HDR flag:
ip link set up dev eth2 vconfig add eth2 100 ip link set up dev vlan100 vconfig set_flag vlan100 1 0 vconfig add vlan100 200 ip link set up dev vlan200 vconfig set_flag vlan200 1 0 # ....etc-etc vconfig add vlan800 900 ip link set up dev vlan900 vconfig set_flag vlan900 1 0 ip add add 192.168.1.100/24 brd 192.168.1.255 dev vlan900 ping 192.168.1.3 |
Note using command vconfig set_flag DEV 1 0 — i mean exactly this :-)
Now (since 2.6.x?.. can’t remember, doesn’t matter) Linux kernel creates vlan interfaces with REORDER_HDR=1.
You can verify current value of REORDER_HDR flag with command like this:
# cat /proc/net/vlan/vlan900
vlan900 VID: 900 REORDER_HDR: 0 dev->priv_flags: 1
total frames received 172
total bytes received 222546
Broadcast/Multicast Rcvd 0
total frames transmitted 405
total bytes transmitted 283743
total headroom inc 0
total encap on xmit 26
Device: vlan900
INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0
EGRESS priority mappings: