Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/330.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Mininet主机可以';无法使用主机之间的多个链接进行连接_Python_Mininet - Fatal编程技术网

Python Mininet主机可以';无法使用主机之间的多个链接进行连接

Python Mininet主机可以';无法使用主机之间的多个链接进行连接,python,mininet,Python,Mininet,我试图在mininet中创建一个拓扑,但是,如果有两条路径通过不同的交换机从一个主机连接到另一个主机,那么这些主机就无法相互连接 我是否缺少某种路由配置?我必须手动创建路径和布线吗?我以为控制员是自己干的 我使用的代码是从examples文件夹中重新设计的,注释代码是阻止主机相互联系的原因: #!/usr/bin/python """ This example creates a multi-controller network from semi-scratch by using the n

我试图在mininet中创建一个拓扑,但是,如果有两条路径通过不同的交换机从一个主机连接到另一个主机,那么这些主机就无法相互连接

我是否缺少某种路由配置?我必须手动创建路径和布线吗?我以为控制员是自己干的

我使用的代码是从examples文件夹中重新设计的,注释代码是阻止主机相互联系的原因:

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

我在这里遗漏了什么?

这是因为Mininet在网络仿真中并不理想地支持循环。阅读关于生成树算法以克服此问题。另请参见。

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

例如:


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

我对mininet一无所知,但在现实世界的网络中,你做了一个循环,你的网络正在遭受一场广播风暴,它使你的链接与ARP(我认为)流量最大化,并阻塞了合法流量。您需要配置快速生成树协议(RSTP)或手动关闭一些链接,以便只连接一个。mininet可能在某种程度上受到网络循环的影响。。或者模拟痛苦..是的,你在这里--在常见问题解答中,文档说我应该使用
--switch lxbr,stp=1
,你知道如何在python脚本中启用stp吗?你是否尝试过
--switch lxbr,stp=1
作为打开你的Mininet拓扑的命令的参数?我只是运行
/topology.py
,在python脚本中运行的mininet是否读取cmd参数?请参阅以下命令:
sudo mn--custom~/mininet/custom/topo-2sw-2host.py--topo mytopo
from。您可以将其调整为在参数中添加
--开关lxbr,stp=1
。@localhost我很高兴我的答案对您有所帮助!如果你能投票给我,我也会很高兴:)