Configuring VLANs in MAAS node deployment

Since Debian installer doesn’t have the ability to configure vlans we need to make any additional network modifications within the preseed/late_command stage. If you aren’t familiar with vlan or would like some more details on setting it up take a look at Ubuntu vlan wiki page. Also I don’t have the hardware to test the actual switching so hopefully someone will read this and let me know what I’ve missed. I checked into gns3 but it is my understanding it would be impossible to emulate the switching that Cisco hardware would.

Assumptions

Yea assumptions are baad, however, this article assumes you have an interface eth0 that supports vlan tagging (802.1q) and that a hardware switch exists that has been configured for vlans.

Preseed naming conventions in MAAS

The order in which MAAS loads a preseed file is seen below:

Note:

If you wish to keep your distro provided preseeds in-tact and use an alternative you could always name a new preseed with something like amd64_generic_precise and when deploying your nodes with the precise image it would pick up that preseed instead of generic. More information at How preseeds work

Modifying the preseeds for vlan support

The preseeds are located within /etc/maas/preseeds. For now the only preseed files we are concerned with is preseed_master and generic.

Opening up preseed_master we see a typical preseed configuration and scrolling to the bottom you’ll see:

This method is exposed as part of the Tempita template engine which we’ll see defined in our generic template next.

Opening generic template we’ll see something like the below:

Most of this should be self explanatory as this basically outlines the typical usage of most template engines. We inherit 'preseed_master' which calls self and we provide our method definitions with {{def <method>}}. Scroll down your generic preseed file and locate {{def post_scripts}}.

This definition is what’s called from our preseed_master configuration and where we’ll add our vlan options. We’ll make a call out to a vlansetup file hosted on the same server as maas, usually found in /var/www/.

Our vlansetup file would look something like

After the node is deployed you should see something like the following in your syslog output.

And /proc/net/vlan/config should look like

Last but not least ifconfig reports

Thoughts

Of course this could be seen as a hindrance if you have an environment more complex than just assigning vlan tags to eth0. Automating the assignment of vlan’s is probably best done within the installer, however, that feature doesn’t exist. Some things that could be done to lessen the administrative burden would be making use of puppet on the MAAS server and pre-populating the /etc/maas/preseeds/generic file.

Cool tips

If you are running your MAAS instance and nodes within KVM/VirtualBox/etc you could easily pull the IP from the virtual machine if you know the MAC address using something like arp -an. Then either setup puppet to keep your preseeds updated or utilize something like libguestfs to make changes directly within the VM.

Troubleshooting

Installing this on a desktop image with NetworkManager running (first ask yourself why)? Then see this post for a solution to configuring NetworkManager and vlan’s.

CC BY-SA 4.0
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

You may also like...

Leave a Reply

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


8 − = seven

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">