Mininet主机无法与主机之间的多个链接连接

问题描述 投票:1回答:2

我正在尝试在mininet中创建拓扑,但是,如果来自主机的两条路径通过不同的交换机,则这些主机将无法相互连接。

我是否缺少某种路由配置?我是否必须手动创建路径和路由?我以为控制器是自己做的。

我正在使用的代码从示例文件夹中重新使用,注释的代码阻止了主机之间的相互访问:

#!/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()

我在这里想念什么?

python mininet
2个回答
2
投票

之所以会这样,是因为Mininet在理想情况下不支持网络仿真中的循环。阅读有关生成树算法的this link,以解决此问题。另请参阅here


0
投票

stp可以通过OVSSwitch对象的python启用:

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

例如:

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

© www.soinside.com 2019 - 2024. All rights reserved.