VLAN Setup on Ubuntu 12.04

Ran into a situation recently where I needed to set up provider_vlan within OpenStack as well as configure the VLANs on the underlying hosts. This being the first time I’ve done this in Ubuntu it needs to be written down:

apt-get update && apt-get install -y vlan

modprobe 8021q
vconfig add bond0 100
vconfig add bond0 200
vconfig add bond0 300

echo "
auto bond0.200
iface bond0.200 inet static
        address 192.168.100.4
        netmask 255.255.255.0
        vlan_raw_device bond0

auto bond0.300
iface bond0.300 inet static
        address 10.0.1.4
        netmask 255.255.255.0
        vlan_raw_device bond0

" | sudo tee -a /etc/network/interfaces

After that, restarting networking should bring everything in line.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.