Mininet VM Setup Notes
The Mininet VM is meant to speed up Mininet installation, plus make it easy to run on non-Linux platforms. The VM works on Windows, Mac, and Linux, through VMware, VirtualBox, QEMU and KVM.
After downloading the VM, you'll run a few steps to customize it for your setup. This won't take long.
VM Setup
Download VM
Download the VM at
http://openflowswitch.org/downloads/OpenFlowTutorial-081910.vmware.zip
The VM comes out to ~800MB compressed and ~2GB uncompressed. It's in VMWare vmdk (virtual machine disk) format, which should run immediately on VMWare Fusion for Mac and VMWare Workstation on Windows and Linux. A free alternative is Oracle VirtualBox, which runs on all platforms, but may require a few extra commands to get a network connection running. On Linux, qemu-img can convert from a vmdk to formats understood by KVM, Qemu, and Xen. qemu-img can also be used to create a .hdd image which can be used with Parallels.
Download and install
VMware Workstation for Windows or Linux,
VMware Fusion for Mac, or
VirtualBox (free, GPL) for any platform.
QEMU/KVM conversion
If you want to run the VM under QEMU or KVM, you need use the qemu-img utility to convert the disk image to the QEMU native format (qcow2).
qemu-img isn't smart enough to figure out that the main .vmdk file contains a bunch of references to segment files. You need to pass a list of the segments so that qemu-img can glue them all together:
qemu-img convert -O qcow2 OpenFlowVM-s0{01,02,03,04,05,06,07,08,09,10,11}.vmdk OpenFlowVM.qcow
Boot VM
Add the VM and start it up, in the virtualization program of your choice.
VMware may ask you to install VMware tools on the VM - if it asks, decline. Everything graphical in the tutorial is done via X forwarding through SSH (in fact, the VM doesn't have a desktop manager installed), so the VMware tools are unnecessary.
To boot the VM with QEMU or KVM run:
qemu -m 512 -hda OpenFlowVM.qcow -net nic,model=virtio -net user,net=192.168.101.0/24,hostfwd=tcp::8022-:22
Login to VM
Log in to the VM, using the following params:
- Username: openflow
- Password: openflow
The root account is not enabled for login; you can use sudo to run a command as superuser.
SSH into VM
First, find the VM's IP address, which for VMware is probably in the range 192.168.x.y. In the VM console:
/sbin/ifconfig eth0
You may want to add the address to your host PC's /etc/hosts file to be able to SSH in by name, if it's Unix-like. For example, add a line like this for OS X:
192.168.x.y openflow
where 192.168.x.y is replaced by the VM's IP address.
SSH in to the host. Use -Y to enable trusted X forwarding, for use with Wireshark later - we assume the VM is running locally, and that the additional precautions of -X w/SSH are unnecessary.
ssh -Y openflow@openflow
If you're running the VM under QEMU/KVM with
-net user and the
hostfwd option as recommended above, the VM IP address is irrelevant. Instead you tell SSH to connect to port 8022 on the host:
ssh -Y -p 8022 openflow@localhost
Install preferred editor
Install your preferred editor. For example, to install vim:
sudo apt-get -y install vim
Optional VM Customization
These commands are optional, and may be useful for your setup:
Setup SSH auto-login
These steps let you log in via SSH without needing to enter a password. If you use the console from your virtualization software natively, then this step isn't needed.
Check for ~/.ssh/id_rsa ~/.ssh/id_dsa. If you can't find either of these files, then you'll want to generate an SSH key.
On a unix-like system (OS X or Linux - you'll need other instructions for Windows) - on the host, not the VM:
ssh-keygen -t rsa
To speed up future SSH connections, add your host's public key to the new VM. Also on the host, not the VM:
scp ~/.ssh/id_rsa.pub openflow@openflow:~/
Now, on the VM (SSH in first):
cd ~/ && mkdir -p .ssh && chmod 700 .ssh && cd .ssh && touch authorized_keys2 && chmod 600 authorized_keys2 && cat ../id_rsa.pub >> authorized_keys2 && rm ../id_rsa.pub && cd ..
Now you should be able to log in without entering a password.
Mininet Walkthrough
(Highly recommended) Head over to the
MininetWalkthrough, which shows common commands. It'll be really useful, trust us.