0% found this document useful (0 votes)
398 views24 pages

SDN Lab Manual

The document discusses setting up an SDN environment in Mininet and configuring a switch using the POX controller to provide firewall functionality. It covers installing Mininet and POX, creating topologies in Mininet, connecting Mininet and POX, and recognizing flows with the controller.

Uploaded by

Ram Aher
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
398 views24 pages

SDN Lab Manual

The document discusses setting up an SDN environment in Mininet and configuring a switch using the POX controller to provide firewall functionality. It covers installing Mininet and POX, creating topologies in Mininet, connecting Mininet and POX, and recognizing flows with the controller.

Uploaded by

Ram Aher
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Assignment 1

Title: Basic Mininet Commands and topology

Problem Statement:
Prepare setup for Mininet network emulation environment with the help of Virtualbox and
Mininet. Demonstrate the basic commands in Mininet and emulate different custom network
topology (Simple, Linear, and Tree).View flow tables.

Objectives:

1. To install Mininet with the help on VirtualBox.

2. To learn basic Mininet commands

3. To understand the working of different types of network topologies.


Tools Required:

Software: VirtualBox, Mininet

Theory:
Mininet is a virtual testbed enabling the development and testing of network tools and protocols. With a single
command, Mininet can create a realistic virtual network on any type of machine (Virtual Machine (VM), cloud-
hosted, or native). Therefore, it provides an inexpensive solution and streamlined development running in line
with production networks1.
Mininet offers the following features:
• Fast prototyping for new networking protocols.
• Simplified testing for complex topologies without the need of buying expensive hardware.
• Realistic execution as it runs real code on the Unix and Linux kernels.
• Open-source environment backed by a large community contributing extensive documentation.
Mininet is useful for development, teaching, and research as it is easy to customize and interact with it through
the CLI or the GUI. Mininet was originally designed to experiment with OpenFlow2 and Software-Defined
Networking (SDN)3. This lab, however, only focuses on emulating a simple network environment without
SDN-based devices. Mininet’s logical nodes can be connected into networks. These nodes are sometimes called
containers, or more accurately, network namespaces. Containers consume sufficiently fewer resources that
networks of over a thousand nodes have created, running on a single laptop. A Mininet container is a process
(or group of processes) that no longer has access to all the host system’s native network interfaces. Containers
are then assigned virtual Ethernet interfaces, which are connected to other containers through a virtual switch4.
Mininet connects a host and a switch using a virtual Ethernet (veth) link. The veth link is analogous to a wire
connecting two virtual interfaces, as
illustrated below.

Setting up Mininet Environment:


Follow the steps to setup Mininet network simulator.

Methods to Install Mininet:


1. Install Mininet as a virtual machine provided having a virtual box installed already
2. By installing it directly from the source.
3. By installing it from the package.
4. By upgrading the currently existing Mininet.

Basic Mininet Commands and Output:


1)To start a minimal(simple) topology:
Command: sudo mn
Now, while you are at the mininet CLI you can send commands to hosts. Start a ping from h1 to h2 using the
following command. You should be seing replies from 10.0.0.2:
2) To display the list of Mininet CLI commands and examples on their usage, type the
following command.
Command: help
3) To display the available nodes, type the following command
Command: nodes

4) It is useful sometimes to display the links between the devices in Mininet to


understand the topology. Issue the command shown below to see the available links.
Command: net

5) On the CLI, type the command shown below. This command tests the connectivity
between host h1 and host h2.
Command: h1 ping 10.0.0.2
6) Stop the emulation by typing the following command
Command:exit
Emulate different custom network topology(Simple, Linear, and Tree)
Creating linear topology using Mininet
It contains n-number of switches having n-number of hosts linked to switches in linear order
Command: sudo mn –topo=linear,4

Creating tree topology using Mininet


Tree: It contains n-level of switches and hosts are attached to lower level switches
Command: sudo mn –topo=tree,2,2

Conclusion: Thus we have learned how to install mininet, use basic mininet command and create simple
,linear and tree topology using Mininet commnds.
LAB Assignment 2

Title: POX and Floodlight Controller


Problem Statement:\

After studying open source POX and Floodlight controller, Install controller and run custom topology using
remote controller like POX and floodlight controller. Recognize inserted flows by controllers.

Objectives:

1. Learn how to use open source POX

2. Learn the basic commands and flows of floodlight controller.


Tools Required:

Software: VirtualBox, Mininet

Theory:
POX:
POX is an OpenFlow controller which now is also extending to function as an OpenFlow switch. A networking
software platform, it is written in Python and can run on any platform that has Python 2.7 and above installed on
it. The booting process for POX requires pox.py file that takes a list of module names on command line, locates
those modules and calls their launch function to put them through their up state for functioning.
• POX is an OpenFlow controller which now is also extending to function as an OpenFlow switch. A
networking software platform, it is written in Python and can run on any platform that has Python 2.7
and above installed on it.
• The booting process for POX requires pox.py file that takes a list of module names on command line,
locates those modules and calls their launch function to put them through their up state for functioning.
• Features of POX:

• ✓ It is a python based OpenFlow interface.

• ✓ It has reusable sample components for many services like path selection, topology discovery etc.

• ✓ It works on major platforms like Windows, Linux, Mac OS.


FLOODLIGHT:
Floodlight is a popular SDN controller from Big Switch Networks. Based on Beacon, it is a Java based
OpenFlow supporting controller.
Step 1: Starting POX Comtroller
Generally, POX comes installed along with Mininet, but we can also install POX on another Host.
We first pull the POX repository $ sudo git clone https://github.com/noxrepo/pox
Then we install POXDesk which is a web-based GUI for POX and makes it convenient to monitor the switches
and the network.
Steps for the same are:
$ cd pox $ sudo git checkout betta (we’re choosing to branch out to betta)
$ cd ext
$ sudo git clone
https://github.com/MurphyMc/poxdesk
$ cd poxdesk
$ sudo wget
http://downloads.sourceforge.net/qooxdoo-2.0.2 sdk.zip
$ sudo unzip qooxdoo-2.0.2-sdk qx
$ cd poxdesk
$ sudo ./generate.py
$ cd ../ ../ ../
$ sudo ./pox.py samples.pretty_log web messenger messenger.log_service messenger.ajax_trasnsport
openflow.of_service poxdesk
Now we can access POX controller on POXDesk at
http://127.0.0.1:8000/poxdesk/source

Step 2: Connecting Mininet and POX:


POX uses the forwarding.l2_learning component in learning like a layer 2 device i.e. switch. We run POX by
running pox.py script and specifying the ‘forwarding.l2_learning’ component.
$ sudo ~/pox/pox.py forwarding.l2_learning
Next, we can either use Miniedit, which is a graphical component for building the topology or use the Mininet
command line to build up a topology to work with. Another method could be writing a script in python that
could implement the topology along with routes and the scenario that needs to be implemented.

Miniedit version:

$ sudo ~/mininet/examples/miniedit.py
And then we can build up a topology. In this scenario, I’ve built up a 3 switch (s1, s2 and s3), one controller(c0) and four
host (h1, h2, h3, h4) tree structure as topology.

We edit preferences in the Miniedit so we can access and make changes to topology from the CLI. We can also select the
version of switch we wish to use.

✓ Next, we RUN the topology.


We now need to start the POX controller.

$ sudo ~/pox/pox.py forwarding.l2_pairs info.packet_dump samples.pretty_log log.level –DEBUG

This starts to show the logs as the controller starts and connects to the switches we set in the topology

We start Wireshark to see what packets are being captured in terms of traffic.
Conclusion:

Thus we learned to use install POX controller and run custom topology using POX controller and to recognize flows by
controller using wireshark.
ASSIGNMENT No.3

Title: Configuration of switch in SDN environment


Problem Statement:

Create a SDN environment on Mininet and configure a switch to provide a firewall functionality using POX
controller.

Objectives:

1. Learn how to create SDN environment on mininet

2. Learn the configuration of switch using POX controller

Tools Required:

Software: VirtualBox, Mininet

Theory:
Mininet VM:
Mininet is a network emulator which runs a collection of end-hosts, switches, routers, and links on a single
Linux kernel. It uses lightweight virtualization to make a single system look like a complete network, running
the same kernel, system, and user code.
• Software-defined network is a combination of an SDN controller and underlay switches and routers
managed by the controller.
• As you already know, switches are physical devices with multiple Ethernet ports, from 10 MBps to 100
GBps.

• An SDN switch is a software program or hardware device that forwards packets in an SDN
environment. It must support SDN protocols. The earliest as well as the most commonly known SDN
protocol is OpenFlow. Therefore, an SDN switch is often called OpenFlow switch as well. There are
also some other SDN protocols that are developed by SDN switch vendors, such as OpFlex, NETCONF,
BGP (Border Gateway Protocol), XMPP (Extensible Messaging and Presence Protocol), etc.

• Using the earliest protocol defined in the SDN environment, OpenFlow switch has evolved from
OpenFlow v1.0. in 2011. OpenFlow v1.5.1 is the latest OpenFlow version that has support from switch
vendors.

• Whether it is a virtual (hypervisor-based) switch or a physical switch, an SDN switch only keeps the
data plane (packet forwarding) in itself. The control plane (high-level routing) is decoupled from the
SDN switch hardware but implemented in the SDN controller (an application running on the server or
somewhere), which lies between network devices and applications. Every SDN switch in the SDN
model is programmable by the SDN controller through SDN protocols. And communications between
applications and devices are achieved by going through the SDN controller.
• An SDN switch consists of ports and tables. Packets arrive and leave the switch through ports. Tables
consist of rows containing a classifier and set of actions. When an SDN switch receives a packet which
does not have a match row in the table, it will communicate with the SDN controller and ask what to do
with this packet. The controller can download a flow to the switch, which includes the first classifier that
best matches the packet and the actions. Actions administer the treatment of the packet, which can be
forwarding it to the port(s), encapsulating and forwarding it to the controller, dropping the packet, or
sending it to the normal processing pipeline. Once the flow is downloaded to the switch table, it will
switch similar packets at wire speed. This automated process makes it easier to integrate and manage
different applications.
• https://github.com/mininet/openflow-tutorial#readme
• Build and emulate a network in Mininet using the GUI. In this section, you will use the application
MiniEdit to deploy the topology illustrated below. MiniEdit is a simple GUI network editor for Mininet.
• MiniEdit will start, as illustrated below.

• To build the topology illustrated in Figure 12, two hosts and one switch must be deployed. Deploy
these devices in MiniEdit, as shown below.

• Configure the IP addresses of host h1 and host h2. Host h1’s IP address is 10.0.0.1/8 and host h2’s IP
address is 10.0.0.2/8. A host can be configured by holding the right click and selecting properties on the
device. For example, host h2 is assigned the IP address 10.0.0.2/8 in the figure below
• Open a terminal on host h1 by holding the right click on host h1 and selecting Terminal. This opens a
terminal on host h1 and allows the execution of commands on the host h1. Repeat the procedure on host
h2.

• On host h1’s terminal, type the command shown below to display its assigned IP addresses. The
interface h1-eth0 at host h1 should be configured with the IP address 10.0.0.1 and subnet mask
255.0.0.0.
• Repeat Step 3 on host h2. Its interface h2-eth0 should be configured with IP address 10.0.0.2 and subnet
mask 255.0.0.0.
ASSIGNMENT NO 4

Title: Building and Configuring Router


Problem Statement:

Using Mininet as an Emulator and POX controller, build your own internet router. Write simple outer
with a static routing table. The router will receive raw Ethernet frames and process the packet
forwarding them to correct outgoing interface. You must check the Ethernet frames are received and
the forwarding logic is created so packets go to the correct interface.
Ref:
Simple Router - mininet/mininet GitHub Wiki (github-wiki-see.page)
Objectives:

1. Learn to construct a learning switch that optimally forwards packets based on link layer headers

2. Learn to determine the matching route table entry for a given IP address

3. Learn to develop a router that updates and forwards packets based on network layer headers

Tools Required:

Software: VirtualBox, Mininet

Theory:
The router’s most fundamental task when it receives a packet is to determine whether the packet should be
forwarded out one of its interfaces or if the packet needs some exception processing. In the former, normal case,
the layer three destination address in the packet header is used to determine over which output port the packet
should be forwarded. Unless the destination is directly attached to this router, the router does not need to know
exactly where in the network the host is located; it only needs to know the next-hop router to which it should
forward the packet. There may be large numbers of hosts that reside on the same destination network, and all of
these hosts will share the same entry in the router’s routing table. This is a table of layer three networks and
sometimes layer three host addresses, not atable of just layer two destination host addresses, as is the case with
the layer two forwarding table.
The Routing Information Protocol (RIP) is a comparatively simple routing protocol that was widely
deployed. Each router in the RIP-controlled routing domain periodically broadcasts its entire routing table on all
of its interfaces. These broadcasts include the hop count from the broadcasting router to each reachable
network. The weight of each hop can be tailored to accommodate relevant differences between the hops, such as
link speed. Neighboring routers can integrate this reachability and hop-count information into their own routing
tables, which will in turn be propagated to their neighbors. This propagation pervades the entire routing domain
or autonomous the AS to compute the shortest path to any destination within that AS. In a stable network,
eventually all the routing tables in that routing domain will converge, and the hop-count information can be
used to determine a least-cost route to reach any network in that domain.
RIP is a distance-vector protocol, where by each router uses the weighted hop count over one interface
as its distance to that destination network and is able to select the best next-hop router as the one presenting the
least total distance to the destination. RIP does not need to have a complete picture of the network topology in
order to make this distance-vector routing computation.
Implementation:
In the previous assignment, We loaded a topology that consists in two networks directly connected to
router r1.

• In this topology two LANs, defined by switch s1 and switch s2 are connected to router r1. Initially,
host h1 and host h2 do not have connectivity thus, you will configure router r1’s interfaces in
order to establish connectivity between the two networks.

Step 1:
Click on the Run button to start the emulation. The emulation will start and the buttons of the MiniEdit panel
will gray out, indicating that they are currently disabled.
• Hold right-click on host h1 and select Terminal. This opens the terminal of host h1 and allows the
execution of commands on that host.
Step 2.
In host h1 terminal, type the command shown below to verify that the IP address was assigned successfully.
You will verify that host h1 has two interfaces, h1-eth0 configured with the IP address 192.168.1.10 and the
subnet mask 255.255.255.0 and, the loopback interface lo configured with the IP address 127.0.0.1
Step 3.
In host h1 terminal, type the command route to verify that the default gateway IP address is 192.168.1.1.
Step 4.
In order to verify host 2 default route, proceed similarly by repeating from step 1 to step 3 in host h2 terminal.
Similar results should be observed.

Configure router’s interface


Step 1.
In order to configure router r1, hold right-click on router r1 and select Terminal.

Step 2.
In this step, you will start zebra daemon, which is a multi-server routing software that provides TCP/IP based
routing protocols. The configuration will not be working if you do not enable zebra daemon initially. In order
to start the zebra, type the following command
Step 3.
After initializing zebra, vtysh should be started in order to provide all the CLI commands defined by the
daemons. To proceed, issue the following command:

Step 4.
Type the configure terminal command in the router r1 terminal to enter in configuration mode.
Step 5.
Type the interface r1-eth0 command in the router r1 terminal to configure interface r1- eth0
Type the ip address 192.168.1.1/24 command on router r1 terminal to configure the IP address of the interface
r1-eth0
Type the exit command exit from interface r1-eth0 configuration.
Type the following command on router r1 terminal to verify the routing information of router r1. It will be
showing all the directly connected networkss
Conclusion: Thus we have learned building internet router using Mininet as an Emulator and POX
controller.
ASSIGNMENT NO 5

Title: Emulate and manage a Data Center via a Cloud Network Controller
Problem Statement:

Emulate and manage a Data Center via a Cloud Network Controller: create a multi-rooted tree-like
(Clos) topology in Mininet to emulate a data center. Implement specific SDN applications on top of the
network controller in order to orchestrate multiple network tenants within a data center environment,
in the context of network virtualization and management.
Objectives:

1. Describe the interfaces exposed by SDN switches and SDN controllers for managing the flow of traffic
through the network

2. Make use of common tools for emulating an OpenFlow network, managing OpenFlow switches, and
generating test traffic

3. Create a basic SDN application for directing traffic along a specific path

Tools Required:

Software: VirtualBox, Mininet, POX OpenFlow controller

Theory:
Data center:
Data center networks typically have a tree-like topology. End-hosts connect to top-of-rack switches, which
form the leaves of the tree; one or more core switches form the root; and one or more layers of aggregation
switches form the middle of the tree. In a basic tree topology, each switch (except the core switch) has a single
parent switch. Additional switches and links may be added to construct more complex tree topologies (e.g., fat
tree) in an effort to improve fault tolerance or increase inter-rack bandwidth.
In general, network virtualization permits to share physical network resources so as to form diverse virtual
networks (slices) on top of the infrastructure: each of these slices has e.g., its dedicated bandwidth allocation,
broadcast domain, etc. This concept simplifies network management and increases the resource utilization of
the physical infrastructure, allowing a cloud provider to amortize the costs of the underlying network.
Mechanisms related to network virtualization are commonly used in data centers to orchestrate their multiple
applications - servers -tenants. SDN in general and OpenFlow in particular can be used to implement such
mechanisms

\
Implementation steps:

In this exercise, we use the POX OpenFlow controller [9] to implement our SDN network appli-
cations. The POX carp branch . We use the Discovery component of POX for dynamic topology discovery,
and the Python package NetworkX for graph-related operations, such as finding suitable paths along which to
route traffic within our network.
Step 1:

First task is to create a multi-rooted tree-like (Clos) topology in Mininet to emulate a data center as shown in figure.
Code : clos topo.py

Step 2:

Second task is to implement specific SDN applications on top of the network controller in order to orchestrate
multiple network tenants within a data center environment, in the context of network virtualization and
management.
Code: CloudNetController.py , the code relating to the SDN applications which will run over the controller, so
as to orchestrate the data center network

Run your code using the following command:

~/pox> ./pox.py openflow.discovery CloudNetController --firewall_capability=False


--migration_capability=False
Initiate the Mininet topology script, and wait a bit for the controller to connect to the switches.
The script will do an initial pingall as a sanity check.

sudo python clos_topo.py -c 2 -f 2

Now perform a pingall command in Mininet.

You might also like