Ring Topology




















Script created by VND - Visual Network Description (SDN version)


from mininet.net import Mininet

from mininet.node import Controller, RemoteController, OVSKernelSwitch, OVSLegacyKernelSwitch, UserSwitch

from mininet.cli import CLI

from mininet.log import setLogLevel

from mininet.link import Link, TCLink


def topology():

    "Create a network."

    net = Mininet( controller=RemoteController, link=TCLink, switch=OVSKernelSwitch )


    print "*** Creating nodes"

    h1 = net.addHost( 'h1', mac='00:00:00:00:00:01', ip='' )

    h2 = net.addHost( 'h2', mac='00:00:00:00:00:02', ip='' )

    h3 = net.addHost( 'h3', mac='00:00:00:00:00:03', ip='' )

    s4 = net.addSwitch( 's4', listenPort=6673, mac='00:00:00:00:00:04' )

    s5 = net.addSwitch( 's5', listenPort=6674, mac='00:00:00:00:00:05' )

    s6 = net.addSwitch( 's6', listenPort=6675, mac='00:00:00:00:00:06' )

    c7 = net.addController( 'c7', controller=RemoteController, ip='', port=6633 )


    print "*** Creating links"

    #net.addLink(s4, h3, 2, 0)

    Link(h3, s4, intfName1='h3-eth0')

    Link(h3, s6, intfName1='h3-eth1')

    #net.addLink(h1, s4, 0, 1)

    Link(h1, s4, intfName1='h1-eth0')

    Link(h1, s5, intfName1='h1-eth1')

    #net.addLink(s5, h2, 2, 0)

    Link(h2, s5, intfName1='h2-eth0')

    Link(h2, s6, intfName1='h2-eth1')

    #net.addLink(h1, s5, 0, 1)

    h1.cmd('ifconfig h1-eth1 netmask')

    h2.cmd('ifconfig h2-eth1 netmask')

    h3.cmd('ifconfig h3-eth1 netmask')

    h1.cmd("sudo echo 1 > /proc/sys/net/ipv4/ip_forward")

    h2.cmd("sudo echo 1 > /proc/sys/net/ipv4/ip_forward")

    h3.cmd("sudo echo 1 > /proc/sys/net/ipv4/ip_forward")

    print "*** Starting network"



    s4.start( [c7] )

    s5.start( [c7] )

    s6.start( [c7] )


    print "*** Running CLI"

    CLI( net )


    print "*** Stopping network"



if __name__ == '__main__':

    setLogLevel( 'info' )




1.      Open a terminal and run pox controller


2.      Open another terminal to run the script


3.      Open three terminals for h1, h2, and h3



4.      Set the ip tables for h1


5.      Ping tests for h1


6.      Set the ip tables for h2


7.      Set the ip tables for h3

8.      Ping tests for h2 and h3. (The similar results as step 5)


Dr. Chih-Heng Ke

Department of Computer Science and Information Engineering, National Quemoy University, Kinmen, Taiwan

Email: smallko@gmail.com / smallko@hotmail.com