This Page Will Currently Describe the PI Lab

Inventory: see attachment:Purchase_for_Raspberry_Pi_project.pdf:wiki:GENIRacksHome/OpenGENIRacks/RaspberryPIs


DNS Addresses rosifolius gunnianus leucodermis parvifolius ellipticus idaeus

We also asked for fixed IP addresses for BBNGuest. We provided the MAC addresses for affiliation. DNS entries have also been assigned:


Web Pages Used for Reference

Generic Raspbian Installation - Note: I had trouble getting micro 64GB cards to work with this process although I know that the installation instructions for the hypriot worked for this size. - used this method later

  sudo diskutil list
  sudo diskutil umountDisk /dev/disk5
  sudo dd bs=1m if=/Users/rrosales/Downloads/2016-03-18-raspbian-jessie.img of=/dev/rdisk5
  sudo diskutil eject /dev/rdisk5

And then once the SD card is used to boot the pi - one needs to run raspi-config, and choose expanding filesystem to get the rest of the SD card seen. -

Static IP Address Configuration for Raspbian Jesse version


Despite lots of confusing information out there, it is actually pretty straightforward to set a static address in Raspbian.

Begin by editing the file (do not use /etc/network/interfaces anymore!)

sudo vi /etc/dhcpcd.conf

Then all you need to do is append this to the bottom of the file, substituting the correct IP address you want.

interface eth0
static ip_address=
static routers=
static domain_name_servers=

Docker Image Installation

[Image with Docker built in]

[Instructions on how to run a container using the previous image -]

Note - To make sure you have the full SD card available to you - you might need to expand the file system:
After booting up
[sudo raspi-config]

Setting Up Wifi

[Installing TL-WN722N WiFi on the Pi - Directions taken from]

Edit /etc/apt/sources.list to add the non-free archive and backports (eg: sudo vi /etc/apt/sources.list):

deb squeeze main non-free
deb squeeze/updates main non-free
deb squeeze-updates main non-free
deb squeeze-backports main non-free

Update the package cache:

sudo apt-get update

Download the wifi utils:

sudo apt-get install wireless-tools usbutils

Download the required firmware and put it in the correct location - you may not need to do this for your adapter or you may need different firmware - see below.

sudo apt-get install firmware-atheros
sudo wget
sudo cp htc_9271.fw /lib/firmware

Add adapter definition to network config - eg: sudo vi /etc/network/interfaces - add the wlan0 section:

# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.

auto lo

iface lo inet loopback
iface eth0 inet dhcp

# The wireless interface
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa.conf

Plug in adapter Confirm adapter is present:

root@raspberrypi:~# sudo iwconfig
  lo        no wireless extensions.

  eth0      no wireless extensions.

  wlan0     IEEE 802.11bgn  ESSID:off/any
            Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm
            Retry  long limit:7   RTS thr:off   Fragment thr:off
            Encryption key:off
            Power Management:off

Scan your network to see what wireless access points can be seen. You may need to do this to identify your network's SSID (name), but it also confirms that the wifi dongle is doing something. The first command just lists the SSIDs found, the second tells you probably more than you ever want to know:

sudo iwlist wlan0 scan | grep ESSID


sudo iwlist wlan0 scan

Create the wpa.conf file - eg: sudo vi /etc/wpa.conf:

Note: The ssid is case sensitive - if your WLAN's SSID is MYLAN, using "mylan" will not work - you won't connect!

pairwise=CCMP TKIP

Start the adapter

sudo ifup wlan0

Double-check whether you are connected - below the WLAN interface has been given an IP address - looks good!

root@raspberrypi:~# ifconfig
 eth0      Link encap:Ethernet  HWaddr b8:27:eb:76:7e:2e
           inet addr:  Bcast:  Mask:
           RX packets:1060 errors:0 dropped:0 overruns:0 frame:0
           TX packets:146 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000
           RX bytes:95749 (93.5 KiB)  TX bytes:48493 (47.3 KiB)

 lo        Link encap:Local Loopback
           inet addr:  Mask:
           UP LOOPBACK RUNNING  MTU:16436  Metric:1
           RX packets:8 errors:0 dropped:0 overruns:0 frame:0
           TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0
           RX bytes:560 (560.0 B)  TX bytes:560 (560.0 B)

 wlan0     Link encap:Ethernet  HWaddr b0:48:7a:91:5c:f4
           inet addr:  Bcast:  Mask:
           RX packets:31 errors:0 dropped:0 overruns:0 frame:0
           TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000
           RX bytes:2260 (2.2 KiB)  TX bytes:1542 (1.5 KiB)

And then to configure the wifi adapter - use the WICD GUI


[Wicd -]

You must remove network-manager to get wicd to work. Check to see if network-manager is installed and see if, after you installed the driver, your wireless is already working in the notification area of your desktop manager. You may already be good to go.

wicd (Wireless Interface Connection Daemon) is a lightweight alternative to NetworkManager. It is environment-independent, making it suitable for all desktop environments, including GNOME, Xfce, LXDE, and Fluxbox. Like NetworkManager, wicd is configured via a graphical interface. Your wireless interface should not be referenced within Debian's /etc/network/interfaces file.

  1. Update the list of available packages and install the wicd package:
        $ su
        # aptitude update
        # aptitude install wicd
  1. Amend /etc/network/interfaces to contain only the following:
        # This file describes the network interfaces available on your system
        # and how to activate them. For more information, see interfaces(5).
        # The loopback network interface
        auto lo
        iface lo inet loopback

Note: as of wheezy it is fine to have your wireless interface in /etc/network/interfaces, but not required. You can set the wireless interface (e.g. wlan0) in the wicd client's preferences.

  1. If not already performed, add your regular user account to the netdev group and reload DBus:
        # adduser yourusername netdev
        # /etc/init.d/dbus reload
  1. Start the wicd daemon:
        # /etc/init.d/wicd start
  1. Start the wicd GUI with your regular user account: Original instruction had a -n. We needed to run it without -n
        # exit
        $ wicd-client

GUI Setup

[We used Openbox -]

OVS Installation

     sudo apt-get install openvswitch-common
     sudo apt-get install openvswitch-switch

RYU Installation

    sudo apt-get install python-dev
    sudo pip install ryu

Also check this page for new install

GRAM Porting Status

The latest GRAM AM Software has been put on the card. The idea was to have GRAM as the AM manager for the resources of the rack. It was not as trivial to pull out the OpenStack code as there might be OpenStack assumptions intertwined into the GRAM AM code. In particular, the GRAM AM seems to support the notion of a tenant. And that notion naturally follows with OpenStack, and I think GRAM uses that notion. On a positive note, all python dependencies seemed to be supported by the PI operating system easily.

Installing Interesting Applications

Installing a WebRTC server on a Raspberry PI

Running OVS and RYU on the PI's (Li Lin's work)

OpenFlow on RPi
Li Lin, Regina Hain

The goal of this work is to run an OpenFlow controller on a raspberry pi.
To do so, we used Open vSwitch to configure the virtual switches on the
pi server and Ryu to run the controller and to inject custom flows.

There are three major pieces of this project:
1. Use OVS to setup a useful and interesting network
2. Run a custom script with the Ryu controller to install flows and route packets
3. Demoing the system with a streaming webcam application

==Part I: Using OVS to set up a useful and interesting network==

|Pi Server                                                              |
|   ____________         _______________         _______________        |
|  |    BR1     |       |     BR2       |       |     BR3       |       |
|  | |  PP*  |   |  PP*  |    |       |
|  |           2|-------|2             3|-------|2              |       |
|  |_____1______|       |______1________|       |______1________|       |
|   _____|______         ______|________         ______|________        |
|  |eth1        |       |eth2           |       |eth3           |       |
|  |10.10.1.x   |       |10.10.2.x      |       |10.10.3.x      |       |
|  |____________|       |_______________|       |_______________|       |
|        |                     |                       |                |
|        |                     |                       |                |
         |                     |                       |
    _____|______         ______|________         ______|________
   |    Pi1     |       |     Pi2       |       |     Pi3       |
   |  |       |    |       |    |
   |____________|       |_______________|       |_______________|

*: PP means patch port

This setup consists of 4 pi's- one acting as a server 3 as the clients.
There are 3 accompanying interfaces on the server- eth1, eth2, eth3, each
their own subnet. Additionally, each is connected to a separate OVS bridge.
The OVS bridges forward packets to all other bridges via patch ports.

=Setup on server=
To configure this network, run configure_pt1

=Setup on client=
To configure the ip address of client pi's, add the following
lines to /etc/dhcpcd.conf depending on its ip address and router values

# In pi1 /etc/dhcpcd.conf
interface eth0
static ip_address=
static router=

# In pi2 /etc/dhcpcd.conf
interface eth0
static ip_address=
static router=

# In pi3 /etc/dhcpcd.conf
interface eth0
static ip_address=
static router=

To test, run ping from one client Pi to another client Pi. Connectivity
should be present, via the OVS bridge and patch port topology, between
all three client Pi's.

To teardown this network, run teardown_pt1

==Part II: Using Ryu to install flows and route packets over our OVS network==

|Pi Server                                                              |
|   ____________________________________________________________        |
|  |                            BR1                             |       |
|  |                                        |       |
|  |                                                            |       |
|  |_____1_____________________3_______________________2________|       |
|   _____|______         ______|________         ______|________        |
|  |eth1        |       |eth2           |       |eth3           |       |
|  |   |       |      |       |      |       |
|  |____________|       |_______________|       |_______________|       |
|        |                     |                       |                |
|        |                     |                       |                |
         |                     |                       |
    _____|______         ______|________         ______|________
   |    Pi1     |       |     Pi2       |       |     Pi3       |
   |  |       |    |       |    |
   |____________|       |_______________|       |_______________|

Note that this topology is different from that in part I. This is because
having 3 bridges added too much unneeded complexity when crafting custom
flows. This time we used 1 bridge to connect all three interfaces and
connecting them up through separate ports.

=RYU Script Description=

This script creates a custom flow that matches on any packet coming in
on port 1 (source and out on port 3 (destination
It forwards that packet as usual, but also
creates a duplicate packet, modifies its destination (to the address
of pi3) and sends to port 2 (pi 3). The result is that pi3 gets a copy
of every packet that is sent from pi1 to pi2.

Note that to turn on the special flow, *insert_special_flow* must be set to
True in

To see that the custom flow is installed correctly (note that installation
will occur only on the first instance of a packet with source
and destination captured by our controller), on the server type
$ sudo ovs-ofctl dump-flows br1

To configure this network, run configure_pt2
Note that step 5, connecting the controller to the bridge, takes the
ip address of the server's eth0 interface. This can change based on
network and pi. To find the correct ip address to use, in a terminal type
$ ifconfig -a

To run the ryu controller with our custom script type:
$ ryu-manager ./path/to/
To ensure controller connectivity type:
$ sudo ovs-vsctl show
and you should see something like this (if connected):
    Bridge "br1"
        Controller "tcp:"
            is_connected: true


Ping test
On (pi1) type
$ ping
You will see that 2 different hosts will reply to the pings- both
pi2 ( and pi3 (

Netcat test
On (pi2) type
$ nc -l 1234
On (pi3) type
$ nc -l 1234
On (pi1) type
$ echo "HELLO WORLD" | nc 1234 -u

You should see that HELLO WORLD should be printed on both pi2 and pi3.
This only works in udp mode (-u) and the reason is left as an
exercise for the reader.

To teardown this network, run teardown_pt2

==Part III: Demoing via a streaming webcam application==

In this demo, pi1 ( will send raw video bytes captured from
its webcam to pi2 ( via the netcat application. Pi2 will capture
the udp packets by using netcat to listen on a specified port and save
the data to a pipe file. Pi2 will then run mplayer on the file to output the
video to screen. Pi3 will perform the same exact functions as Pi2, and
since the controller sends a duplicate copy of every udp packet to Pi3,
it can receive and render the webcam video also.

On Pi1:
1. Compile the C file used to read data from the webcam
$ gcc capturevideo.c -o capturevideo
2. Execute and pipe the output to via netcat
$ ./capturevideo -c 1000 -o | nc 5000
*. Instructions and code taken from:

On Pi2:
1. If not installed already, install mplayer
$ sudo apt-get install mplayer
2. Create a pipe file
$ mkfifo video.fifo
3. Call netcat and listen to specified port
$ nc.traditional -lu -p 5000 > video.fifo
4. Use mplayer to open video
$ mplayer video.fifo -demuxer rawvideo -rawvideo w=640:h=480:format=yuy2

On Pi3:
1. If not installed already, install mplayer
$ sudo apt-get install mplayer
2. Create a pipe file
$ mkfifo video.fifo
3. Call tcpdump to listen to specified port
$ sudo tcpdump -i eth0 udp port 5000 -w video.fifo
Note: Netcat will not accept packets because it requires a connection,
even when solely listening for udp packets, when the datagram size is over
1500 bytes.
4. Use mplayer to open video
$ mplayer video.fifo -demuxer rawvideo -rawvideo w=640:h=480:format=yuy2
Last modified 5 years ago Last modified on 08/10/16 09:22:23

Attachments (7)

Download all attachments as: .zip