In this recipe, we use Containernet as an example to show how to extend Mininet for more use cases, while using Containernet to show a simple emulation with Docker containers as hosts in Mininet. More complex Mininet algorithms can be run on Containernet, along with its capabilities to run containers as hosts.
First, install Containernet in your computer. Since Containernet uses Ansible for this, you need to install it before:
$ sudo apt-get install ansible git aptitude $ sudo vim /etc/ansible/hosts
Add: localhost ansible_connection=local
Now, to actually install Containernet:
$ git clone https://github.com/containernet/containernet.git $ cd containernet/ansible $ sudo ansible-playbook install.yml
Alternatively, you may use Vagrant to get Containernet up and running faster, without actually installing it manually. First make sure to have a hypervisor such as Virtualbox installed:
$ sudo apt-get install virtualbox
Now, you may execute the following to get Vagrant for Containernet:
$ cd containernet $ vagrant up $ vagrant ssh
You may confirm that you have installed Vagrant correctly by running the following from the containernet directory:
$ sudo py.test -v mininet/test/test_containernet.py
The following screenshot indicates the output to the preceding execution in Vagrant: