A host with Two Interfaces




[Script] Computer 1 has two interfaces.




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' )

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


    print "*** Creating links"

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

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

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

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

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

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

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


    print "*** Starting network"



    s4.start( [c7] )

    s5.start( [c7] )


    print "*** Running CLI"

    CLI( net )


    print "*** Stopping network"



if __name__ == '__main__':

    setLogLevel( 'info' )




[Run the script]

1.      Open an terminal to run the pox controller


2.      Open another terminal to run the script


Check the interfaces for h1


H1 ping H2


H1 ping H3


Check the routing tables for H1


Dr. Chih-Heng Ke (smallko@gmail.com)

Department of Computer Science and Information Engineering,

National Quemoy University, Kinmen, Taiwan