Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / DevOps

Build Your Own SDN Network

5.00/5 (5 votes)
10 Dec 2015CPOL1 min read 24.7K  
Get started with your own SDN (Software Defined Network) simulation network

Introduction

This tip is for helping you build your own network and SDN simulation system. So you could apply your own applications on SDN network to redistribute network resources and to control the whole net. SDN is an innovation of network structure. It spilts the data panel and control panel. Due to this, the network administrators could do their job easier and more efficiently. There will be another post that tells about SDN in detail. And this tip would focus on how to build an SDN network.

Needed Tools and Software

For fulfilling the requirements of SDN environment, we need tools and software which are listed as follows:

  1. Ubuntu System (recommended) or Windows System
  2. JDK1.7 or higher versions
  3. "Ant"
  4. Mininet (Get sources codes on github)
  5. Floodlight Controller(Get sources codes on github)

Start Floodlight

Step 1. Rebuild Floodlight

Check out if it was built successfully. Make sure you have finished this step and then you can go on.

Image 1

Step 2. Start Floodlight

Image 2

If you have started it successfully, you could see the following debug information. Also some log information.

Image 3

Image 4

The Log and debug information show modules which are founded and started. It also shows switches which are connected to this Controller using TCP connection.

Start Mininet

Step 1. INSTALL and Get Sources Code

git clone git://github.com/mininet/mininet

mininet/util/install.sh[options]

options: -a (install all) -nfv(install openflow switches)

Step 2. Write Your Own Network Topology

Taking my topology for example. Mininet topology codes are using python language. And I set Controller IP address 172.23.22.75 (floodlight Controller) This Mininet Topology file was named TESY.py.

Python
#!/usr/bin/python

from mininet.net import Mininet
from mininet.node import Controller, RemoteController, OVSController
from mininet.node import CPULimitedHost, Host, Node
from mininet.node import OVSKernelSwitch, UserSwitch
from mininet.node import IVSSwitch
from mininet.cli import CLI
from mininet.log import setLogLevel, info
from mininet.link import TCLink, Intf
from subprocess import call

def myNetwork():

    net = Mininet( topo=None,
                   build=False,
                   ipBase='172.23.0.0/16')

    info( '*** Adding controller\n' )
    c0=net.addController(name='c0',
                      controller=RemoteController,
                      ip='172.23.22.75',
                      protocol='tcp',
                      port=6633)

    info( '*** Add switches\n')
    s1 = net.addSwitch('s1', cls=OVSKernelSwitch)
    s3 = net.addSwitch('s3', cls=OVSKernelSwitch)
    s2 = net.addSwitch('s2', cls=OVSKernelSwitch)

    info( '*** Add hosts\n')
    h2 = net.addHost('h2', cls=Host, ip='172.23.22.167', defaultRoute=None)
    h1 = net.addHost('h1', cls=Host, ip='172.23.22.168', defaultRoute=None)

    info( '*** Add links\n')
    net.addLink(h1, s2)
    net.addLink(s2, s3)
    net.addLink(h2, s3)
    net.addLink(s3, s1)
    net.addLink(s2, s1)

    info( '*** Starting network\n')
    net.build()
    info( '*** Starting controllers\n')
    for controller in net.controllers:
        controller.start()

    info( '*** Starting switches\n')
    net.get('s1').start([c0])
    net.get('s3').start([c0])
    net.get('s2').start([c0])

    info( '*** Post configure switches and hosts\n')

    CLI(net)
    net.stop()

if __name__ == '__main__':
    setLogLevel( 'info' )
    myNetwork()

Step 3. Start mininet

Image 5

Ping Test to check the link states.

Image 6

View Network Topology on Floodlight Controller

Image 7

Topology Graph

Image 8

Any Comments or Suggestions would be Embraced

Please leave your messages and comments.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)