循环中的微型网络主机之间的ICMP回显数据包被丢弃

时间:2018-12-04 20:55:25

标签: python mininet pox

我正在使用mininet在VirtualBox中构建自己的拓扑:

第一个带有mininet的VirtualBox 被用作控制器。我正在使用 POX 作为控制器(IP地址:192.168.57.3):

mininet@mininet-wm:~/pox$ python ./pox.py forwarding.l2_learning

带有mininet的第二个VirtualBox用于我自己的拓扑脚本:

#!/usr/bin/python

"""
This example shows how to create an empty Mininet object
(without a topology object) and add nodes to it manually.
"""

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

def emptyNet():

    "Create an empty network and add nodes to it."

    net = Mininet( controller=RemoteController )

    info( '*** Adding controller\n' )
    net.addController( 'c0', controller=RemoteController,ip="192.168.57.3",port=6633 )

    info( '*** Adding hosts\n' )
    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' )


    info( '*** Adding switch\n' )
    s1 = net.addSwitch( 's1' )
    s2 = net.addSwitch( 's2' )
    s3 = net.addSwitch( 's3' )

    info( '*** Creating links\n' )
    net.addLink( h1, s1 )
    net.addLink( s1, s2 )
    net.addLink( s2, s3 )
    net.addLink( s1, s3 )
    net.addLink( s3, h3 )
    net.addLink( s2, h2 )

    info( '*** Starting network\n')
    net.start()

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

    info( '*** Stopping network' )
    net.stop()

if __name__ == '__main__':
    setLogLevel( 'info' )
    emptyNet()

然后我启动 mytopology.py

mininet@mininet-wm:~/mininet/examples$ sudo python mytopology.py

控制器已连接,但所有ping均已删除.....

*** Ping: testing ping reachability
h1 -> X X
h2 -> X X
h3 -> X X
*** Results: 100% dropped (0/6 received)
mininet>

怎么了?请帮我。谢谢!

编辑:

在没有链接的情况下Ping成功,该链接不会使拓扑循环。 例如

  info( '*** Creating links\n' )
        net.addLink( h1, s1 )
        net.addLink( s1, s2 )
        net.addLink( s2, s3 )
        net.addLink( s3, h3 )
        net.addLink( s2, h2 )

因此您可以看到S1和S3之间的链接已删除。

2 个答案:

答案 0 :(得分:0)

我建议您尝试使用最小生成树协议进行l2_learning处理循环

答案 1 :(得分:0)

循环会创建广播风暴,没有诸如生成树之类的选项就无法处理广播风暴。您可以使用openflow.spanning_tree --no-flood --hold-down选项轻松使用具有循环的拓扑。