mininet:动态创建的主机无法ping其他主机,但主机可以ping通

时间:2016-11-18 13:10:33

标签: python mininet

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

使用标准线性,3拓扑

代码是:

update system.local  set gossip_generation = 1479472176 where key='local';

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

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

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

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和h3)之间进行Ping:

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

任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:0)

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

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

相关问题