How to use MiniEdit, Mininet’s graphical user interface

The Mininet network simulator includes MiniEdit, a simple GUI editor for Mininet. MiniEdit is an experimental tool created to demonstrate how Mininet can be extended.

MiniEdit-503b

To show how to use MiniEdit to create and run network simulations, we will work through a tutorial that demonstrates how to use MiniEdit to build a network, configure network elements, save the topology, and run the simulation.

Set up Mininet

You should already be familiar with Mininet before trying to use MiniEdit. If you need some basic information about Mininet, please read my Mininet overview.

Before starting this tutorial, you should have already started the Mininet VM and connected to it via SSH with X forwarding enabled. If you need to learn how to do this, please read my post describing how to set up Mininet.

Start MiniEdit

The MiniEdit script is located in Mininet’s examples folder. To run MiniEdit, execute the command:

$ sudo ~/mininet/examples/miniedit.py

Mininet needs to run with root privileges so we started MiniEdit using the sudo command.

MiniEdit user interface

MiniEdit has a simple user interface that presents a canvas with a row of tool icons on the left side of the window, and a menu bar along the top of the window.

MiniEdit canvas
MiniEdit canvas

The icons represent the following tools:

Mininet-selectThe Select tool is used to move nodes around on the canvas. Click and drag any existing node. Interestingly the Select tool is not needed to select a node or link on the canvas. To select an existing node or link, just hover the mouse pointer over it — this works regardless of the tool that is currently active — and then either right-click to reveal a configuration menu for the selected element or press the Delete key to remove the selected element.

Mininet-hostThe Host tool creates nodes on the canvas that will perform the function of host computers. Click on the tool, then click anywhere on the canvas you wish to place a node. As long as the tool remains selected, you can keep adding hosts by clicking anywhere on the canvas. The user may configure each host by right-clicking on it and choosing Properties from the menu.

Mininet-switchThe Switch tool creates OpenFlow-enabled switches on the canvas. These switches are expected to be connected to a controller. The tool operates the same way as the Hosts tool above. The user may configure each switch by right-clicking on it an choosing Properties from the menu.

Mininet-legacy-switchThe Legacy Switch tool creates a learning Ethernet switch with default settings. The switch will operate independently, without a controller. The legacy switch cannot be configured and is set up with Spanning Tree disabled, so do not connect legacy switches in a loop.

Mininet-legacy-routerThe Legacy Router tool creates a basic router that will operate independently, without a controller. It is basically just a host with IP Forwarding enabled. The legacy router cannot be configured from the MiniEdit GUI.

Mininet-netlinkThe NetLink tool creates links between nodes on the canvas. Create links by selecting the NetLink tool, then clicking on one node and dragging the link to the target node. The user may configure the properties of each link by right-clicking on it an choosing Properties from the menu.

Mininet-controllerThe Controller tool creates a controller. Multiple controllers can be added. By default, the MiniEdit creates a mininet openFlow referencecontroller, which implements the behavior of a learning switch. Other controller types can be configured. The user may configure the properties of each controller by right-clicking on it an choosing Properties from the menu.

Mininet-run-stopThe Run starts Mininet simulation scenario currently displayed in the MiniEdit canvas. The Stop button stops it. When MininEdit simulation is in the “Run” state, right-clicking on network elements reveals operational functiosn such as opening a terminal window, viewing switch configuration, or setting the status of a link to “up” or “down”.

Create a custom network topology using MiniEdit

First we will add some hosts to network scenario. Click on the Host icon, then move the pointer to the location on the MiniEdit canvas where you want the host to appear, then click again. A host icon will appear on the canvas.

As long as the Host tool is active, you can add more hosts. Keep clicking at each spot on the canvas where you want a host to appear. In this example, we will add ten hosts.

Add eight switches and three controllers using the same method: Click on the Switch tool and add switches, then click on the Controller tool and add controllers.

Add hosts, switches, and controllers
Add hosts, switches, and controllers

Next, add links between the nodes on the canvas. Click on the NetLink tool, then click on a node and drag the link over to another node. For example: connect a host to a switch, or a switch to another switch. Connect every host to at least one switch. Connect the switches together to create a network. Then, connect each switch to one of the controllers.

Your completed network should be similar to the network show in the screenshot below:

Connect nodes together
Connect nodes together

We were able to create this complex custom network topology in a few minutes using MiniEdit. Manually writing a Mininet custom topology script to create this scenario would have taken a lot longer.

Configure the controllers
Edit each controller so it uses a unique port number
Edit each controller so it uses a unique port number

We have three controllers. In this basic example, we will use the default OpenFlow Reference controller that comes built in to Mininet. However, we need to configure each controller so it uses a different port.

Right-click on each controller and select Properties from the menu that appears. The default port number for each controller is 6633. Change this so the port numbers used by controllers c0, c1, and c2 are 6633, 6634, and 6635, respectively.

Set MiniEdit Preferences

To set MiniEdit preferences, use the MiniEdit menu command, Edit → Preferences. In the dialogue box that appears, make the changes you need.

MiniEdit preferences default settings
MiniEdit preferences default settings

Set the Start CLI option

By default, the MiniEdit console window does not give the user access to the Mininet command line interface. If you want to be able to use the Mininet CLI when a simulation is running, check the Start CLI box. You may also set the version of OpenFlow you will use.

In our scenario, we will use the CLI and will leave all other settings at default values.

Set CLI option
Set CLI option

Saving preferences

The MiniEdit Preferences are saved in the MiniEdit topology file for each scenario so you may have different preferences for each saved scenario.

Save the configuration

Now we have a software-defined network scenario that should allow each host to communicate with any other host in the network.

We will save the MiniEdit topology file so we can load this scenario into MiniEdit in the future. We will also export a Mininet Python script that we can run in a terminal window to execute the scenario.

Save topology file

To save the Mininet Topology (*.mn) file, click on File in the top menu bar and select Save from the drop-down menu. Type in a file name and save the file.

Save custom Mininet script

To save the Mininet Custom Topology (*.py) file, click on File in the top menu bar and select Save Level 2 Script from the drop-down menu. Type in the file name and save the file.

Run the MiniEdit network scenario

To start the simulation scenario, click the Run button on the MiniEdit GUI. In the terminal window from which you started MiniEdit, you will see some messages showing the progress of the simulation startup and then the Miniedit CLI prompt (because we checked Start CLI box in the MiniEdit preferences window).

MiniEdit console shows Mininet prompt
MiniEdit console shows Mininet prompt

Pay attention to the warning message. Before stopping the simulation with the Stop button, ensure you quit from the CLI by typing exit at the Mininet prompt in the MiniEdit console window.

Experiment with the network

After starting the simulation scenario, we will view the status of different elements in the network, open terminal windows, run network traffic, run programs on simulated hosts, and simulate network failures. These activities will demonstrate how to use some of the features of MiniEdit.

View Open vSwitch configurations

First, check the switch configurations in the network simulation to verify that everything is set up correctly. You can run the MiniEdit menu command, Run → Show OVS Summary to see an listing of switch configurations. In this case, we can verify that each switch is listening to the correct controller on the correct port.

OVS Summary window
OVS Summary window

Check switch flow tables

Next, view the flow tables of some of the switches using the ovs-ofctl dump-flows command. You need to run this command on the host computer (or the virtual machine) that is running Mininet. So, you need to use a terminal window connected to the computer (not to one of the nodes in the network simulation). You can use MiniEdit to open an xterm connected to the host computer by using the MiniEdit menu command, Run → Root Terminal

Open a an xterm on the host Mininet VM
Open a an xterm on the host Mininet VM

In the root terminal window, first change the userid from root to mininet, so you can view the switches running in the mininet account. Remember that we logged into the Mininet VM as user mininet so all mininet processes are running in the mininet account.

# su mininet

Then, check the flow table on switch s1 using the commands below. It should be empty.

$ sudo ovs-ofctl dump-flows s1

Run programs to generate and monitor traffic

Open a xterm window on hosts h1 and h8. Right-click on each host in the MiniEdit GUI and select Terminal from the menu that appears.

In the h1 xterm window, start a Wireshark with the command, wireshark &. In the h8 xterm window, start a packet trace with the command tcpdump. We do this just to demonstrate two different methods of monitoring traffic on the virtual Ethernet ports of each host.

Then, run a ping command to send traffic between host h1 and h8. On the MiniEdit console window, enter the following command:

mininet> h1 ping h8

In the MiniEdit console, you see the results of the ping command. In the Wireshark window and in the host h8 xterm window — which is running tcpdump — you will see ICMP packets successfully sent and responses received.

Monitoring traffic generated by the ping command
Monitoring traffic generated by the ping command

Simulate a broken link

To simulate a broken link in the network, move the mouse pointer over one of the blue links in the network and right-click. Choose Link Down from the menu that appears. The link will turm into a dashed blue line, indicating it is down.

Breaking a link
Breaking a link

You should observe that no more traffic is received at host h8 and that the ping command shows packets sent from host h1 are not being responded to.

Now, restore the link operation by right-clicking on the dashed line and choosing Link Up from the menu. The link will again appear as a solid blue line, traffic will again be received at host h8, and the ping command running on h1 will show it is receiving responses from h8.

Check flow tables again

Check the flow table on switch s1 again. You should see flows installed for ICMP packets and ARP packets. On the root terminal window, enter the command:

$ sudo ovs-ofctl dump-flows s1

Stop the simulation

Quit Wireshark and tcpdump on hosts h1 and h8.

Quit the ping command in the MiniEdit console window by pressing Ctrl-C on the keyboard.

Then, quit the Mininet CLI by typing exit at the mininet> prompt.

Now, press the Stop button on the MiniEdit GUI.

Run a saved Mininet custom topology script

An alternative to running a simulation directly in MiniEdit is to run a Mininet custom topology script created by MiniEdit. This is the file with the .py extension previously created when we used the menu command: File → Save Level 2 Script.

The advantage of running a Mininet custom topology script is that you can edit the script originally created by MiniEdit to create more complex scenarios and to use Mininet features not supported by MiniEdit.

To run the custom topology you created in MiniEdit, execute the Mininet custom topology script. First, change the file permissions so it is an executable file, then execute the file. In the example below, the file is named test-001.py.

$ cd ~/mininet/examples/test
$ sudo chmod 777 test-01.py
$ sudo ./test-01.py

The script sets up the network topology and the mininet> command line prompt appears. Now you can test the scenario by using the ping command to test connectivity between hosts in the network. For example:

mininet> h1 ping -c3 h2
mininet> h1 ping -c3 h8

Conclusion

We used MiniEdit to create and run a simulation of a custom network topology. We showed how to use many of MiniEdit’s features.

MiniEdit seems to be a useful tool for creating custom software-defined network simulation scenarios.

136 thoughts on “How to use <em>MiniEdit</em>, Mininet’s graphical user interface”

      1. Hi
        I have run miniedit but there are many buttons doesn’t appear like controllers
        what is the problem ?
        Do I need enable X11 each time I need to run miniedit?
        by using command in terminal to execute putty -x I can’t enable X11 —> Display not set
        but if I double click on putty in its folder I can enable X11 but if I close it, I need to enabled again.
        thanks in advance

        1. Hi Nasser,

          The controller configuration should in the toolbar on the left side of the GUI. If it is not, I do not know what the problem would be. I have never experienced that issue.

          Yes, you need X forwarding enabled to display the MiniEdit GUI.

          Yes, that’s how Putty works. You’ll need at least one Putty window with X forwarding enables while using X applications on the Mininet VM. So, leave the Putty window open and connected.

          Regards,
          Brian

        2. Hi Nasser
          i have your problem. do you have one solution for me?
          i want a controller in miniedit but the miniedit has not controller icon

    1. Hi Rashid,
      Just create new controllers and then, for each controller, change the port number the controller uses. Then connect each controller to the switches it will control.
      –Brian

  1. Hi Brian,
    Just like Rashid, I was dealing with Multiple controllers. Any idea, as to how I can make those controllers run different scripts? Say, controller1 runs script script1.py and controller2 runs script1.py and script2.py.

    Thanks,

    1. Hi Chaitanya,
      Start each controller as a new process, each running on its own port. You start the controllers separately from the switches so just ensure you connect each switch to the right controller and then you should be able to test your application.
      Regards,
      Brian

  2. Thanks, for the answer Brian.
    However, I am still facing some issues.
    As soon as I start up another controller instance on another terminal, I get the “Address already in use” error. Therefore, I can’t even get my topology script to connect to the (second) controller, as there isn’t one hosted.
    Could u point out what is it that I am missing?
    (The controller I am using is Ryu, rather than POX, though I have used POX in the past)

    1. I am only familiar with POX. But, did you check that both the controllers and switches have the right control ports defined? Each controller must use a unique TCP port number.

      1. Well, I think yes, and this is what it looks like:
        #Controllers:
        c0 = RemoteController(‘c0’, port = 6633)
        c1 = RemoteController(‘c1’, port = 6638)

        #Switches:
        net.get(‘s1’).start([c1])
        net.get(‘s2’).start([c0])
        net.get(‘s3’).start([c0])

        So the controllers listen on 6633 and 6638, and switches are connected as above. Anything else, that could be wrong?

  3. Hi Brian!

    As per you mentioned i ran the command to start miniedit but it isnt working for me.
    Here is what i got.

    mininet@mininet-vm:~$ sudo ~/mininet/example/miniedit.py
    sudo: /home/mininet/mininet/example/miniedit.py: command not found

    Any idea what i am missing here?

    1. Hi Zafar,
      Just saw this, and couldn’t help but reply, as its a minor issue.
      The command is sudo python ~/mininet/example/miniedit.py

      You missed calling python to invoke the script.

    2. Hi Zafar,
      I misspelled the path of the script (the correct directory is named “examples”, not “example”). The correct command should be:
      $ sudo ~/mininet/examples/miniedit.py

      Thanks for pointing this out. I will fix the post.
      Regards,
      Brian

      1. Hi Brian,
        i am new to mininet so i am having some issues with it.i would be grateful if you can help me in this.

        I dont know where to store python scripts which i want to run in my mininet.

        i installed mininet from mininet.org
        its working fine but i dont know the exact directory to place .py files before calling them here in mininet.

        any idea?

          1. But this is the way if you are going to run a script from mininet/custom or if you are going to use mininet/examples etc.

            i have my own script and i cant run it from these paths or it isn’t available on these paths.

            i wana run it form my local machine.

            where to store/place that script in my local machine in order to run it?

      2. hello sir…i hv gone through your mininet tutorial and they are well written and well explained.Sir, i hv come to miniedit but i m nt able to run the command $ sudo ~/mininet/examples/miniedit.py or $ sudo python ~/mininet/examples/miniedit.py it says “_tkinter.TclError:no display name and no display enviroment variable”.I request you to kindly suggest me what modification i have to make to run this command.
        Your kind reply will be highly appreciable.Thnks in advance

        1. If you see display errors, first check that you have X forwarding enabled on the SSH connection to the Mininet VM. Start SSH with the following command: ssh -X username@servername. If that does not work, try the -Y option with: ssh -Y username@servername.

          1. thnku sir for your reply..i can ssh via command putty.exe -ssh ipaddress bt i am still not able to use miniedit..kindly provide me with more valuable suggestions to solve this problem

          2. I have seen this error when X forwarding is not enabled or is not working properly. If X forwarding is working than I don’t know what the problem would be. Is it possible that the X server on your Windows PC is not working? Are you running Xming?

          3. ohh itz k .Sir u were tellin about x forwarding so i would lyk to inform u dat i use putty.exe -ssh 192.168.56.102 command for x forwarding.The command ssh -X [email protected] used to work earlier in my system bt it doesnt work anymore since a few days and moreover ip address of eth1 in my mininet is 192.168.56.102 not 192.168.56.101 where i see 192.168.56.101 in all the websites..kindly suggest if there is some problem in these

    3. hello…cud u solve ur pblm of running the above prblm u mentioned…i m facing the same prblm lyk urz…plz help

  4. Hi Brian,
    Thank you. It is well-organized. I have question. I followed everything you’ve shown as explained but when I want to check flow tables entries using the command ($ sudo ovs-ofctl dump-flows s1) I get only one line:

    root@linux:~mininet# NXST_FLOW reply (xid=0x4):

    Even though pingall and (h1 ping h8) gave correct responses and have no issues!
    Thank you for your response in advance.
    — Ahmad.

    1. Hi Ahmed,
      Thank you for your comment. You found an error in my post. You are trying to run the command in the MiniEdit root terminal window but the userid running the command is *root*, while MiniEdit and Mininet are running on the userid *mininet*. Change the user to *mininet* with the command `su mininet`, then enter the *ovs-ofctl* command again: `sudo ovs-ofctl dump-flows s1`. Then you will see the flows on the switch.
      Thanks for finding this for me. I will correct it in the post.
      Best regards,
      Brian

      1. Hi Brian,
        Thank you for quick reply. I apologize for asking you too much but I am kind of new in Linux so bear with me.

        My default Linux user is (Linux) so Ubuntu terminal appears as (linux@linux:~$ ). When using MiniEdit root terminal, I get (root@linux:~mininet# ). Thus, when I change the user by (su mininet) I get:

        no passwd entry for user ‘ mininet ‘

        Would you mind telling me what does this message mean since I’ve searched about it but no answer was satisfying.

        1. It means there is no user account called “mininet”. Try switching to user “linux” in the MiniEdit root terminal: su linux. I assume you are running Mininet/MiniEdit in your account with userid=”linux”.

          It looks like you installed Mininet on your own computer. I prefer to use the Mininet VM. If you are new to Linux, and it you still have problems after trying to switch to the linux account in the MiniEdit root terminal, I highly recommend using the Mininet VM, instead.

          First, set up the Mininet VM as described in: https://brianlinkletter.com/set-up-mininet/
          Next, review the basic functions of Mininet, as described in: https://brianlinkletter.com/mininet-test-drive/
          Next, follow the MiniEdit steps in this post (https://brianlinkletter.com/how-to-use-miniedit-mininets-graphical-user-interface/) and it should work.

          1. Brian,
            I solved the problem. The problem was that I use a remote controller (floodlight) that I’ve installed on my system from github and connect it with the c0 controller in Mininet. The flow entries are showing when I use the default controller by mininet but not in remote controller.

            Can you tel me what is the default controller in Mininet and how it differes from floodlight?

            THANK YOU.

          2. Hi Ahmad,
            The Mininet default controller is a simple controller that implements a learning switch. That is all it does. It is a simple way to demonstrate how Mininet works but it is not very useful in real-world applications.
            Floodlight is a much more complex controller that supports programming network applications. I am not familiar with Floodlight (I have used POX as a remote controller) but you may have to do some programming or additional configuration to make Floodlight work for you.
            Brian

  5. Hello;; This is indeed great work and thanks for your information, I have added two trunks ports and two access ports, and configured two vlans,, I am just wondering how to save my configuration on the switch, please Note I am using CLI command line. and accessing the Switch from Mininet> via, xterm s1

    1. Hi Adam,
      You cannot save the configuration of a switch in Mininet. But, you could create a script to set up flow tables and run it each time you start your scenario.
      –Brian

  6. Can we consider two different system as nodes and try to ping them? Is this possible in miniedit ?

    1. Hi Venkat,
      Yes. You can ping from one host to another. You can open an xterm on a host and use the Linux ping command to ping another host or you can use the Mininet ping or pingall commands in the Mininet console.
      Brian

  7. Pingback: Mininet Graphical Topology Creation – Mohit Ritolia

  8. Hi Brian. How do I run a controller created in MiniEdit topology as an external Floodlight controller running in Eclipse IDE? Thanks in advance.

    1. I don’t use the Eclipse IDE and I have not used the Floodlight controller so I cannot address that issue. Assuming that the Floodlight controller will still be reachable via an IP address when it is running in the Eclipse IDE, then you can use the same process described in this post to connect to a remote controller.

    2. I have met the same problem with you. So, if you solve it, please tell me the solution. Thank you very much!

  9. Hello
    My name is Chris. I have done everything I instructed to do in this lab. I got to the stage where I have to open wireshark on h1 and tcp dump for h8 but when I tried to ping h1 and h8. It doesn’t work. What could be the problem?

    1. Hello
      My name is Chris. I have done everyhing you instructed to do in this lab. I got to the stage where I have to open wireshark on h1 and tcp dump for h8 but when I tried to ping h1 and h8. It doesn’t work. What could be the problem?

      1. Hi Chris,
        The most common mistake I make is not configuring the controller correctly. I suggest that you double-check that part of the procedure. Make sure the port number is different for each controller.
        Brian

    2. Im facing same problem Chris.i dont get any result from h1 and h2,and ovs-ofctl dump-flows,i gotta nothing at all in show ovs summary,if you resolve that problem any help will be appreciated.

    1. Hi Anusha,

      Thank you for your question. MiniEdit cannot import custom topology scripts created to run in Mininet. We create Python topology scripts to run in Mininet (and MiniEdit can output scripts in Python). But, MiniEdit uses an JSON format to save a topology in a format it can read. These JSON files end with the “.mn” extension.

      While there appears to be a MiniEdit class (importTopo) that allows MiniEdit to import Mininet Python topology files, it is not documented and I could not get it to work.

      Regards,
      Brian

  10. Hey Brian.
    Where can I find the python file in mininet that defines the default topology when “sudo mn” is run?
    Can we make changes to the default topology?
    I am running floodlight controller on eclipse IDE, in case I need to integrate the controller created on mininet with the floodlight controller, how do I do this?
    I tried mentioning the IP and port number of the floodlight controller but it shows stop the controller running on that port before running this topology.
    But I need to integrate the floodlight controller with the custom topology that I have created on mininet.
    How do I do this?

    1. Hi Surbhi,

      I’ve written may posts about Mininet and you will find the answers in those posts. Use the search function on my blog’s sidebar to search for “mininet”. I list the most relevant posts below.

      Custom topology example files are in the ~/mininet/custom directory. You may learn more about running custom topology files at the following link:
      http://mininet.org/walkthrough/#custom-topologies

      I wrote some posts that use a remote controller, such as POX and OpenDayLight, with Mininet. These posts show procedures that would be similar to setting up Mininet to work with Floodlight:
      https://brianlinkletter.com/using-the-pox-sdn-controller/
      https://brianlinkletter.com/using-the-opendaylight-sdn-controller-with-the-mininet-network-emulator/

      Also, see the following link for more information about using remote controllers:
      http://mininet.org/walkthrough/#using-a-remote-controller

      Regards,
      Brian

  11. Hi Brian,

    I had a doubt regarding the Switch (not legacy) in Miniedit. How can I assign different subnets to a switch. Are these switches Layer 3 switches?

    I actually wanted to implement a fat tree topology in Miniedit for about a 100 hosts and wanted 10 hosts in one subnets, which means that I need 10 different subnets. How do I do it.

    I would really appreciate your inputs.

    Much thanks!!

    1. Hi Zenable,
      Switches are not IP devices so you cannot assign different IP subnets to ports on a switch. You would need to implement some code to create a virtual “router” using the SDN controller. Then assign hosts to the different subnets you want to manage. The SDN application you create would install flows on switches between hosts in the same subnet but would require any packets traveling between subnets to be forwarded to the controller, which would inspect the packet and, assuming it is allowed, install a flow between the two hosts in the two different subnets.
      So, you cannot do this with just Mininet. You will need to install a remote controller and write some code to implement this functionality.
      Regards,
      Brian

      1. HI Brian,

        Much Thanks for your previous reply. I have one more doubt.
        1) Below is the snippet while building a small topology in Miniedit. It says no netflow and sflow targets specified. Can you please throw some light on this issue.

        Getting Links.
        *** Configuring hosts
        h7 h6 h8 h2 h1 h3 h5 h4
        **** Starting 1 controllers
        c0
        **** Starting 8 switches
        s5 s3 s1 s9 s6 s7 s2 s4
        No NetFlow targets specified.
        No sFlow targets specified.

        2) Also regarding another scenario where we have a 3 layered topology with fanout of 8 at the edge switches. We have connected a controller to the top layer switches and have interconnected each and every switch in the topology. I wanted to know whether it is necessary to connect a controller to each and every switch in this case?

        1. Hi Zena,

          1) Unless you performing experiments that include sFlow and NetFlow, you may ignore the lines complaining that “No NetFlow targets specified and No sFlow targets specified”. For more information, see: http://techandtrains.com/2014/02/28/miniedit-2-1-0-8-1/#comment-166.

          2) When you do not directly connect every switch to a controller, you are attempting to create an *in-band* connection between the other switches and the controller. This cannot be done in MiniEdit but you may create a Python script to do it. I suggest you export your MiniEdit topology as a “Level 2 script” and then modify it. Then you can run it as a program that sets up your Mininet scenario. See the following link to learn how to build an in-band controller into Mininet: http://techandtrains.com/2013/10/04/in-band-controller-with-mininet/.

          Regards,
          Brian

          1. Hey Brian,

            Thanks a lot for your quick and apt comments and suggestions. I had another doubt.

            1) This is my current topology (Level 2 Script exported from Miniedit)

            c1=net.addController(name=’c1,
            controller=Controller,
            protocol=’tcp’,
            port=6633)

            c0=net.addController(name=’c0′,
            controller=Controller,
            protocol=’tcp’,
            port=6633)

            info( ‘*** Add switches\n’)
            s3 = net.addSwitch(‘s3’, cls=OVSKernelSwitch)
            s1 = net.addSwitch(‘s1’, cls=OVSKernelSwitch)
            #s1.cmd(‘ovs-vsctl set bridge s1 stp-enable=true’)
            s4 = net.addSwitch(‘s4’, cls=OVSKernelSwitch)
            s2 = net.addSwitch(‘s2’, cls=OVSKernelSwitch)

            info( ‘*** Add hosts\n’)
            h2 = net.addHost(‘h2′, cls=Host, ip=’10.0.0.2’, defaultRoute=None)
            h3 = net.addHost(‘h3′, cls=Host, ip=’10.0.0.3’, defaultRoute=None)
            h4 = net.addHost(‘h4′, cls=Host, ip=’10.0.0.4’, defaultRoute=None)
            h1 = net.addHost(‘h1′, cls=Host, ip=’10.0.0.1’, defaultRoute=None)

            info( ‘*** Add links\n’)
            net.addLink(s1, s2)
            net.addLink(s1, s3)
            net.addLink(s2, s4)
            net.addLink(s3, h1)
            net.addLink(s3, h2)
            net.addLink(s4, h3)
            net.addLink(s4, h4)
            net.addLink(s1, s4)
            net.addLink(s2, s3)

            info( ‘*** Starting network\n’)
            net.build()
            info( ‘*** Starting controllers\n’)
            for controller in net.controllers:
            controller.start()

            info( ‘*** Starting switches\n’)
            net.get(‘s3’).start([c1])
            net.get(‘s1’).start([c0])
            net.get(‘s4’).start([c1])
            net.get(‘s2’).start([c0])

            : Here I am unable to ping hosts. eg. h1 to h2 etc.
            But when I remove the links from s1 to s4 nd s2 to s3 I am able to ping the hosts.

            I assume the problem is due to loop formations. I came across few solutions. A) By running stp
            B) By using Networkx.

            But none of these worked for me. Can you guide me to use STP in such a scenario.

            Thanks again Brian!!

            Regards,
            Zena

  12. Annynonymous SDN Developer

    Hey,

    It was an amazing article! I have an existing custom topology that I would like to convert to mn topology – is it possible?

    Thanks
    Annynonymous SDN Developer

    1. You may export a MiniEdit topology as a “level 2 script”, which can be run as a Python program.

      But you cannot open a python script in MiniEdit. It only works in one direction.

      Brian

  13. Hi Brian,

    Which controller do we get in miniedit by default?
    Is it a POX controller or an OVS controller?
    If not POX, how do we make it a POX controller?

    Thanks

    Arpita.

    1. Hi Arpita,
      Mininet has a built-in controller called the “reference controller”. This is the default controller.
      When you install Mininet, it also installs the POX controller. But POX is not used by default. You would use POX as a “remote controller”. See the following posts that show how to use POX with Mininet:
      https://brianlinkletter.com/using-the-pox-sdn-controller/
      https://brianlinkletter.com/using-pox-components-to-create-a-software-defined-networking-application/
      Regards,
      Brian

  14. Hi Brian
    what is your mininet version?
    i have a problem with miniedit, because my miniedit does not have a controller icon.
    could you help me?

      1. Thanks, i have Mininet 2.0.0 and it has not controller icon in miniedit. when i change my mininet to 2.2.1, it is ok.

  15. Hi Brian,

    Whenever I run the ip_loadbalancer.py, I get the “No module named pox.core” error.
    I have tried to find solution online but have failed to do so. Please let me know if you can throw some light on this issue.

    Thanks,
    Zena

        1. Hi Mehrshad,

          Thanks for reading my blog!
          I suggest you read through the Mininet Python API documentation at: http://mininet.org/api/annotated.html.
          Then watch the videos from Nick Feamster’s SDN course. Module 3.4 of his course introduces the Mininet Python API. See:

          .
          Then look at the example scripts in the folder ~/mininet/examples (in the VM on which you installed Mininet, or in the downloaded Mininet VM) to see how the Python API may be used to accomplish various tasks.

          Regards,
          Brian

          1. Hi Brian, how can i enable multipath forwarding in mininet using topology from miniedit ?? can you give me some tutorial, it will really help me ^_^

            Thank you

          2. You could write a network application for an OpenFlow controller (such as POX or OpenDaylight) that implements multipath forwarding in a network of OpenFlow switches. I cannot help you write an application, though.

  16. Hi Brian,

    Can you please post the command to run the python topology file (L2 script export) exported from MiniEdit.

    Thanks!

  17. Jeremiah Kulanda

    I am trying to set up a vpn network (ipsec over GRE tunnel) using ovswitches and a controller. Please can you direct me on how that can be done with mininet. I already know how to set up a regular loop free network using miniedit or mininet and pox controller. An example might be helpful in setting up vpn between two switches in a four switch network with hosts.

    1. Hi…me too
      I am working on the same project…i want to create a Python Apps to manage a VPN network in Mininet and affect nodes to VLANs…
      so if you havr any idea how gto do it …
      Yours Aissa

  18. I want to use the legacy router in custom topology. So, I take this part

    # Adding routers
    r1 = net.addHost(‘r1′, cls=Node, ip=’0.0.0.0’)
    r2 = net.addHost(‘r2′, cls=Node, ip=’0.0.0.0’)
    r1 = net.getNodeByName(‘r1’)
    r1.cmd(‘sysctl -w net.ipv4.ip_forward=1’)
    r2 = net.getNodeByName(‘r2’)
    r2.cmd(‘sysctl -w net.ipv4.ip_forward=1’)

    but when I check the connectivity between the sides of the router, it gives me
    mininet> h1 ping h4
    xterm: No absolute path found for shell: h1
    PING 10.0.0.4 (10.0.0.4) 56(84) bytes of data.
    From 10.0.0.1 icmp_seq=1 Destination Host Unreachable
    From 10.0.0.1 icmp_seq=2 Destination Host Unreachable

    what could be the problem?

  19. I created topology using MinieEdit and saved it *.py. when I came back and opened it, it gives me this error and didn’t open

    Exception in Tkinter callback
    Traceback (most recent call last):
    File “/usr/lib/python2.7/lib-tk/Tkinter.py”, line 1489, in __call__
    return self.func(*args)
    File “./miniedit.py”, line 1431, in loadTopology
    loadedTopology = self.convertJsonUnicode(json.load(f))
    File “/usr/lib/python2.7/json/__init__.py”, line 290, in load
    **kw)
    File “/usr/lib/python2.7/json/__init__.py”, line 338, in loads
    return _default_decoder.decode(s)
    File “/usr/lib/python2.7/json/decoder.py”, line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    File “/usr/lib/python2.7/json/decoder.py”, line 384, in raw_decode
    raise ValueError(“No JSON object could be decoded”)
    ValueError: No JSON object could be decoded

  20. Hi Brain
    Thanks for providing such a nice tutorial.
    Is it possible to reduce the max number of flows in a switch as currently these are 1000000?
    If yes then how?

    Thanks…

    1. Hi Imran
      you can do it with this command
      sudo ovs-vsctl add bridge s1 flow_tables 1=@nam1 — –id=@nam1 create
      flow_table flow_limit=10

      here your flow-table size become 10

  21. Hi, anyone who can help me, i am new in this mininet software, i have assignment and i don’t know how to do that please help me, i have to design the network for small organization and plot the parameters like data rate etc using plot in minnet software. please give me the idea how to start and procedure to design that, as i even don’t know A, B, C of mininet.
    Thanks

    1. Hi Sam,

      Mininet documentation is available at:
      http://mininet.org/
      https://github.com/mininet/mininet/wiki/Documentation

      I have written many articles about Mininet on this blog. I suggest you read them in the order I list below:

      Mininet basics:
      https://brianlinkletter.com/set-up-mininet/
      https://brianlinkletter.com/mininet-test-drive/
      https://brianlinkletter.com/how-to-use-miniedit-mininets-graphical-user-interface/

      USing the POX controller with Mininet:
      https://brianlinkletter.com/using-the-pox-sdn-controller/
      https://brianlinkletter.com/visualizing-software-defined-network-topologies-using-pox-and-gephi/
      https://brianlinkletter.com/using-pox-components-to-create-a-software-defined-networking-application/

      Using the OpenDayLight controller with Mininet:
      https://brianlinkletter.com/using-the-opendaylight-sdn-controller-with-the-mininet-network-emulator/

      I hope this helps.

      Thanks,
      Brian

  22. hello Brian,
    Thnks a lot for the suggestion …finally i cud solve the miniedit problem as i was not able to run it….Sir can v create frames and make it send by the hosts in miniedit…if yes kindly suggest how
    Thnks in advance
    Richa

  23. Hi Brain,
    I have gone through the about all link and it was very helpful for me so i am able to work with mininet and opendaylight. Just i want to know miniedit of mininet and opendaylight will work together or not.

  24. Hi Brian,
    I tried to implement above Experiment with the network but i got some problem as
    there has been given that
    run a ping command to send traffic between host h1 and h8. On the MiniEdit console window, enter the following command:
    mininet>
    but i didn’t get mininet> i got mininet@mininet-vm:~# how can i resolve this problem , if i try to open new terminal and switch in mininet> using mn command all xterm h1,h2… closed. please help me if possible
    thank you in anticipation
    abha

      1. Hi brain, thanks for reply. ya i checked start CLI option box in miniedit preferences window

        thanks

        1. Hi Brain , actually i got problem in opening xterm as
          mininet> xterm: cannot load font ‘-misc-fixed-medium-r-semicondensed–13-120-75-75-c-60-iso 10646-1’. If you have any solution then please help me.

  25. Hello Brian,
    How two host say h1 and h2 exchange messages between them without typing any command evrytyime,for example say h1 sent pcket p1 and in response to that h2 sent p2 and so on.Plz help if possible

    1. The ping command should start sending messages and will not stop until you press Ctrl-C. If you need more specific types of traffic, use iperf3 on the hosts.

      1. thnks fr ur rply..actually i hv created custom packets for host1 and host2 and those packets have to exchanged between h1 and h2 continuously…hw to do that???

  26. Hi Brain,

    I am currently using Mininet to create my custom topology,each of the hosts created have a default IP address assigned to them.By connecting mininet to OpenDaylight Controller i am able to see these hosts/switches there.
    My question is : I am trying to change these host IP addresses in ODL.But it does not allow me to do so as its pre-configured in mininet.Is there a way mininedit can help me solve this problem? Or a bash script which would be able to get into mininet and change its IP from the default?
    Please let me know .

    Thanks,
    Raghu

  27. Hi Brian,

    I’m trying to set up an scenario only with routers which work with OSPF, Could it be possible? I can’t find the way to do it,

    Thanks in advance,
    Alex

  28. When I run the mininet
    c0 Cannot find required executable controller.
    Please make sure that it is installed and available in your $PATH:
    (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin)
    What is the problem here

  29. Mudassar Hussain

    Hi Brian,
    Please help me pls to resolve below issues.
    1. How can we set MAC address of switch in miniedit?
    2. How can we automate policy update in POX controller with loops?

    1. 1. You cannot set the MAC of switch ports in MiniEdit. You may edit the script generated by MiniEdit and add the commands to set the MAc address.
      2. You will need to write your own POX component to automate policy updates.

      1. Mudassar Hussain

        Thanks Brian,
        1. I tried to edit both .mn and .py files but it didn’t work.
        2. I have added and delete flows manually in switch flow table by using below commands and it is working fine.
        Command: sudo ovs-ofctl add-flow s2 dl_type=0x0800,nw_src=10.0.0.11,actions=drop
        sudo ovs-ofctl del-flows s2 dl_type=0x0800

        Now I want to automate the above flow addition and removal process via POX controller. Please help.

  30. Hi, Brian!!
    Please help me, I’m doing a network with 2 controllers but as I can see the specific configuration of each controller?

  31. Sonali Sen Baidya

    Hi,
    I am trying to ping my two hosts,but it is showing destination host not reachable.Whereas i have followed all the steps and all the steps are working properly.Can you tell me why?

  32. Sonali Sen Baidya

    Hi Brian,

    I found that the hosts under a different switch cannot be pinged by a host under another switch.Why is that so?Can you please help?

  33. Hi,

    i have created 3 switch topology where 3 hosts are connected to each switch ,i want to trunk those switches in python script.i know how to trunk them in CLI but unable to get the syntax in python please let me know the syntax in python …..

  34. Hi Brian, Thanks for this article. It really helped me lot. Actually I am working on DDOS attack prevention and mitigation. My scenario is 64 hosts connected to 4 switches and remote POX controller. But, I am confused. Before i was using two hosts say h1 and h2 from 64 hosts as attackers and h64 as web server in topology as victim. Now my proff. saying do attack from external hosts not from inside topology hosts. My question is:
    1) How do i connect external host as an attacker to switch say s1?
    2) For step 1 how to do i create external interface in openflow switch s1?
    3) On switch s1 using command s1 ifconfig -a showing all interfaces like s1-eth1, s1-eth2 etc. to which hosts are connected. eth0 is interface to which controller is connected i think and eth1 is interface of vm where mininet is running.
    Please help me out in this.I really appreciate.

  35. Hi Brian,

    I’m running MiniEdit 2.2.0.1 on Mininet 2.2.1 VM using VirtualBox and trying to follow your tutorial. What I notice is that if I clicked the “Start CLI” option and do as the warning message, i. e. before stopping the simulation with the Stop button, I use exit command at the Mininet prompt in the MiniEdit console window, then the console window is stop responding.

    Any clue on to solve this issue? Thanks.

    BR // Alfius

  36. Hi Brian,
    i am new to mininet & pox. I hav some doubts regarding pox controller.

    I created costume topology through which consists controller,switch,hosts. Now i want install some flow rules in switch dynamically, for this if i hav pox controller script how i can run on this topology ?
    i would be grateful if you can help me in this.

  37. Hi,
    I found this information very helpful. My controller is up in another terminal, I designed topology as described here, and provide the same IPs of my 3 controllers. But at last I am facing an error;

    **** Starting 3 controllers
    c0 Cannot find required executable controller.
    Please make sure that it is installed and available in your $PATH:
    (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin)

    Please reply what I am missing to install or configure?

  38. hello
    Currently i using mininet and running two floodlight controllers on two different terminal and mininet on 3rd terminal. the same task is possible using miniedit? how to specify that controller are of floodlight in miniedit?

  39. Hello could somebody help me pls ?? I cannot use any of commands in root terminal on MiniEdit.
    When i try to ping h1 and h8 it displays”command not found”.when i try also $ sudo ovs-ofctl dump-flows s1,it show me same thing.Does anyone know what is solution ??? I folow all steps

  40. Hello, I did everything like it’s explained , but ping between host does not work.Have you idea what could be a problem ?

    1. Hello Emina,you should put mannualy IP Address on every host and switch,and after use that IP address to ping,i had same problem and i resolve it on that way

    2. Hello Emina you should put mannualy some IP Address on hosts,and switch (for example 10.0.0.1) and after it you ping that address which you put on host.I had same problem but i resolve it with this

  41. hi brain
    i have problem to open miniedit
    MiniEdit running against Mininet 2.2.1
    Traceback (most recent call last):
    File “./miniedit.py”, line 3579, in
    app = MiniEdit()
    File “./miniedit.py”, line 1110, in init
    Frame.init( self, parent )
    File “/usr/lib/python2.7/lib-tk/Tkinter.py”, line 2537, in init
    Widget.init(self, master, ‘frame’, cnf, {}, extra)
    File “/usr/lib/python2.7/lib-tk/Tkinter.py”, line 2049, in init
    BaseWidget._setup(self, master, cnf)
    File “/usr/lib/python2.7/lib-tk/Tkinter.py”, line 2024, in _setup
    _default_root = Tk()
    File “/usr/lib/python2.7/lib-tk/Tkinter.py”, line 1767, in init
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
    _tkinter.TclError: no display name and no $DISPLAY environment variable

Comments are closed.

Scroll to Top