Multiple subnets : 10.0.0.0 and 11.0.0.0
So use POX l3_learning module
s1 --------- s2
l l l l
h1 h2 h3 h4
==========================================
#!/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="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 )
s2.linkTo( h3 )
s2.linkTo( h4 )
s1.linkTo( s2 )
net.build()
c1.start()
s1.start([c1])
s2.start([c1])
CLI( net )
net.stop()
if __name__ == '__main__':
setLogLevel( 'info' )
emptyNet()
==============================================
When mininet is running add default routing
mininet > h1 route add -net default h1-eth0
mininet > h2 route add -net default h2-eth0
mininet > h3 route add -net default h3-eth0
mininet > h4 route add -net default h4-eth0
So use POX l3_learning module
s1 --------- s2
l l l l
h1 h2 h3 h4
==========================================
#!/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="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 )
s2.linkTo( h3 )
s2.linkTo( h4 )
s1.linkTo( s2 )
net.build()
c1.start()
s1.start([c1])
s2.start([c1])
CLI( net )
net.stop()
if __name__ == '__main__':
setLogLevel( 'info' )
emptyNet()
==============================================
When mininet is running add default routing
mininet > h1 route add -net default h1-eth0
mininet > h2 route add -net default h2-eth0
mininet > h3 route add -net default h3-eth0
mininet > h4 route add -net default h4-eth0
This comment has been removed by the author.
ReplyDeleteexcellent explanation, I served much, thank you. Only one doubt with vlans works the same? or other adjustments are made?
ReplyDelete