Creating a sandbox Network server for Neutron with VirtualBox and Vagrant – OpenStack
Recommended by 0 users
Creating a sandbox server for running the OpenStack Network Neutron services is easy using VirtualBox and Vagrant. VirtualBox gives us the ability to spin up virtual machines and networks without affecting the rest of our working environment and is freely available for Windows, Mac OSX, and Linux. Vagrant allows us to automate this task, meaning we can spend less time creating our test environments and more time using OpenStack.
A Vagrant is installable using Ubuntu’s package management. This test environment can then be used for the rest of this section.
It is assumed that the computer you will be using to run your test environment in, has enough processing power that has hardware virtualization support (for example, Intel VT-X and AMD-V support) with at least 8 GB RAM. Our nested virtual machines will require virtual RAM, so more physical RAM will help our virtual machines run much better.
To begin with, ensure that VirtualBox and Vagrant are installed and networking set up as described in Creating a sandbox environment with VirtualBox and Vagrant recipe of Keystone OpenStack Identity Service:
How to achieve it…
To create our sandbox server for running OpenStack Network within VirtualBox we will use Vagrant to define another virtual machine that allows us to run Open vSwitch and supporting Neutron services. This virtual machine, that we will refer to as the OpenStack Network node, will be configured with at least 1 GB RAM, 1 CPU and 20 GB of hard drive space and have four network interfaces. The first will be a NAT interface that allows our virtual machine to connect to the network outside of VirtualBox to download packages. The second interface will be the Management interface of our OpenStack Network host, the third interface will be for our Data network that Neutron uses for transit of data for the software-defined networking, and the fourth interface will be used for routing outside of our virtual environment.
Carry out the following steps to create the virtual machine with Vagrant that will be used to run Open vSwitch and Neutron services:
- Edit the file named Vagrantfile created in Creating a sandbox environment with VirtualBox and Vagrant recipe of Keystone OpenStack Identity Service and add the following section between the final two end blocks:
# Compute VM
config.vm.define :network do |network_config| Every Vagrant virtual environment requires
a box to build off of.
network_config.vm.box = "precise64"
network_config.vm.host_name = "network"
network_config.vm.box_url = "http://files.vagrantup.com/precise64.box"
network_config.vm.network :hostonly, "172.16.0.202", :netmask => "255.255.0.0"
network_config.vm.network :hostonly, "10.10.0.202", :netmask => "255.255.0.0"
network_config.vm.network :hostonly, "192.168.0.202", :netmask => "255.255.255.0"
# Customise the VM virtual hardware network_config.vm.customize ["modifyvm", :id, "--memory",
network_config.vm.customize ["modifyvm", :id, "--cpus", 1] end
- We are now ready to power on our network node. We do this by simply running the following command:
vagrant up network
Congratulations! We have successfully created the VirtualBox virtual machine running Ubuntu 12.04, which is able to run OpenStack Network.
How it works…
What we have done is created a virtual machine within VirtualBox by defining it in Vagrant. Vagrant then configures this virtual machine, based on the settings given in the Vagrantfile configuration file in the directory, which will store and run our VirtualBox VMs. This file is based on Ruby syntax, but the lines are relatively self-explanatory. We have specified the following:
- The hostname is called “network”
- The VM is based on Precise64, an alias for Ubuntu 12.04 LTS 64-Bit We have specified 1Gb Ram and 1 CPU
- eth0 is used for NAT, and exists in all our Vagrant spun up instances
- eth1 is a host-only network address and used for Management of our
- node eth2 is for inter-communication of network traffic
- eth3 is used to route to the outside of our environment (in a physical environment, this is used to connect to an external, routeable network). Note that in our Vagrant environment here, we assigned an IP address to this node. The next section removes this, as it’s a requirement for external router networks to not assign an IP, but Vagrant requires it.
We then launch this VirtualBox VM using Vagrant using the following simple command:
vagrant up network
There are a number of virtualization products available that are suitable for trying OpenStack, for example, VMware Server, VMware Player, and VMware Fusion are equally suitable.