DIQ'S DEN - WWW.COUYON.NET
  • Home
  • Blog
  • Photos

Routed networks in VirtualBox

5/21/2015

 
I recently had a project at work where the project's requirements forced me to think outside the box. They were:

  • Spin up hundreds or thousands of VM's dynamically without much intervention from netops. These VM's would exist across many hypervisors and be provisioned dynamically.
  • Allow inbound traffic to the guest VM's from networks outside the hypervisor.

The built-in VirtualBox networking options really wouldn't fit the bill. Here's why:

  • Bridged networking would require a lot of prior planning and work from netops. Would all the hypervisors be in the right VLAN to get the various subnets required? Some of the hypervisors might reside in smaller existing networks that would be /22-/24. Nope, too much work to support that across all of our locations.
  • Internal networks can only communicate with VM's residing on the same hypervisor. External access is a must.
  • Host-only networks only allow the VM to communicate with the hypervisor and other VM's. Similar to internal but not the outside world.
  • NAT networking would be a huge pain to map all of the inbound ports to VM ports. Reducing work was a goal here.
So what's the solution? Routed networking of course! What's that? There's no routed network option? Sure there is. It's called host-only networking with a local DHCP server. Next, you enable routing at the OS level. In Linux, set net.ipv4.ip_forward to 1 (for v4).

That solves the problem with VM's getting outside the hypervisor. The next problem is the return traffic knowing how to get back to the VM. Which hypervisor sent it? It's not bridged so it can't ARP. It's not NAT'd so it's not the hypervisor MAC. How do you point return traffic to the right server?

Your answer here is a dynamic routing protocol. We use OSPF, and bird is the word. A simple bird instance can advertise the IP network from vboxnet0 to the rest of your network over OSPF. Simple enough way to bring up and tear down a lot of networks with little effort. You don't have to use OSPF; you could use something else like IS-IS (which we also use but not here).

In summary, host-only network + DHCP server on hypervisor + routing + OSPF = routed VM networking in VirtualBox. It works really well and is being used for our in-house Selenium testing (taste.weebly.com).

Comments are closed.

    Author

    A NOLA native just trying to get by. I live in San Francisco and work as a digital plumber for the joint that runs this thing. (Square/Weebly) Thoughts are mine, not my company's.

    Picture
    Moi

    Archives

    May 2021
    April 2021
    March 2021
    February 2021
    December 2019
    April 2019
    July 2018
    February 2018
    January 2017
    August 2016
    May 2016
    June 2015
    May 2015
    December 2014
    July 2014
    March 2014
    December 2013
    November 2013
    June 2013
    May 2013
    April 2013
    March 2013
    February 2013
    October 2012
    July 2012
    June 2012
    April 2012
    March 2012
    February 2012
    November 2011
    September 2011
    August 2011
    June 2011
    May 2011

    Categories

    All
    Cajun
    Computers And Internet
    Cooking
    Creole
    Food
    Gumbo
    Nola
    Recipe
    Sf

    RSS Feed

Proudly powered by Weebly
  • Home
  • Blog
  • Photos