Miniedit 2.0.0.4

Another small update visibly, but laying the ground work for bigger stuff.

  • Add more link opts (max_queue_size, loss)
  • Update Load, Save and Export with above additions
  • Started adding right click menu on switch, host and link
  • Default terminal type in preferences
  • Fix small bug in Export Topology

Download Miniedit 2.0.0.4 here.

Upgrading Open vSwitch in Mininet 2.0 VM to OVS 1.10

Update:  I have a followup post on how to do the same thing but instead building and installing Debian package files.  It’s a cleaner approach and allows easier upgrades over and over.

—————————

Just want to share something I learned from the Mininet mailing list and tried out. These are instructions, courtesy of Vikram Dham from this post, but have been slightly altered for my own reading.

The following instruction are how to upgrade the Open vSwitch version that comes in the Mininet 2.0 VM to Open vSwitch 1.10.  Some features that I have seen are support for OpenFlow 1.2 and VXLAN tunnels.

1. Setting up Mininet VM, it you already don’t have it.
– Download the Mininet 2.0 vm and import it in VirtualBox.  These should be similar to the instruction on the Mininet site.
– Download Mininet 2.0 from https://github.com/mininet/mininet/downloads/
– Import unzip the package
– Import appliance into VirtualBox
– Change setting to add additional Host Only network adapter
– Start VM and login as mininet
– Enable the second interface ‘sudo dhclient eth1’

2. Become root
sudo -s

3. Remove old packaes
apt-get remove openvswitch-common openvswitch-datapath-dkms openvswitch-controller openvswitch-pki openvswitch-switch

4. Download and unpack Open vSwitch 1.10
cd /root
wget http://openvswitch.org/releases/openvswitch-1.10.0.tar.gz
tar zxvf openvswitch-1.10.0.tar.gz

5. Build and install
cd openvswitch-1.10.0
./configure –prefix=/usr –with-linux=/lib/modules/`uname -r`/build
make
make install
make modules_install
rmmod openvswitch
depmod -a

6. Disable to default controller
echo “manual” >> /etc/init/openvswitch-controller.override
/etc/init.d/openvswitch-controller stop

7. Start OVS server process
/etc/init.d/openvswitch-switch start

Now you should have a working Mininet using OVS 1.10. Below are some steps to test the new OVS 1.10 features that you now have available.

8. Start mininet with a test topology
cd /home/mininet/mininet/examples
./emptynet.py

9. In another window, check what protocol the switch is running.
ovs-ofctl -O OpenFlow10 show s3
ovs-ofctl -O OpenFlow12 show s3

10. One of the above will error, showing that is does not support that version.  Now let’s change it to OF1.2.
ovs-vsctl set bridge s3 protocols=OpenFlow12

You will see that OpenFlow12 command worked.

11. You can run another command to see if the protocol is set on the switch.

root@mininet-vm:~# ovs-vsctl list bridge s3
_uuid               : e3171ac1-0b53-4770-be32-e5903e3801be
controller          : [b82acc19-5536-42b9-95eb-22942e683b98]
datapath_id         : "0000000000000003"
datapath_type       : ""
external_ids        : {}
fail_mode           : secure
flood_vlans         : []
flow_tables         : {}
mirrors             : []
name                : "s3"
netflow             : []
other_config        : {datapath-id="0000000000000003"}
ports               : [34a45885-7cda-4cb8-a76c-35e048795201, c33e59b5-050b-4fad-92da-e495d66de4a4, d0c18e1a-fc46-4f41-89df-968cd59c01d5]
protocols           : ["OpenFlow12"]
sflow               : []
status              : {}
stp_enable          : false

12. You can enable all supported protocols by running the following.
ovs-vsctl set bridge s3 protocols=OpenFlow10,OpenFlow12,OpenFlow13

Creating OpenVSwitch for GNS3

I’ve had some notes that I made about how to create an OpenVSwitch device for use within GNS3 on Windows.  Other platforms should be similar for these instructions.  So I thought I’d pass it along.

Prerequisites:

==================

Once you have the TAP driver installed, create a tap interface.

  •   Run the following as adminitrator
Start->All Programs->OpenVPN->Utilities
->Add a new TAP virtual ethernet adapter
  • In the Control Panel\Network and Internet\Network Connections, rename the new interface to ‘tap0’.

Tiny core howto
==================
Now that the software is ready, let’s create the OpenVSwitch device for GNS3.  To do this, we are going to create a very small Qemu VM that will be the OpenVSwitch device.  Open a command prompt window and ‘cd’ to the directory where we are going to create the VM.  Copy the TinyCore ISO file to that directory as well.  Then run the following commands to create the disk and start the VM installation.

"c:\Program Files\GNS3\qemu-img.exe" create -f qcow2 ./ovs171.img 200M
"c:\Program Files\GNS3\qemu.exe" -boot d -hda ovs171.img -cdrom .\CorePlus-current.iso -net nic -net tap,ifname=tap0

Install TinyCore into the VM

  • click on TC_Install
    • Start screen
      • Frugal
      • Whole Disk
      • choose sda
      • Install boot loader
      • Click Next arrow button
    • Formatting Options
      • choose default ext4
      • Next
    • Boot Options
      • nothing to choose
      • Next
    • Install Type
      • Core Only
      • Next
    • Review
      • Proceed
    • Done
      • Click the X to close the window
  • Shutdown the VM

Your initial TinyCore VM is now created, so let’s start it up.

"c:\Program Files\GNS3\qemu.exe" -boot c -hda ovs171.img -net nic -net tap,ifname=tap0

OpenVSwitch howto
==================

For the next part, I got several great tips from Brezular’s Technical Blog.

First, using the console window that is open lets’ install OpenSSH and OpenVSwitch packages.

tce-load -w -i openssh.tcz openvswitch.tcz

Start up the SSHd so we can use a remote login session to continue instead of trying to use the console.

sudo -s
cd /usr/local/etc/ssh

mv ssh_config.example ssh_config
mv sshd_config.example sshd_config
/usr/local/etc/init.d/openssh start

Remember to set a password for the ‘tc’ account.

passwd tc

Using the console is painful. Let’s login using SSH.

  • Run ‘ifconfig’ to see what IP you have.
  • SSH into your VM

Now that we are in, let’s initialize the ovsdb.

sudo ovsdb-tool create \
/usr/local/etc/openvswitch/conf.db \
/usr/local/etc/openvswitch/vswitchd/vswitch.ovsschema

The only parts remaining of the installation is the configuration of the tinycore startup and config.

Edit the bootlocal.sh for the service you want to start.

sudo vi /opt/bootlocal.sh

#!/bin/sh
# put other system startup commands here

/usr/local/etc/init.d/openssh start

modprobe openvswitch
modprobe 8021q
modprobe ipv6

ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock --remote=db:Open_vSwitch,manager_options --private-key=db:SSL,private_key --certificate=db:SSL,certificate --bootstrap-ca-cert=db:SSL,ca_cert --pidfile --detach

ovs-vsctl --no-wait init

ovs-vswitchd --pidfile --detach

sysctl -w net.ipv4.ip_forward=1
sysctl -w net.ipv6.conf.all.forwarding=1

 

Edit the .filetool.lst to let tinycore know what directories to preserve changes after a reboot.

sudo vi /opt/.filetool.lst

opt
home
etc/passwd
etc/shadow
usr/local/etc/ssh
usr/local/etc/openvswitch

Commit any file system changes to CORE.

/usr/bin/filetool.sh -b
sudo reboot

You now have a base OVS install where the drive is only about 27MB is sise. From here you can add you VM to the QEMU Guest list.
GNS3->Edit->Preferences->Qemu->Qemu Guest

Adding the Qemu Guest into a topology will start it with 6 ethernet interfaces. In GNS3, I connected eth0 to my local network and kept eth1-eth5 for OVS. When first creating the Qemu Guest in the preferences, this is when you specify how many interface it will have. Going forward, my host PC IP is 192.168.10.235.

Once you add the VM into the GNS3 canvas, start it up and login to it. Configure the OVS with the 5 interfaces.

sudo ovs-vsctl add-br br0
sudo ovs-vsctl add-port br0 eth1
sudo ovs-vsctl add-port br0 eth2
sudo ovs-vsctl add-port br0 eth3
sudo ovs-vsctl add-port br0 eth4
sudo ovs-vsctl add-port br0 eth5
/usr/bin/filetool.sh -b

If you want to use an SDN controller, you can use the following to configure the switch’s controller location.

sudo ovs-vsctl set-controller br0 \
    tcp:192.168.10.235:6633
/usr/bin/filetool.sh -b

Now, the OVS should look something like this.

tc@box:~$ sudo ovs-vsctl show
370eda01-cfdc-4d3e-a160-ef5381409bd1
    Bridge "br0"
        Controller "tcp:192.168.10.235:6633"
        Port "eth1"
            Interface "eth1"
        Port "eth2"
            Interface "eth2"
        Port "eth3"
            Interface "eth3"
        Port "eth5"
            Interface "eth5"
        Port "eth4"
            Interface "eth4"
        Port "br0"
            Interface "br0"
                type: internal

There you go. You have an OpenVSwitch running in your GNS3 that you can mix in with your topology.

As an added bonus. If you want OpenVSwitch to talk to an sFlow client on your PC, just run something like this.

sudo ovs-vsctl -- --id=@s create sFlow \
    agent=eth0 target=\"192.168.10.235:6343\" header=128 \
    sampling=64 polling=10 -- set Bridge br0 sflow=@s
/usr/bin/filetool.sh -b

And for a NetFlow client on your PC.

sudo ovs-vsctl -- set Bridge br0 \
    netflow=@nf -- --id=@nf create NetFlow \
    targets=\"192.168.10.235:2055\" active-timeout=60
/usr/bin/filetool.sh -b