Install Mininet on Ubuntu for Network Simulation: 3 Methods That Actually Work
Install Mininet on Ubuntu for Network Simulation: 3 Methods That Actually Work
Learning computer networking is ten times easier when you can build a topology and ping it yourself. The problem: most students do not own a stack of switches. Mininet fixes that - a free, open-source network emulator that turns one Linux machine into a complete virtual network lab in seconds. What Mininet is Mininet creates a realistic virtual network - running the real kernel, switch, and application code - on a single machine, controlled through a CLI and a Python API. It is the go-to tool for learning and researching Software-Defined Networking (SDN) with OpenFlow and P4, released under a permissive BSD license. Each virtual host runs real Linux applications like ping and iperf, so experiments behave like the real thing.
Installation via APT (Easiest)
This is the simplest method for beginners. Run the following command and you're done:
sudo apt update
sudo apt install -y mininet openvswitch-switch mn
I ran exactly this on Ubuntu 24.04 and got version 2.3.0 straight from the official universe repository. For beginners, this is all you need.
Installation from Source (Latest Version)
For users who want to pick the exact version and enable extra components, follow these steps:
- Clone the official repository:
git clone https://github.com/mininet/mininet - Change into the cloned directory:
cd mininet - Checkout the specific version branch:
git checkout -b mininet-2.3.0 2.3.0 - Run the installer script:
util/install.sh -nfv
This method is most commonly used by university SDN lab reports since it gives precise control over the installed version and features.
Pre-Built VM Image
The Mininet website offers ready-made VM images for VirtualBox/VMware. This approach is ideal if your main machine runs Windows or macOS, as it avoids setting up a local development environment. Once downloaded and imported, simply run the VM to start experimenting.
After installing, verify everything works with the connectivity test:
sudo mn --test pingall
A healthy install produces the following results:
*** Results: 0% dropped (2/2 received)
Troubleshooting Notes
On some environments-particularly container-based VMs-the sudo mn --test pingall command may stall at "Adding hosts" with the error:
setns: Operation not permitted
This occurs because the environment blocks network namespace creation, which is required for every Mininet host (each being a Linux network namespace). This is an environment limitation, not a Mininet bug; on bare-metal Ubuntu or a standard VirtualBox/VMware VM, the installation runs without issues.
Additionally, the APT-installed package does not ship a default OpenFlow controller. When encountered, Mininet prints:
No default OpenFlow controller found
and automatically falls back to OVS Bridge - which is completely normal for basic topologies.
Useful Commands
Here are five essential commands to get started with Mininet on Ubuntu:
-
sudo mn- Interactive CLI with the default topology -
pingall- Connectivity test between all hosts -
h1 ping -c1 h2- Ping from a specific host -
xterm h1 h2- Open a terminal on each host exitfollowed bysudo mn -c- Quit and clean up leftover topologies
Try variations such as sudo mn --topo single,3 or sudo mn --topo linear,4 once you are comfortable with the basics. The full Indonesian walkthrough, including detailed troubleshooting for the errors mentioned above, is available in the complete Mininet on Ubuntu guide.
Comments
No comments yet. Start the discussion.