2

I'm trying to create a topology in mininet, however if there are two paths from a hosts trough different switches, the hosts can't connect to each other.

Am I missing some sort of routing configuration? DO I have to manualy create paths and routing? I assumed the controllers did that on their own.

The code I'm using is re-purposed from the examples folder, the commented code is what prevents the hosts from reaching to each other:

#!/usr/bin/python

"""
This example creates a multi-controller network from semi-scratch by
using the net.add*() API and manually starting the switches and controllers.

This is the "mid-level" API, which is an alternative to the "high-level"
Topo() API which supports parametrized topology classes.

Note that one could also create a custom switch class and pass it into
the Mininet() constructor.
"""


from mininet.net import Mininet
from mininet.node import Controller, OVSSwitch
from mininet.cli import CLI
from mininet.log import setLogLevel, info

def multiControllerNet():
    "Create a network from semi-scratch with multiple controllers."

    net = Mininet( controller=Controller, switch=OVSSwitch )

    info( "*** Creating (reference) controllers\n" )
    c1 = net.addController( 'c1', port=6633 )

    info( "*** Creating switches\n" )
    sw1 = net.addSwitch('s1')
    sw2 = net.addSwitch('s2')
    sw3 = net.addSwitch('s3')
    sw4 = net.addSwitch('s4')
    sw5 = net.addSwitch('s5')

    info( "*** Creating hosts\n" )
    cl1 = net.addHost('c1')
    cl2 = net.addHost('c2')

    arca = net.addHost('arca')

    ag1 = net.addHost('ag1')
    ag2 = net.addHost('ag2')
    ag3 = net.addHost('ag3')

    tr1 = net.addHost('tr1')
    tr2 = net.addHost('tr2')

    info( "*** Creating links\n" )
    net.addLink(cl1, sw1)
    net.addLink(cl2, sw3)
    net.addLink(arca, sw5)
    # traffic generators                
    net.addLink(tr1, sw1)
    net.addLink(tr2, sw5)
    # aggregators
    net.addLink(ag1, sw2)
    net.addLink(ag2, sw2)
    net.addLink(ag2, sw4)
    net.addLink(ag3, sw4)

    net.addLink(sw1, tr1)
    net.addLink(sw5, tr2)

    net.addLink(sw1, sw2)
    #net.addLink(sw1, sw3)
    net.addLink(sw2, sw3)
    net.addLink(sw3, sw4)
    #net.addLink(sw3, sw5)
    net.addLink(sw4, sw5)

    info( "*** Starting network\n" )
    net.build()
    c1.start()
    sw1.start( [ c1 ] )
    sw2.start( [ c1 ] )
    sw3.start( [ c1 ] )
    sw4.start( [ c1 ] )
    sw5.start( [ c1 ] )

    info( "*** Testing network\n" )
    net.pingAll()

    info( "*** Starting apps\n" )

    info( "*** Running CLI\n" )
    CLI( net )

    info( "*** Stopping network\n" )
    net.stop()

if __name__ == '__main__':
    setLogLevel( 'info' )  # for CLI output
    multiControllerNet()

What am I missing here?

localhost
  • 845
  • 3
  • 14
  • 32
  • 1
    I don't know anything about mininet, but in a real world network you've made a loop and your network is suffering a broadcast storm which is maxing out your links with ARP (I think) traffic and blocking legitimate traffic. You would need to configure Rapid Spanning-Tree Protocol (RSTP) or shut some of the links manually, so only one is connected. Potentially mininet suffers in some way from network loops .. or simulates suffering .. – TessellatingHeckler Sep 28 '17 at 00:10
  • Yeah, there you are - https://github.com/mininet/mininet/wiki/FAQ#ethernet-loops - it's in the FAQ – TessellatingHeckler Sep 28 '17 at 00:11

2 Answers2

2

This happens because Mininet does not ideally support loops in the network emulation. Read this link about Spanning Tree Algorithm in order to overcome this problem. Also see here.

Marievi
  • 4,951
  • 1
  • 16
  • 33
  • The docs say I should use `--switch lxbr,stp=1`, do you know how to enable STP in a python script? – localhost Oct 03 '17 at 17:33
  • Have you tried `--switch lxbr,stp=1` as a parameter to the command opening your Mininet topology? – Marievi Oct 04 '17 at 05:29
  • I just run `./topology.py`, does mininet that runs in a python script read the cmd parameters? – localhost Oct 04 '17 at 22:49
  • See this command : `sudo mn --custom ~/mininet/custom/topo-2sw-2host.py --topo mytopo` from http://mininet.org/walkthrough/. You can adjust it to add `--switch lxbr,stp=1` in the parameters. – Marievi Oct 05 '17 at 06:06
  • @localhost I am glad that my answer helped you! I would also be glad if you could upvote me :) – Marievi Oct 20 '17 at 05:57
0

stp can be enabled via python from OVSSwitch objects:

http://mininet.org/api/classmininet_1_1node_1_1OVSSwitch.html

For example:

s1 = net.addSwitch( 's1', failmode='standalone', stp=True)

mep53
  • 1