How can I see which VLAN a virtual network interface is assigned to

After I created a new virtual interface like this:

ip link add link eth0 name eth0.100 type vlan id 100

How can I afterwards verify that a virtual interface is configured for that VLAN? Neither

ip link show eth0.100

nor

ip a s

seems to show any VLAN information.


Solution 1:

found the following solution:

cat /proc/net/vlan/eth0.2011 
eth0.2011 VID: 2011 REORDER_HDR: 1 dev->priv_flags: 1 total frames received 1129 total bytes received 55318 Broadcast/Multicast Rcvd 0

total frames transmitted            8
total bytes transmitted          648

Device: eth0 INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0 
EGRESS priority mappings: 

Solution 2:

Just spotted this question while looking for something else...

You're nearly there.... what you need to use is -d to reveal detailed information about a link that you can then grep out the VLAN info:

$ ip -d link show dev eth0.100 | grep 'vlan protocol'
vlan protocol 802.1Q id 5 <REORDER_HDR>