Let's build our own Software Defined Network!

In Part 3 of this series we are going to build an actual Software Defined Network and see how it works. If you haven't read Part 1 and Part 2, I'd suggest doing that first.

The first thing we need is an OpenFlow controller. Our favourite and the one we use for all our testing and development is RYU. Written in Python, it is easy to setup and has extensive documentation with heaps of bundled applications. You have a couple of options on how to run it, if you are using Linux or Mac OSX you can install directly together with Python on to your computer. The other approach is to us a VM of which there are many available including this great Tutorial VM. If you would like an affordable standalone device then the Raspberry Pi makes an awesome dedicated controller companion for the Zodiac FX, a setup we refer to as the "PiZod".

Once you have your controller installed you need to connect the Zodiac FX and create your first SDN. In the Zodiac FX's default settings Port 4 (that's the one in front of the ERASE jumper) is a Non-OpenFlow port that is used to communicate to the controller so go ahead an plug your controller in to that port. If you are using a VM remember you will need to assign a physical port on your computer to the VM so it can connect to the Zodiac FX. The default IP address it expects the controller to have is 10.0.1.8, so either set that as the controller's IP address or change the setting on the Zodiac FX to the address you have assigned to the controller (make sure you save and restart after any config changes). Let's start with one of the applications that comes with the standard RYU install called simple_switch_13.py which as the name suggests creates a simple layer 2 switch using OpenFlow 1.3. Basically the first thing it does is create a flow to send all traffic to the controller then when is sees a packet from an individual device it creates a flow to send all traffic for that device out of the port it is connected to. After a while it will have created a set of flows for all the device connected to the Zodiac FX which means no more traffic is sent to the controller directly (Packet In), very similar to how the MAC table works on a normal Layer 2 switch. To start the Simple Switch application you can run the following command in RYU:

PYTHONPATH=. ryu-manager --verbose /Library/Python/2.7/site-packages/ryu/app/simple_switch_13_port.py

If everything is connected correctly you should see the Zodiac FX connect to RYU in the debug output but nothing else will happen because there is no traffic yet. So now let's connect some devices to the Zodiac FX, maybe start with something like a PC on one port and another PC (or internet connection) on one of the other ports. When traffic begins to flow between the devices you will see "Packet In" messages on the RYU output and you can also look at the actual flows that are on the Zodiac FX either by going to it's web UI (http://ip_address_of_ZodiacFX/ from the controller) or on the CLI with the "show flows" command in the OpenFlow context (check out the User Guide for a full list of commands).

Definitely go and have a look at some of the setup tutorials on our YouTube channel and if you have any questions please post them on our Forum.

 


Share this post