Network Virtualization with Mininet (text)

by Sasha Shkrebets last modified Mar 06, 2023 01:17 PM
We are continuing our study of network virtualization. And, in this lesson, we will talk about virtual networking in Mininet.
Welcome back.
We are continuing our study of network virtualization.
And, in this lesson, we will talk about virtual networking in Mininet.
I've divided this lesson into two parts.
The first part of the lesson will cover the why and how
of Mininet, in particular, what Mininet is useful for and how it works.
In the next part of this lesson we will look at various examples
of using Mininet to create emulated network topologies,
and I will also present various demonstrations of how to use Mininet.
Mininet is essentially a virtual network environment that runs on a single PC.
That is particularly useful for experimentation and
learning in a course like this one.
Because you can complete all of the assignments, and learn about SDN and Open
Flow simply using a virtual network machine that's running on your PC at home.
Mininet runs a real kernel, it can run real switch software,
and it can run real application code on a single machine.
It provides Command-line graphical user interfaces
and Python interfaces to interact with it.
And, most importantly for this course, many OpenFlow
features are already built in to the environment.
So this is particularly useful for developing, deploying, and sharing
various things you might do in the Mininet programming environment.
So why use Mininet?
One, as we'll see, it's very fast.
It's very easy to set up a network in Mininet.
And in fact we'll even do it in this lecture.
It's also possible and actually very easy to create custom topologies.
Third, hosts in the Mininet environment can actually run real programs.
So anything that can run on Linux can actually run on a Mininet host as well.
That's because Mininet uses something called OS virtualization,
which basically means that it's running on Linux.
So, any program that can run on Linux can also run on a Mininet virtual host.
Fourth, it supports programmable open flow switches.
What that means is that, we can create a virtual network in Mininet,
and connect a real open flow controller to real software open flow
switches, that are running in the virtual network environment.
And as we'll see it's also very easy to use.
It's clear to me now that a lot of you may not have a lot of programming
experience, and therefore some of this may seem a little bit daunting.
But I want to assure you that the amounts
of programming that's required to get familiar with SDN programming
and controllers in Mininet is fairly straight forward and easy even for
someone who has relatively little prior programming experience.
And in fact in this lecture we'll do a little bit of programming
just to show you and demonstrate how easy it is to use Mininet.
Finally, Mininet is open source.
That means that not only can you examine how everything works but
also if you should want to add things to the Mininet environment.
It is fairly easy to do so because everything is open source.
So before we jump into the nuts and
bolts of Mininet, let's consider various design alternatives.
Well one is to deploy everything on a real system,
so you could deploy real servers, switches, and so forth.
Of course this is a huge pain to configure, right?
Suppose that you want a network topology with a particular configuration
or particular interconnections between the servers and switches.
Well, you can set that up once.
You can rack your machines, you can wire everything up
to the switch, you can configure the switch, and so forth.
But suppose now you want to run a different experiment.
Well you've gotta go back and reconfigure everything all over again.
And, in contrast, using Mininet makes it fairly easy to reconfigure
these types of topologies because it's all in software.
Another way that you could do this is to use network virtual machines.
So you could imagine running lots and lots of
virtual machines, say, on your laptop, or on your desktop.
And then, network them together with a
software switch that's running on your host.
The problem with that is that typically virtual
machines are fairly heavy weight, so there's a
limit to the number of virtual machines that
you can run concurrently on a single host.
So, one of the advantages to Mininet that we'll see is that the OS based
virtualization that it uses is lightweight enough that it can support
hundreds, or potentially even thousands of hosts even on a single PC.
Of course the third alternative is to use simulation, but the
problem with that is that there's no clear path to hardware deployment.
In particular, because everything is simulated and there's
no real running software, and time or timing is not necessarily
accurate, then it can be somewhat unclear how to transition an
experiment that's run in simulation to a real working deployment.
[BLANK_AUDIO].
I just want to take one slide where we look at how Mininet works in a
nutshell and as we walk through certain examples,
I'd like you to understand what's actually going on.
So, let's start over here on the left side of this figure.
When we run Mininet, we'll often run something called
MN, which is a launcher for the Mininet process.
That process then controls the
sub-processes, each of which represent
a single host running in the network.
So, for example, let's suppose that I want to have a network with two hosts.
The Mininet launcher would launch two bash processes
and then it would create a unique network namespace
for each of those processes, so host 2, h2, and
h3 would each have their own network name space.
And that's done with the Linux network namespaces
mechanism which is now native in the Linux kernel.
At that point, each host or each process represents a
host, and each of these processes has its own network namespace.
And the next thing that happens is
Mininet creates what are called, virtual ethernet pairs.
And so the idea here is to create a tunnel between the virtual
interface that's in the namespace of a particular subprocess.
For example, here the h2 namespace has a virtual interface.
We need to connect that to a real
interface that's sitting in the root network namespace.
The reason we want to do that is
because eventually we're going to connect it to a switch.
So each one of these hosts has a virtual ethernet pair.
And each pair is assigned to the namespace that corresponds to the virtual
host that represents that particular node in the virtual network.
[BLANK_AUDIO].
Once those virtual ethernet pairs are
assigned, are created and assigned to namespaces.
We can then create an OpenFlow switch, to connect those hosts.
And finally, we can instantiate a controller that uses the
OpenFlow protocol to control flow table entries in that switch and
those entries that sit in this switch here ultimately allow packets
to travel between each of these hosts in the virtual network.
And finally, this entire setup is contained within a single virtual machine.
So all this is basically running in a virtual machine on your PC.
In summary, Mininet is a network emulator that
runs in a virtual machine on a single node.
It uses lightweight OS virtualization to achieve scale and it's fast, easy to use
and it makes it very easy to share various configurations, solutions, set-ups, etc.
In the next part of the lesson we will use Mininet to
construct various examples of network topologies using
both the MN wrapper and directly with the Python API.
Navigation