简体   繁体   English

Mininet:如何在两台交换机之间进行两台主机的通信

[英]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.

相关问题 如何ping连接到在两个不同的远程控制器下的mininet中创建的两个不同的虚拟交换机的两个虚拟主机 - how to ping two virtual hosts connected to two different virtual switches created in mininet under two different remote controllers 如果Mininet API中的两个节点之间存在链接 - If link exist between two nodes in Mininet API 两台服务器之间进行通讯的最佳方式 - Best way for communicating between two servers 在两台服务器上的两个Django应用程序之间有效通信(多租户) - Effectively communicating between two Django applications on two servers (Multitenancy) (mininet) 如何创建具有两个路由器及其各自主机的拓扑 - (mininet) How to create a topology with two routers and their respective hosts 创建一个使用时间逻辑在两个不同状态之间切换的模型? - Create a model that switches between two different states using Temporal Logic? 康威生命游戏仅在两帧之间切换 - Python - Conways Game of Life only switches between two frames - Python 如何将不同的开关连接到mininet中的不同遥控器? - how to connect different switches to different remote controllers in mininet? 如何通过 Mininet 主机运行 python 脚本? - how to run python script through Mininet host? 如何在两个对象之间建立实时连接 - How to make live connection between two objects
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM