[英]Mininet : How to make communicating two host between two switches
I'm making a simple script in python working with mininet. 我在python中使用mininet制作一个简单的脚本。 I want to make communicating two hosts (say h1 and h2) separated by two switches(say s1 and s2). 我想通过两个交换机(比如s1和s2)进行通信两个主机(比如说h1和h2)。 When h1 try to ping h2 ,the ARP resolution request for h2 IP address crosses the link between the two switches but doesn't reach the other host. 当h1尝试ping h2时,h2 IP地址的ARP解析请求会跨越两个交换机之间的链路,但不会到达其他主机。
This is the topology: 这是拓扑:
H1 ------------- S1 ------------- S2 ------------ H2 H1 ------------- S1 ------------- S2 ------------ H2
Ip H1 10.10.0.1/24 Ip H1 10.10.0.1/24
Mac H1 00:00:00:10:00:01 Mac H1 00:00:00:10:00:01
Ip H2 10.10.0.2/24 Ip H2 10.10.0.2/24
Mac H2 00:00:00:10:00:02 Mac H2 00:00:00:10:00:02
def networkTest():
net = Mininet( topo=None,
build=False )
s1 = net.addHost('s1', cls=Node)
s2 = net.addHost('s2', cls=Node)
h1 = net.addHost('h1', cls=Host, mac='00:00:10:10:00:01')
h2 = net.addHost('h2', cls=Host, mac='00:00:10:10:00:02')
Link(s1, h1, intfName1='s1-eth0')
Link(s2, h2, intfName1='s2-eth0')
Link(s1, s2, intfName1='s1-eth1')
net.build()
for controller in net.controllers:
controller.start()
h1.cmd('ip addr add 10.10.0.1/24 dev h1-eth0')
h1.cmd('ip link set h1-eth0 up')
h2.cmd('ip addr add 10.10.0.2/24 dev h2-eth0')
h2.cmd('ip link set h2-eth0 up')
s1.cmd('brctl addbr br0')
s1.cmd('brctl addif br0 s1-eth0')
s1.cmd('brctl addif br0 s1-eth1')
s1.cmd('ip link set br0 up')
s2.cmd('brctl addbr br1')
s2.cmd('brctl addif br1 s2-eth0')
s2.cmd('ip link set br1 up')
CLI(net)
net.stop()
Inside mininet CLI i open an xterm on h1 and try to ping h2 在mininet CLI里面我在h1上打开一个xterm并尝试ping h2
ping 10.10.0.2
but the answer is 但答案是
From 10.10.0.1 icmp_seq = 1 Destination Host Unreachable
I think your hosts are not connected through any controller. 我认为你的主机没有通过任何控制器连接。 Make sure your hosts are connected with any controller (Opendaylight, Floodlight etc.) that way you can figure out. 确保您的主机与您可以找到的任何控制器(Opendaylight,Floodlight等)连接。 Just type pingall all on mininet. 只需在mininet上键入pingall all。 It should show you like the following: 它应该显示如下:
h1 ---> h2 h3 h2 ---> h1 h3 h3 ---> h1 h2-
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.