简体   繁体   English

主机无法在具有自定义拓扑和 OpenDayLight 的 mininet VM 上相互 ping

[英]Hosts can't ping each other on mininet VM with custom topology and OpenDayLight

Preface前言

Host OS: Win10主机操作系统:Win10

Mininet VMs tried: Ubuntu Server 18.04, 18.04.6, 20.04, 22.04, preconfigured VM supplied by mininet I've also tried using a pre-configured ODL VM and building from the sources myself.尝试过的 Mininet VM:Ubuntu Server 18.04、18.04.6、20.04、22.04,由 mininet 提供的预配置 VM 我也尝试使用预配置的 ODL VM 并自己从源代码构建。

VM Software: VMware Workstation虚拟机软件:VMware Workstation

Hey, I'm fairly new to SDNs, mininet and ODL.嘿,我对 SDN、mininet 和 ODL 还很陌生。 I've set up a bridged VM running an ODL instance as a remote controller and then I've also set up a separate bridged VM containing mininet.我已经设置了一个桥接 VM,将 ODL 实例作为远程控制器运行,然后我还设置了一个包含 mininet 的单独桥接 VM。

I want to note the fact that if I run a command such as sudo mn -x --mac --topo single,3 --controller=remote,ip=192.168.0.37,port=6633 --switch ovsk,protocols=OpenFlow13 (this is essentially what I'm trying to recreate via a python script), everything works completely fine;我想指出一个事实,如果我运行诸如sudo mn -x --mac --topo single,3 --controller=remote,ip=192.168.0.37,port=6633 --switch ovsk,protocols=OpenFlow13的命令(这本质上是我试图通过 python 脚本重新创建的),一切正常; my hosts can communicate with each other and the topology appears in my ODL webview as expected.我的主机可以相互通信,并且拓扑按预期显示在我的 ODL webview 中。

I've tried looking at multiple SO threads with no luck, I've also not been able to find any resources online that address my issue.我试过查看多个 SO 线程,但没有运气,我也无法在网上找到任何资源来解决我的问题。

Issue问题

My issue is that whenever I try to run my custom mininet topology using sudo python/2/3 script.py , my hosts cannot ping each other and the topology doesn't appear in my ODL webview.我的问题是,每当我尝试使用sudo python/2/3 script.py运行我的自定义 mininet 拓扑时,我的主机无法相互 ping 通,并且拓扑不会出现在我的 ODL webview 中。 I've tried running progressively simpler and simpler python scripts in an attempt to get it to work.我已经尝试运行越来越简单的python脚本,试图让它工作。 This is the simplest I've tried so far.这是迄今为止我尝试过的最简单的。 Script.py:脚本.py:

#!/usr/bin/python
from mininet.net import Mininet
from mininet.node import Controller
from mininet.cli import CLI
from mininet.link import TCLink
from mininet.log import setLogLevel, info
from mininet.node import OVSKernelSwitch, RemoteController

def myNetwork():

    net = Mininet( topo=None, build=False)

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

    info('*** Add single switch\n')
    s1 = net.addSwitch('s1')

    info('*** Add hosts\n')
    h1 = net.addHost('h1')
    h2 = net.addHost('h2')
    h3 = net.addHost('h3')
    h4 = net.addHost('h4')
    h5 = net.addHost('h5')
    h6 = net.addHost('h6')

    info('*** Add links with QoS parameters\n')
    net.addLink(h1, s1, cls=TCLink, bw=1000, delay='1ms', loss=1)
    net.addLink(h2, s1, cls=TCLink, bw=100, delay='1ms', loss=1)
    net.addLink(h3, s1, cls=TCLink, bw=50, delay='1ms', loss=1)
    net.addLink(h4, s1, cls=TCLink, bw=10, delay='1ms', loss=1)
    net.addLink(h5, s1, cls=TCLink, bw=5, delay='1ms', loss=1)
    net.addLink(h6, s1, cls=TCLink, bw=1, delay='1ms', loss=1)

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

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

It might also be important to note that if I create a network in miniedit (setting the controller to a RemoteController and inputting its IP), when opening h1's terminal I can ping h2 completely fine.还需要注意的是,如果我在 miniedit 中创建网络(将控制器设置为 RemoteController 并输入其 IP),打开 h1 的终端时,我可以完全正常地 ping h2。 The second I save the l2 script, close miniedit and try to run the script with sudo python/2/3 l2script.py , none of the hosts can ping each other again.第二次我保存 l2 脚本,关闭 miniedit 并尝试使用sudo python/2/3 l2script.py运行脚本,没有主机可以再次相互 ping 通。

Any help would be immensely appreciated, as I can't for the life of me figure out what the issue is.任何帮助将不胜感激,因为我一生都无法弄清楚问题所在。 I've been scratching my head for days.这几天我一直在挠头。

Cheers, have a good one!干杯,祝你好运!

Edit编辑

I've ran wireshark on s0 and whenever I try to ping, a flood of ARP requests come in but a response is never sent out.我在 s0 上运行了 wireshark,每当我尝试 ping 时,都会收到大量 ARP 请求,但从未发出响应。

I've managed to fix my issue.我已经设法解决了我的问题。

Turns out the code I posted shouldn't ever work (afaik).原来我发布的代码不应该工作(afaik)。 In the versions I'd tried before, I declared s0 using s1 = net.addSwitch('s1', cls=OVSKernelSwitch, protocol='OpenFlow13') , where I should have done s1 = net.addSwitch('s1', cls=OVSKernelSwitch, protocols='OpenFlow13') (missed an s at the end of protocols='OpenFlow13' .在我之前尝试过的版本中,我使用s1 = net.addSwitch('s1', cls=OVSKernelSwitch, protocol='OpenFlow13')声明了 s0 ,我应该在其中完成s1 = net.addSwitch('s1', cls=OVSKernelSwitch, protocols='OpenFlow13') (在protocols='OpenFlow13'的末尾错过了一个s。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM