0

I am experiencing connectivity issues when adding hosts to a topology by calling Mininet's addHost() method. The hosts are unable to ping one another, or any outside ip address (by way of the NAT). A simple example of what I am trying to do would be the following:

from mininet.net import Mininet
from mininet.cli import CLI

net = Mininet()
h1 = net.addHost('h1')
h2 = net.addHost('h2')
s1 = net.addSwitch('s1')

net.addLink(s1,h1)
net.addLink(s1,h2)
net.addNAT().configDefault()
net.build()

CLI(net)  

I also don't experience this problem when supplying a topology to the Mininet class constructor, however for what I am doing I require the ability to add hosts after the Mininet instance has been instantiated (like in the above example). Am I doing something wrong?

Edit: I should note that I am using Mininet 2.2.1 inside the supplied VM image.

2 Answers2

0

change the order net.addLink(s1,h1) to net.addLink( h1, s1 ) first host than switch, Mid-level API: Network object

Ari Gold
  • 1,528
  • 11
  • 18
  • I switched the order, but the hosts are still unable to connect to one another. – user2149890 Nov 03 '16 at 13:40
  • there are more missing arguments, check that please http://stackoverflow.com/questions/23677291/how-to-connect-different-switches-to-different-remote-controllers-in-mininet – Ari Gold Nov 03 '16 at 13:46
  • I believe those arguments are optional. Even when adding them I experience the same problem. I should also note that the switch itself has no problem connecting to the NAT, it just can't connect to the hosts. Hence the hosts can't connect to one another. – user2149890 Nov 03 '16 at 14:01
0

I figured out the problem. If you pass the Mininet constructor a topology it will automatically add the controller instance for you. However if you build the topology after the Mininet instance has been instantiated (like in the example above) you must add the controller manually using

net.addController('c0')