Skip to content

Virtual environment creation

allanv edited this page Apr 5, 2013 · 2 revisions

The virtual environment creation script

The VMs in RouteFlow are implemented as LXC containers in the default setup. You can use other virtualization technologies. If you have experience with or questions about setting up RouteFlow on a particular technology, contact us!

A script is provided with RouteFlow to ease the creation of these containers.

A few facts:

  • The creation script is located in rftest/create.
  • It creates the containers in /var/lib/lxc (this is important)
  • The containers are created with Ubuntu 12.04 (precise)
  • The rftest/config directory is read to determine which containers will be created and what their content will be
  • The following packages are installed by default:
quagga rsyslog vlan tcpdump \
libboost-thread1.46.1 libboost-system1.46.1 \
libboost-filesystem1.46.1 libboost-program-options1.46.1

If you need to install custom software in your container, modify the create script where indicated in it.

LXC container templates

Each folder in the config directory will become an LXC container. The names don't matter, but the directory structure does. It must be something like:

container/
  rootfs/
    ...
  config
  fstab

The config file is the configuration file for LXC. It's used to declare the network interfaces and point to the fstab file and rootfs folder. The syntax is simple, so just base your own configuration on an existing one. Make sure to adapt the paths to where the container will be, usually /var/lib/lxc/[container name].

In the rootfs folder you'll find files that will be copied to the container. You'll usually need to:

  • Enable IPv4 forwarding in /etc/sysctl.conf
  • Adapt /etc/network/interfaces to fit your needs
  • Configure Quagga in /etc/quagga
  • Have /etc/rc.local call /root/run_rfclient.sh & in order to start RFClient on boot

If you have any doubts, try to follow what's in the default containers.

For rftest1, the default containers are:

  • rfvm1: represents the switch/gateway
  • b1: first host connected to the switch (172.31.1.2)
  • b2: seconf host connected to the switch (172.31.2.2)

For rftest2, the default containers are:

  • rfvmA: represents the switch/router A
  • rfvmB: represents the switch/router B
  • rfvmC: represents the switch/router C
  • rfvmD: represents the switch/router D

Since rftest2 is meant to run in Mininet or in a real network, the hosts are not created.

Running the script

Make sure there's a config directory with the templates at the same directory level as the script, and run:

$ sudo ./create

It will create a base container in the LXC directory (/var/lib/lxc), and derive several other containers based on the templates.

The containers will have a default root/root user/password combination. You should change that if you plan to deploy RouteFlow.