Monday, January 9, 2012

Mac OS X, VLANs and MAC addresses

Recently, I had to investigate an issue of machines not able to connect to a network. The machines would send frames - or supposedly do so - but received nothing.

One of the machines was actually working. But moving the connection to a different machine was not, so I suspected some form of association between the port and the mac address.

To prove it, I decided to change the MAC address of my Mac Book Pro and copy the MAC address of the working machine.

At the shell:

sudo ifconfig en0 link aa:bb:cc:dd:ee:ff
Continuing with the layer 2, Mac OS X allows one to create virtual VLAN subinterfaces.


  • Create the interface


ifconfig vlan<nn> create


  • Associate the interface with the vlan tag and physical interface


ifconfig vlan<nn> vlan 2 vlandev en0


  • Add an IP address to the interface


ifconfig vlan<nn> inet <IP> netmask <MASK>


  • Bring the interface up


ifconfig vlan<nn> up

All these commands need to be executed as root.