In the given topology only s3 and s4 are OFSwitches and others Non-OF switches. For the Non-OF switches I have created a L2_switch subclass under the superclass Switch, which similar to LinuxBridge(nodelib.py) with stp enabled.
h2
|
s7
|
s3
/ \
/ \
h1--------s1-----------s2 s5----------h3
\ /
\ /
s4
|
s6
|
h4
Here only h2 and h4 are able to ping each other. Other hosts are unable to ping. why?
But changing the s2 and s5 to OF-Switch all the hosts are able to ping each other. why?
Here is my code:
def myNetwork():
net = Mininet( topo=None,
listenPort=6633,
build=False,
ipBase='10.0.0.0/8')
info( '*** Adding controller\n' )
c0=net.addController(name='c0',
controller=RemoteController,
ip='192.168.56.104',
protocol='tcp',
port=6633)
info( '*** Add switches\n')
s3 = net.addSwitch('s3', cls=OVSKernelSwitch)
s5 = net.addSwitch('s5', cls=L2_switch) #OVSKernelSwitch)
s7 = net.addSwitch('s7', cls=L2_switch) #OVSKernelSwitch)
s2 = net.addSwitch('s2', cls=L2_switch) #OVSKernelSwitch)
s4 = net.addSwitch('s4', cls=OVSKernelSwitch)
s1 = net.addSwitch('s1', cls=L2_switch) #OVSKernelSwitch)
s6 = net.addSwitch('s6', cls=L2_switch) #OVSKernelSwitch)
info( '*** Add hosts\n')
h3 = net.addHost('h3', cls=Host, ip='10.0.0.3', defaultRoute=None)
h4 = net.addHost('h4', cls=Host, ip='10.0.0.4', defaultRoute=None)
h2 = net.addHost('h2', cls=Host, ip='10.0.0.2', defaultRoute=None)
h1 = net.addHost('h1', cls=Host, ip='10.0.0.1', defaultRoute=None)
info( '*** Add links\n')
net.addLink(h1, s1)
net.addLink(s1, s2)
net.addLink(s2, s3)
net.addLink(s7, s3)
net.addLink(h2, s7)
net.addLink(s3, s5)
net.addLink(s4, s5)
net.addLink(s4, s6)
net.addLink(s6, h4)
net.addLink(s5, h3)
net.addLink(s2, s4)
info( '*** Starting network\n')
net.build()
info( '*** Starting controllers\n')
for controller in net.controllers:
controller.start()
info( '*** Starting switches\n')
net.get('s3').start([c0])
net.get('s5').start([])
net.get('s7').start([])
net.get('s2').start([])
net.get('s4').start([c0])
net.get('s1').start([])
net.get('s6').start([])
info( '*** Post configure switches and hosts\n')
CLI(net)
net.stop()
if __name__ == '__main__':
setLogLevel( 'info' )
myNetwork()
I had this problem too! The solution is using Spanning tree module in controller. If you use Ryu controller, this module is in path:
ryu/ryu/app/simple_switch_stp_13.py
.But pay attention! This module is implemented with 3 switch, but you have 6 switch. Therefore, you should add 3 switch into this module and change the configs!