create a multi-route mininet topology

312 Views Asked by At

I am working on mininet and am trying to create a topology to allow multiple paths to exist between any two hosts. In particular, I am working with the following topology:

class SimpleTopo(Topo):
    def build(self):
        h1 = self.addHost('h1')
        h2 = self.addHost('h2')
        h3 = self.addHost('h3')

        s1 = self.addSwitch('s1')
        s2 = self.addSwitch('s2')
        s3 = self.addSwitch('s3')

        sc1 = self.addSwitch('s4')
        sc2 = self.addSwitch('s5')

        self.addLink(h1, s1)
        self.addLink(h2, s2)
        self.addLink(h3, s3)
        self.addLink(s1, sc1)
        self.addLink(s1, sc2)
        self.addLink(s2, sc1)
        self.addLink(s2, sc2)
        self.addLink(s3, sc1)
        self.addLink(s3, sc2)

But when I try to pingall connections, all hosts are unreachable from each other. I am not sure what exactly am I missing and nay help would be appreciated!

1

There are 1 best solutions below

0
On

Can you give more details on why you are attempting to do that?

Switches are tricky as they do not technically implement the full stack. What I assume is happening is that the forwarding tables are getting confused after you try to add some links. I have confirmed that if you remove some of your links connectivity is there.

However, if you are simply trying to get a multipath example you can alter your topology as follows:

class SimpleTopo(Topo):
    def build(self):
        h1 = self.addHost('h1')
        h2 = self.addHost('h2')

        s1 = self.addSwitch('s1')
        s2 = self.addSwitch('s2')

        sc1 = self.addSwitch('s3')
        sc2 = self.addSwitch('s4')
        sc3 = self.addSwitch('s5')

        self.addLink(h1, s1)
        self.addLink(h2, s2)
        self.addLink(s1, s2)

        self.addLink(h1, sc1)
        self.addLink(sc1, sc2)
        self.addLink(sc2, sc3)
        self.addLink(sc3, h2)

Note, I only have 2 hosts here but there is no reason why you can't add a third one. This way two distinct paths between h1 and h2 are created, namely:

  1. h1 - s1 - s2 - h2
  2. h1 - sc1 - sc2 - sc3 - h2

You can verify that both work by removing one of the paths and you'll see that connectivity is still there.