Mininet is a very powerful virtual network emulation system that’s generally used in SDN development environments. With Mininet, a complex network with hundreds of switches can be simulated in a laptop and this opens up testing real-life network usecases. I have covered Mininet usage in 1 of my earlier blogs on tools used with Opendaylight. I have always wondered about how Mininet works under the hood. Recently, i went through a Stanford webinar which shed details on the Mininet internals. In this blog, I will cover Mininet internals along with a sample network that I tried out. 1 of the key concepts used in Mininet is Network namespaces which is also the basis for Linux containers. I will also cover briefly about Network namespaces in this blog.
Network Namespaces:
Network namespaces allows for creation of virtual networking domain with its own set of interfaces, ip addresses, routing table etc. This is similar to VRF in Cisco terminology. Network namespaces connect to outside world using virtual ethernet links. Virtual ethernet link is a wire with 2 endpoints, typically 1 end point is located in local namespace and another in global namespace. Network namespaces are also used in Docker and Openstack Neutron. With Openstack neutron, Network namespaces allows for isolating tenants as well as to have overlapping IP addresses.
Mininet internals:
Mininet uses the following Linux concepts:
- Network namespaces are used to implement hosts or endpoints. Each host will have its own set of interfaces, IP and routing table.
- Openvswitch or Linux switch is used to implement switches. Openvswitch is used by default. Openflow is used to program data path and ovsdb is used for setting up configuration on Openvswitch.
- Controller could be any Openflow controller like Opendaylight, Floodlight etc.
- For controlling link characteristics like bandwidth, latency, Linux tc tool is used.
- For limiting CPU usage of individual namespaces, Linux cpu groups is used.
- Mininet uses a Python wrapper on top of the above tools as well as other Linux tools like perf to present a high level abstraction.
Hands-on:
To try out the different concepts above, I have the following environment:
- Ubuntu 12.04
- Opendaylight controller helium release.
- Openvswitch 2.1.3
- Mininet 2.1.0
Continue reading Mininet Internals and Network Namespaces →