Kategoriler
Anlatım Genel Software Defined Networking

How To Install Open vSwitch 2.3.0 to Ubuntu 14.04.1 LTS

Assalamu alaikum wa rahmatullahi wa barakatuh,
Peace be upon you dear visitor 🙂

In this tutorial, I’m going to show you how to install Open vSwitch 2.3.0 in your Ubuntu 14.04.1 LTS. I modified the installation code in Mininet to do that.

If you want to install Mininet and other things (e.g. cbench, wireshark, pox and etc.) from scratch, you should modify the installation script in Mininet, too. Before modifying the installation code, open install.sh in mininet/util directory. Then;

  • Change OVS_RELEASE=1.4.0 to OVS_RELEASE=2.3.0.
  • If you have previous version of Open vSwitch installed in your system, you should remove it. Thus, use remove_ovs function to do that. You can either run this code separately or add to the function all.
  • Comment out ovs line in the function all and add function ubuntuOvs in it.

function all {

echo “Installing all packages except for -eix (doxypy, ivs, nox-classic)…”
kernel
mn_deps
# Skip mn_dev (doxypy/texlive/fonts/etc.) because it’s huge
# mn_dev
of
install_wireshark
remove_ovs
ubuntuOVS
pox
oftest
cbench
echo “Enjoy Mininet!”
}

The script that I use to install Mininet, OpenFlow, OpenFlow v1.3, Wireshark, Floodlight and Open vSwitch 2.3.0 into SDN_RAD folder under home directory is here. Use it at your own risk!

Assalamu alaikum wa rahmatullahi wa barakatuh 🙂

Kategoriler
Genel Software Defined Networking

Floodlight Exact/Prefix IP Matching Tutorial

Assalamu alaikum (Peace be upon you) dear friend =)

In this tutorial, I’m going to show you how to make exact IP matching in the Floodlight controller using Mininet, OpenFlow (of course) and Open vSwitch.

Let’s begin with the topology. We have me (Sadican), my workmate (Workmate) and a server (Bilmuh). All of them are connected to an Open vSwitch. Overall network is something like that:

tut_network_topology

Here are the IP addresses and switch ports for each node:

Node Name IP Address Connected Physical SW Port
Sadican 10.0.0.11 1
Workmate 10.0.0.55 2
Bilmuh Server 10.0.0.99 3

Me and my workmate want connect to the Bilmuh server. Whenever we try to connect to the server, (if there is no corresponding rule in the switch) switch sends packet-in message to the Floodlight (FL) controller. FL takes this message and extracts IP addresses. Then, it generates exact IP matching rules. There are several important things to do that.

  • First of all, FL has to know connected ports of nodes, which are given.
  • Secondly, controller must create 4 flow-mod add rules. 2 Rules for ARP packets from one node to another (e.g. Sadican to Bilmuh server and reverse) and 2 rules for TCP connections.
  • FL must specify data layer type in matching. For TCP, it is 0x800 and for ARP, it is 0x806. Do not forget that!
  • FL must also set both of the network masks to 32 bits (full) for source and destination IP addresses.

For TCP Connections:
match.setWildcards(Wildcards.FULL.matchOn(Flag.IN_PORT)
.matchOn(Flag.DL_TYPE).matchOn(Flag.NW_SRC).matchOn(Flag.NW_DST).withNwSrcMask(32).withNwDstMask(32));
match.setDataLayerType(Ethernet.TYPE_IPv4);
match.setNetworkProtocol(IPv4.PROTOCOL_TCP);

For ARP Connections:
match.setWildcards(Wildcards.FULL.matchOn(Flag.IN_PORT).matchOn(Flag.DL_TYPE).matchOn(Flag.NW_SRC).matchOn(Flag.NW_DST).withNwSrcMask(32).withNwDstMask(32));
match.setDataLayerType(Ethernet.TYPE_ARP);
match.setNetworkProtocol(IPv4.PROTOCOL_TCP);

You can download the Mininet script from here.

You can download the Floodlight module from here. 

If you will test this scenario, you should disable Forwarding and LearningSwitch modules. To do so, open floodlightdefault.properties file and delete the modules. Then, add our module (a.tests.ExactIPMatchingTutorial) in it. Since, they also establish paths between nodes. Here is a screenshot from FL’s UI:

Remarks:
If network source and destination masks are less than 32, exact IP matching becomes prefix matching. Actually, you can try it by changing withNwSrcMask and withNwDstMask to something like 16 or whatever. You will see that there will be less than 8 rules in the switch. It is because some rules overlap and they are removed during addition operation as specified in the OpenFlow version 1.0. Besides, exact IP addresses become prefixed IP addresses. For example, 10.0.0.11 becomes 10.0.0.0.

tut_fl_ss_exact_ip_matching

Kategoriler
Anlatım Software Defined Networking

Floodlight Unknown Host Discovery

Assalamu alaikum wa rahmatulllahi wa barakatuh.
(Peace be upon you dear visitor.)

In my tests, I saw that Floodlight discovers an unknown host per switch as in the figure below.

fl_unknown_host_discovery

I have Floodlight (FL), Mininet (MN) and Open VSwitch (OVS) installed in the same machine where Ubuntu 14.04 LTS x64 is running. As far as I know, OVS 2.0.1 supports kernel from 2.6.32 to 3.10. Since my Ubuntu kernel is 3.13, this may be the source of problem. Update of OVS or downgrade of Ubuntu kernel may solve the problem but I have another simple, not that good, solution.

With the help and advise of Hung-Wei Chiu from Floodlight-Developers group, I noticed that there are many IPv6 packets in the FL logs as he had told. This unknown IPv6 addresses were the same as MAC addresses of switches or hosts. As a solution to this problem, I disabled IPv6 in my computer.

In order to disable IPv6, you must append the three lines of code as in below to the file located in /etc/sysctl.conf . Note that you need root privileges.

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

After modification, you can either reboot your computer or execute sudo sysctl -p command in terminal.

However, this method may not work as expected. (Well, it did not work for me) Alternatively, there is another way of disabling IPv6 in Linux. Using your favorite text editor, open /etc/default/grub file. Then, add ipv6.disable=1 to the GRUB_CMDLINE_LINUX line. In my computer (Ubuntu 14.04 LTS x64), it was like:

GRUB_CMDLINE_LINUX=""

After change:

GRUB_CMDLINE_LINUX="ipv6.disable=1"

After this modification, you must update grub with executing the command sudo update-grub . Finally, reboot your computer and problem solved!

Assalamu alaikum wa rahmatulllahi wa barakatuh.

Kategoriler
Anlatım Linux

Xubuntu Wireless Kart Sorunu

Allah ‘ın selamı, rahmeti, bereketi, ihsanı ve ikramı üzerinize olsun (:

Uzun zamandır yaşadığım basit ama sinir bozucu bir sorunun çözümünden bahsetmek istedim.

Ubuntu, Kubuntu, Xubuntu vb dağıtımları kullanan arkadaşlar bilirler ki, kablosuz ağınızı elle (bir tuş üzerinden) kapatırsanız, tekrar açtığınızda kablosuz ağınız çalışmıyor. Hangi durumlarda olduğunu tam olarak bilmiyorum. Sanıyorum bilgisayarı kablosuz ağı donanımsal olarak kapattığınız zaman oluyor. Yani kapatmadan önce tuşla kapatıyorsunuz. Bilgisayarı tekrar açtığınızda tekrar açsanız bile yazılımsal olarak kilitli kalıyor.

Bu durumdan kurtulmak çok kolay aslında. Rfkill komutunu kullanarak açabiliyorsunuz fakat yine de sinir bozucu. Her seferinde konsolu kullanarak bu işi yapmak yerine bir kod yazdım. Kod aslında çok kısa olabilirdi fakat ben süslü bir şey olsun diye biraz uzattım.

Metin editörünüzü açıp kodu içine kopyalayın ve kaydedin. Daha sonra sağ tıklayıp izinler kısmında çalıştırma izni verin. Son olarak da sağ tıklayıp çalıştır deyin. Masaüstü bildirimleri sayesinde sonucu görebilirsiniz. Masaüstü bildirim kütüphanesi yüklü değilse ekranda herhangi bir şey çıkmayacaktır. Fakat terminalden çalıştırırsanız bildirimleri görebilirsiniz.

#!/bin/sh
# _ubuntu wireless card on-off script

 

hard=$(rfkill list wlan | grep -c “Hard blocked: yes”)
soft=$(rfkill list wlan | grep -c “Soft blocked: yes”)

 

if [ $hard -eq 1 ]
then
notify-send -t 3000 “Wlan is blocked hard! Switch card on!”
echo “Wlan is blocked hard! Switch card on!”
exit

 

elif [ $soft -eq 1 ]
then
notify-send -t 3000 “Wlan is blocked soft! It will be opened soon…”
echo “Wlan is blocked soft! It will be opened soon…”
rfkill unblock wlan
notify-send -t 3000 “Wlan is unblocked!”
echo “Wlan is unblocked!”
exit 0

 

else
notify-send -t 3000 “Wlan is unblocked already!”
echo “Wlan is unblocked already!”
exit 0
fi

Bir başka çözümde daha görüşmek dileğiyle, Allah ‘a emanet olunuz efendim (: