Controller 1 is running on 192.168.200.22
Controller 2 is running on the same machine that mininet is running
============================================
#!/usr/bin/python
from mininet.net import Mininet
from mininet.node import Controller, OVSKernelSwitch, RemoteController
from mininet.cli import CLI
from mininet.log import setLogLevel, info
def emptyNet():
net = Mininet(controller=RemoteController, switch=OVSKernelSwitch)
c1 = net.addController('c1', controller=RemoteController, ip="192.168.200.22", port=6633)
c2 = net.addController('c2', controller=RemoteController, ip="127.0.0.1", port=6633)
h1 = net.addHost( 'h1', ip='10.0.0.1' )
h2 = net.addHost( 'h2', ip='10.0.0.2' )
h3 = net.addHost( 'h3', ip='10.0.0.3' )
h4 = net.addHost( 'h4', ip='10.0.0.4' )
s1 = net.addSwitch( 's1' )
s2 = net.addSwitch( 's2' )
s1.linkTo( h1 )
s1.linkTo( h2 )
s1.linkTo( s2 )
s2.linkTo( h3 )
s2.linkTo( h4 )
net.build()
c1.start()
c2.start()
s1.start([c1,c2])
s2.start([c1,c2])
net.start()
net.staticArp()
CLI( net )
net.stop()
if __name__ == '__main__':
setLogLevel( 'info' )
emptyNet()
Controller 2 is running on the same machine that mininet is running
============================================
#!/usr/bin/python
from mininet.net import Mininet
from mininet.node import Controller, OVSKernelSwitch, RemoteController
from mininet.cli import CLI
from mininet.log import setLogLevel, info
def emptyNet():
net = Mininet(controller=RemoteController, switch=OVSKernelSwitch)
c1 = net.addController('c1', controller=RemoteController, ip="192.168.200.22", port=6633)
c2 = net.addController('c2', controller=RemoteController, ip="127.0.0.1", port=6633)
h1 = net.addHost( 'h1', ip='10.0.0.1' )
h2 = net.addHost( 'h2', ip='10.0.0.2' )
h3 = net.addHost( 'h3', ip='10.0.0.3' )
h4 = net.addHost( 'h4', ip='10.0.0.4' )
s1 = net.addSwitch( 's1' )
s2 = net.addSwitch( 's2' )
s1.linkTo( h1 )
s1.linkTo( h2 )
s1.linkTo( s2 )
s2.linkTo( h3 )
s2.linkTo( h4 )
net.build()
c1.start()
c2.start()
s1.start([c1,c2])
s2.start([c1,c2])
net.start()
net.staticArp()
CLI( net )
net.stop()
if __name__ == '__main__':
setLogLevel( 'info' )
emptyNet()
I dont understand. So which swith connect to controller 1 and 2? I see both of the controllers connect to the both switches?
ReplyDeleteeach switch is connected to both controller. is there any way to make them separate? two separate network that are connected to each other by link between controllers?
ReplyDeleteHello
ReplyDeleteCan you please tell me what c1.start() does.
Also i m using RYU controller which is already running listening for any incoming requests
do i need to use c1.start()
how do i execute this script
ReplyDelete