简体   繁体   中英

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

Preface

Host OS: 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.

VM Software: VMware Workstation

Hey, I'm fairly new to SDNs, mininet and 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.

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; my hosts can communicate with each other and the topology appears in my ODL webview as expected.

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.

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. I've tried running progressively simpler and simpler python scripts in an attempt to get it to work. This is the simplest I've tried so far. Script.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. 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.

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.

I've managed to fix my issue.

Turns out the code I posted shouldn't ever work (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' .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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