【问题标题】:mininet: Dynamically created Host cannot ping other Hosts, but Host can ping Switchmininet:动态创建的Host不能ping其他Host,但是Host可以ping Switch
【发布时间】:2021-11-14 16:59:13
【问题描述】:

我正在尝试在 Mininet 启动后动态添加主机和链接。 我正在使用 py net.addHost,addLink 命令。

使用标准线性,3拓扑

代码是:

py net.addHost('h4')
py net.addLink(h4,s3)
py h4.setMAC("00:30:00:00:30:10")
py h4.configDefault(defaultRoute = h4.defaultIntf())

最后一条语句确保 h4 具有有效的 IP 地址。 在 h4 上运行 ifconfig:

mininet> h4 ifconfig
h4-eth0   Link encap:Ethernet  HWaddr 00:30:00:00:30:10  
          inet addr:10.0.0.4  Bcast:10.255.255.255  Mask:255.0.0.0
          inet6 addr: fe80::230:ff:fe00:3010/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:25 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:4001 (4.0 KB)  TX bytes:1296 (1.2 KB)

从 h1 ping h4(静态拓扑的一部分):

mininet> h1 ping h4
PING 10.0.0.4 (10.0.0.4) 56(84) bytes of data.
From 10.0.0.1 icmp_seq=1 Destination Host Unreachable
From 10.0.0.1 icmp_seq=2 Destination Host Unreachable
From 10.0.0.1 icmp_seq=3 Destination Host Unreachable

静态拓扑节点(h1 和 h3)之间的 Ping:

mininet> h1 ping h3
PING 10.0.0.3 (10.0.0.3) 56(84) bytes of data.
64 bytes from 10.0.0.3: icmp_seq=1 ttl=64 time=2.14 ms
64 bytes from 10.0.0.3: icmp_seq=2 ttl=64 time=0.141 ms

任何帮助将不胜感激!

【问题讨论】:

    标签: python mininet


    【解决方案1】:

    你快到了!您需要做的就是:

    mininet> py s1.attach('s3-eth3')
    

    然后:

    mininet> h1 ping h4
    PING 10.0.0.4 (10.0.0.4) 56(84) bytes of data.
    64 bytes from 10.0.0.4: icmp_req=1 ttl=64 time=2.99 ms
    64 bytes from 10.0.0.4: icmp_req=2 ttl=64 time=0.113 ms
    

    找到答案here

    【讨论】:

      【解决方案2】:

      尝试将此标志添加到您的“mn”命令中,以使其使用 openflow v1.3。它可能默认使用 v1.0。

      --switch ovsk,protocols=OpenFlow13
      

      即在运行 mininet 时附加上述行:

       sudo mn --switch ovsk,protocols=OpenFlow13
      

      对于自定义拓扑:

      sudo mn --custom ~/<filename>.py --topo mytopo --link tc --switch ovsk,protocols=OpenFlow13
      

      【讨论】:

        猜你喜欢
        • 2016-02-16
        • 2019-06-09
        • 1970-01-01
        • 2018-12-21
        • 2013-04-19
        • 2022-11-16
        • 1970-01-01
        • 1970-01-01
        • 2019-12-04
        相关资源
        最近更新 更多