MiniEdit 2.2.0.1

UPDATE: You will not be able to run this specific version against the latest Mininet 2.2. There was a change in Mininet that removed a class that MiniEdit referenced. But there is good news. MiniEdit 2.2.0.1 has been included in the Mininet 2.2 distribution and has this bug fixed in it. So if you want MiniEdit that was released with Mininet 2.2, grab it from the link below.

https://raw.githubusercontent.com/mininet/mininet/2.2.0/examples/miniedit.py

—————-

Out with another update. As I mentioned in my last post, I’m going to start using new functions in Mininet that are not backward compatible with Mininet 2.1.0 or older. So to use this version, you will need to have the latest version of Mininet from GITHUB.

    • Support TCP or SSL for remote controller
    • Some UI layout changes in the host and switch properties.
    • Support new Mininet HostWithPrivateDirs class. Allows you to mount private directories for each host which can also be mounted over an existing directory like /var/tmp or an application directory like /etc/httpd.  Another example is available in Mininet in https://github.com/mininet/mininet/blob/master/examples/bind.py.
    • Replace custom code to set OF protocols with new Mininet OVSSwitch parameter. Below is an example of the new usage in Mininet.
s2 = net.addSwitch( 's2', protocols='OpenFlow13' )
or
s2 = net.addSwitch( 's2', protocols='OpenFlow13,OpenFlow11' )

Download MiniEdit 2.2.0.1 here.

This post ‘MiniEdit 2.2.0.1’ first appeared on https://techandtrains.com/.

 

Mininet and Open vSwitch on CentOS 7

The following are the steps I took to get Mininet running in CentOS 7.  I ran into many issues trying to get OVS installed and running.  There was a conflict between the OVS script tools starting OVSDB and SELinux.  I had to set SELinux to Passive to work around it.  So depending on what system you are running this on,  be advised of the following steps and what system level settings I changed for security.  I assume most of these will be corrected once OVS officially supports CentOS/RHEL 7.

Installing Mininet on CentOS7
– I needed VM with 2GB memory to get OS installed.
– I used CentOS-7.0-1406-x86_64-livecd.iso to install the VM. I’m not going to outline steps for installing CentOS.
– I created a local user called mininet and gave it sudo access and ran the remainder as that user.
– Install SSHD
sudo yum -y install openssh-server
sudo chkconfig sshd on
sudo service sshd start

– Disable SELinux to get OVSDB to stasrt
sudo setenforce Permissive

– Modify sudoers secure_path to add /usr/local/bin so the ‘controller’ which be found.
Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin

– Install GIT
sudo yum -y install git

– Get Mininet.
git clone git://github.com/mininet/mininet.git
– Update installer mininet/util/install.sh.
***ADD the following before the line ‘test -e /etc/fedora-release && DIST=”Fedora”‘. Somewhere around line 47.  May differ.
test -e /etc/centos-release && DIST="CentOS"
if [ "$DIST" = "CentOS" ]; then
    install='sudo yum -y install'
    remove='sudo yum -y erase'
    pkginst='sudo rpm -ivh'
    # Prereqs for this script
    if ! which lsb_release &> /dev/null; then
        $install redhat-lsb-core
    fi
fi

***EDIT
if ! echo $DIST | egrep 'Ubuntu|Debian|Fedora|CentOS'; then
    echo "Install.sh currently only supports Ubuntu, Debian and Fedora."
    exit 1
fi

– Install Mininet and OpenFlow reference.  Not OVS.
mininet/util/install.sh -nf

– Build and Install OVS
sudo yum -y install gcc make python-devel openssl-devel kernel-devel graphviz \
kernel-debug-devel autoconf automake rpm-build redhat-rpm-config \
libtool wget


mkdir -p /home/mininet/rpmbuild/SOURCES/
cd /home/mininet/rpmbuild/SOURCES/
wget http://openvswitch.org/releases/openvswitch-2.3.0.tar.gz
tar zxvf openvswitch-2.3.0.tar.gz
cd openvswitch-2.3.0
rpmbuild -bb --without check rhel/openvswitch.spec
sudo rpm -ivh --nodeps /home/mininet/rpmbuild/RPMS/x86_64/openvswitch*.rpm

– Start OVS
sudo /etc/init.d/openvswitch start

– Check working
[mininet@localhost ~]$ sudo ovs-vsctl show
76ed3664-6b6b-4325-85c1-c9a2bf735e30
    ovs_version: "2.3.0"

– Test out Mininet
[mininet@localhost ~]$ sudo mn --test pingall
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2
*** Adding switches:
s1
*** Adding links:
(h1, s1) (h2, s1)
*** Configuring hosts
h1 h2
*** Starting controller
*** Starting 1 switches
s1
*** Waiting for switches to connect
s1
*** Ping: testing ping reachability
h1 -> h2
h2 -> h1
*** Results: 0% dropped (2/2 received)
*** Stopping 1 controllers
c0
*** Stopping 1 switches
s1 ..
*** Stopping 2 hosts
h1 h2
*** Done
completed in 5.397 seconds

So it seems to work.  But there are a few things to note.

1. The kernel datapath is not installed.  This is totally userspace.  I could not get the kernel module to compile.  Wait until official support of RHEL7.
2. The above is the extent of the testing I did.  There may be other issues that crop up.

Hope this helps anyone that uses CentOS or RHEL 7 with Mininet.

 

This post ‘Mininet and OVS on CentOS 7’ first appeared on https://techandtrains.com/.

Docker Container as Mininet Host

Docker seems to quite the buzz these days. It’s interesting what you could do with it, but I wanted try and see if it can help in any way when used in Mininet. A lot of times when you want to run certain applications inside a Mininet Host, you had to install that software on your PC/VM since the Mininet Host and your physical host share the same file system. This does come in handy a lot of times. But what if I don’t want to clutter up my physical host with extra apps. This seems like a great place for Docker to be used. Since Mininet uses veth pairs to connect the Mininet Host to the switches, it seemed that it wouldn’t be to hard to swap out the Mininet Host with a Docker host since Docker containers can also use veth pairs.

So I wrote a small test class to try it out. I wrote a new DockerHost class and added one to my topology.

    h1 = net.addHost( 'h1', ip='10.0.0.1', cls=DockerHost )
    h2 = net.addHost( 'h2', ip='10.0.0.2')

Then tried it out.

mininet@mininet:~$ sudo ./dockerHost.py
*** Adding controller
*** Adding hosts
Removing any old host still running
mininet-h1
mininet-h1
Start Docker Host
*** Adding switch
*** Creating links
*** Starting network
*** Configuring hosts
h1 h2
*** Starting controller
*** Starting 1 switches
s1
*** Running CLI
*** Starting CLI:
mininet> pingall
*** Ping: testing ping reachability
h1 -> h2
h2 -> h1
*** Results: 0% dropped (2/2 received)
mininet> 

I was quite happy to see this work. The Docker host I used is a basic Ubuntu image. So it has no special apps in it. Mininet is just starting the Docker container as such.

docker run --priviledged -h h1 --name=mininet-h1 -ti  --net='none' ubuntu /bin/bash

I can see it running here.

mininet@mininet:~$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
a33e763eb709        ubuntu:latest       /bin/bash           19 seconds ago      Up 18 seconds                           mininet-h1  

You can pick up the experiment and play with it here and most likely improve it. If you add applications, for the above to still work, the container needs to be started as a shell so Mininet can configure the networking inside and send other commands. So any applications that need to start automatically must be started internally, possible using the supervisord process.

A quick note/disclaimer that this is a bit of a hack still. It isn’t considered stable by any means since this was just the beginning of the experiment, but I wanted to share my success so far. So use at your own risk.

If you are able to improve it, please ping me back as I’d love to see what you did.

This post ‘Docker Container as Mininet Host’ first appeared on https://techandtrains.com/.