I have implemented the following topology in Python:
from mininet.topo import Topo
class internTopo(Topo):
def build(self):
h1 = self.addHost('h1')
h2 = self.addHost('h2')
h3 = self.addHost('h3')
s1 = self.addSwitch('s1')
s2 = self.addSwitch('s2')
self.addLink(h1, s1)
self.addLink(h2, s2)
self.addLink(h3, s2)
self.addLink(s1, s2)
self.addLink(h3, s1)
topos = {'tp': (lambda: internTopo())}
It generates a simple network containing three hosts (h1, h2, and h3) and two switches (s1 and s2).
h1 is connected to s1, h2 is connected to s2, h3 is connected to both s1 and s2, and s1 and s2 are connected.
Here is a rough representation:
h1 h2
. .
. .
s1 ------- s2
. .
. ------- . ---- h3
My problem is; I have set the delay of each link to 10 ms, and when I run the command h2 ping h3
, it takes around 40.5 ms to execute a ping (which is expected, as there are two 'bridges' with a delay of 10 ms each). However, when I run the command h1 ping h3
, it takes about 60.4 ms per ping. It seems to me that the ping request goes through a second switch, potentially s2.
Why is that the case? Can't a host be connected to two switches?