Tuesday, 21 May 2013

OpenFlow Switch on Raspberry Pi Part 2: Installing the OpenFlow switch on the hardware

In the first article I introduced the concept of building the worlds cheapest OpenFlow switch based on the Raspberry Pi. A 4 port switch was constructed from about £50 worth of hardware.

We are now going to install the open source software on the Pi to get ourselves a functioning switch.

The software we are going to use is one which I've been involved with for about 18 months which is the LINC OpenFlow switch.  This switch is written in Erlang and can be downloaded for free from flowforwarding.org

First we need to install Erlang on our Raspberry Pi.  I have assumed your Pi is running Raspbian - if not you'll need to download the image onto a new SD card.

First you need a command prompt on your Pi as we need to edit some files

pi@raspberrypi ~ $ sudo vi /etc/apt/sources.list

Insert into this file:

deb http://binaries.erlang-solutions.com/debian wheezy contrib

Then at the command prompt type

pi@raspberrypi ~ $ wget -O - http://binaries.erlang-solutions.com/debian/erlang_solutions.asc |sudo apt-key add -
pi@raspberrypi ~ $ sudo apt-get update
pi@raspberrypi ~ $ sudo apt-get install esl-erlang

Assuming there were no problems, you should now have Erlang installed on your Pi.

We now need to install LINC.

First we need to install a few more libraries

pi@raspberrypi ~ $ sudo apt-get install git-core bridge-utils libpcap0.8 libpcap-dev libcap2-bin uml-utilities

Now we need to clone the LINC switch

pi@raspberrypi ~ $ sudo git clone https://github.com/FlowForwarding/LINC-Switch/
pi@raspberrypi ~ $ cd LINC_Switch

Now we need to compile the switch software

pi@raspberrypi ~ $ sudo make

 We now have a LINC OpenFlow switch installed on our Raspberry Pi hardware.

In the next blog I will cover how to configure it and start it up

13 comments:

  1. Great this topic are awesome.

    ReplyDelete
  2. I'm trying to prepare similar setup, but using OpenvSwitch because I don't know ErLang. What are your thoughts on using OpenvSwitch?

    ReplyDelete
    Replies
    1. Hello Pankaj, I have a same idea as yours, just wonder have you ever port openvswitch or other switch sw supported openflow on raspi? Thanks!

      Delete
  3. I haven't used Openvswitch yet so I'm not sure how portable it is. The beauty of Erlang (LINC) is it runs on lots of different hardware.

    Would be very interested to hear about what success you have running it on the Pi.

    ReplyDelete
  4. Very interesting... Do U now some more embedding systems that can be use for SDN purposes?

    ReplyDelete
  5. Hello Steve
    thank you for you topic. I followed it step by step, but when I enter the last command, the terminal shows as follows:
    ==> rel (generate)
    The configuration file rel/files/sys.config does not exist.
    You can create it in two ways:
    1. Either run scripts/config_gen with appropriate arguments and save its output in rel/files/sys.config,
    2. Or copy rel/files/sys.config.orig to rel/files/sys.config and edit it by hand to fit your setup.
    Then run "make rel" again.
    ERROR: Command [generate] failed!
    make: *** [rel] Error 1
    I am not familiar with erlang, but I need to build a OpenFlow Switch , so may I consult you about how to deal this situation?

    ReplyDelete
    Replies
    1. I have received same error, any help needed guys

      Delete
  6. just "sudo cp rel/files/sys.config.orig rel/files/sys.config". In the next Post you will edit this file anyway.

    ReplyDelete
  7. when I do $ sudo git clone https://github.com/FlowForwarding/LINC-Switch/
    I got this error message
    failed connect to github.com 443; Connection timed out while accessing https://github.com/FlowForwarding/LINC-Switch/info/refs

    ReplyDelete
    Replies
    1. try sudo apt-get update n then apt-get upgrade...

      Delete
  8. This comment has been removed by the author.

    ReplyDelete
  9. am getting this error on raspberry pi running Raspbian Jeesie Lite:
    ==> rel (compile)
    ==> LINC-Switch (compile)
    ==> rel (generate)
    ERROR: Unable to generate spec: read file info /usr/lib/erlang/man/man3/cerfcf.3 .gz failed
    ERROR: Unexpected error: rebar_abort
    ERROR: generate failed while processing /home/pi/LINC-Switch/rel: rebar_abort
    Makefile:4: recipe for target 'rel' failed
    make: *** [rel] Error 1

    My Erlang version is:
    Erlang R15B03 (erts-5.9.3.

    ReplyDelete
    Replies
    1. Hello, I had a similar problem and solved it by changing the Erlang version to 17.5. Also, I had to build it from source.

      I just did a:

      wget http://www.erlang.org/download/otp_src_17.5.tar.gz

      and then followed the simple installation process detailed in the first part of http://elinux.org/Erlang

      Hope it helps.

      L.

      Delete