Sunday, November 15, 2009

vlan tag under vmware/virtualbox

When I was trying to add a vlan tag on my network traffic, I found that the tcpdump can read the correct vlan id information when I was using VMware or Virtualbox, but it failed to read that on my host machine.

After a lot of googling and test, I found that the Intel Pro/1000 driver has a bug that it automically filter the vlan tag. The reason that VMware and Virtualbox worded fine is that they do not have a Intel Pro/1000 NIC (network interface card).

I will keep my work on the virtual machines. To test the vlan feature:

promote> vconfig add eth0 101
add a vlan interface named eth0.101
promote> ifconfig eth0.101 10.0.0.7/24 up
give eth0.101 a ip and active it
promote> ping -I eth0.101 xxx.xxx.xxx.xxx
ping a ip through eth0.101

we can dump the packet via tcpdump
promote> tcpdump -ne -i eth0 -xx

you can see output message like:

12:54:08.887252 00:0c:29:6f:2e:e2 > Broadcast, ethertype 802.1Q (0x8100), length 46: vlan 101, p 0, ethertype ARP, arp who-has 23.24.4.43 tell 10.0.0.7
0x0000: ffff ffff ffff 000c 296f 2ee2 8100 0065
0x0010: 0806 0001 0800 0604 0001 000c 296f 2ee2
0x0020: 0a00 0007 0000 0000 0000 1718 042b

where the rea-marked bits are the valn id.

1 comment:

Anonymous said...

Hey thanks for this writeup. I was doing a Virtualbox VM with a vlan, bridged to dummy0... I couldnt figure it out so I used an e1000, and that failed... I found this post and tried going back to dummy0 with a pcnet32, and it all worked! Thanks!