Running multiple VMs that each run an ONOS instance is one way of running a multi-instance ONOS deployment. It is however not that practical to do on my resource-constrained laptop. Using Linux Containers is a great alternative that achieves the same thing but uses way less CPU and memory.
...
I'm using VirtualBox as virtualization environment, but I see no reason why this shouldn't work on VMWare or other hypervisors. First step is to create a fresh install of Ubuntu 14.04.2 LTS server edition. I installed
LXC
In the following, we'll first create a single container that is fully configured, and then clone the original as many times as needed.
Installing LXC is as simple as doingrunning
sudo apt-get install lxc
You should run lxc-checkconfig
to determine your system properly supports this technology.
Next we'll create a new container with a clean Ubuntu install. This command will download all kinds of dependencies so it might take a while to complete.
sudo lxc-create -n onos1 -t ubuntu
You can verify the container is now available on your system. Note the container is currently stopped.
sudo lxc-ls --fancy
Go ahead and start the container. The -d flag instructs LXC to daemonize the container, so we'll stay in our shell while the container runs in the background.
sudo lxc-start -n onos1 -d
Take a look at the output of lxc-ls
again: note the container is now started and, if all has gone well, has received an IP address.
You can ssh into the container by using the IP address you just saw; ubuntu is the default login and password. You want to do two things: enable passwordless sudo for the ubuntu user, and install Java 8.
Run sudo visudo
and add the following line to the end of the file:
ubuntu ALL=(ALL) NOPASSWD:ALL
Installing Java is done as follows:
sudo apt-get install software-properties-common -y
sudo add-apt-repository ppa:webupd8team/java -y
sudo apt-get update
sudo apt-get install oracle-java8-installer oracle-java8-set-default -y
If you would like your containers to be automatically started on boot, you'll need to add the following line to /var/lib/lxc/NAME/config
, where NAME is your container's name. By the way, on my system , the /var/lib/lxc
directory is only accessible by root.
...
sudo echo 2 > /sys/devices/virtual/net/lxcbr0/bridge/multicast_router
Development cycle
IP forwarding