Network in a Box
Sometimes it's handy to have some stuff packed in a small RPI board e.g. for demonstration purposes and the like. The following short tutorial is about preparing a 'network' box, consisting Mininet and related stuff. You will need a RPI2 or RPI3, with Ubuntu 16.04 server installed.
Follow the official guide for installing Ubuntu 16.04 ‘classic’ here on your RPI2 or RPI3. Note that for RPI3 there’s still no official image i.e. you have to follow workarounds suggested in the page.
Check & Preparation
After a successful Ubuntu installation, you should have something similar to the following.
~$ ssh ubuntu@192.168.0.155
ubuntu@192.168.0.155's password:
Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-1082-raspi2 armv7l)
ubuntu@pi:~$ uname -r
4.4.0-1082-raspi2
ubuntu@pi:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
You might want to change the default credential (ubuntu/ubuntu
). Previously I changed the hostname from the default ubuntu
to pi
.
ubuntu@pi:~$ cat /etc/hostname
pi
ubuntu@pi:~$ cat /etc/hosts
127.0.0.1 localhost
127.0.0.1 pi
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
To easily connect via ssh, I configured the pi with static IP address by editing /etc/network/interfaces
as follows.
ubuntu@pi:~$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# Source interfaces
# Please check /etc/network/interfaces.d before changing this file
# as interfaces may have been defined in /etc/network/interfaces.d
# See LP: #1262951
# source /etc/network/interfaces.d/*.cfg
#auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.168.0.155
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
dns-nameservers 8.8.8.8 8.8.4.4
Install Mininet
# clone mininet repo
ubuntu@pi:~$ git clone git://github.com/mininet/mininet.git
# check available tags
ubuntu@pi:~/mininet$ git tag
# checkout
ubuntu@pi:~/mininet$ git checkout 2.2.2
# install (without sudo)
ubuntu@pi:~/mininet$ util/install.sh -nfvw
Get POX Controller
# get POX
ubuntu@pi:~$ git clone https://github.com/noxrepo/pox.git
ubuntu@pi:~/pox$ git branch
* carp
Install MiniNAM
# dependency
ubuntu@pi:~$ sudo apt-get install git python-imaging python-pil.imagetk
# get MiniNAM
ubuntu@pi:~$ git clone https://github.com/uccmisl/MiniNAM.git
Final Check
At this point you will have 4 folders in your home directory. And if everything went ok, your “network” box is ready. Try executing sudo mn
.
ubuntu@pi:~$ tree -L 1 -d
.
├── MiniNAM
├── mininet
├── openflow
└── pox