Mininet Setup and Basic Use

This covers setting up the Mininet virtual machine (using VirtualBox), basic editing and terminal use within Lubuntu, and running Mininet.

I've placed a zipped 64-bit virtual-machine disk image in OneDrive. You will need to be logged in to your Loyola account to access this; there's probably a two-factor-authentication step too. Here is the link (2022 version):

https://loyolauniversitychicago-my.sharepoint.com/:u:/g/personal/pdordal_luc_edu/Ee0BZw4k-O5Pqi6uDq5Mer0BG0jrMQP9p_YuUc6DRKdwbQ

The .zip file is around 5.4 GB; the unzipped lubuntu22.vdi file is nearly 13 GB. You can run virtual machines off a USB drive, if necessary.

The lubuntu22.vdi virtual disk runs Lubuntu, a somewhat streamlined version of Ubuntu Linux. In order to get the virtual machine running, here are the two steps.

To install VirtualBox, go to virtualbox.org. Start it up; you should be looking at the "VirtualBox Manager".

Now click the "New" button at the top. Give it a name. Specify that the Type is "Linux" and the Version is "Ubuntu (64 bit)". Then, for Hard disk, select the radio button for "use an existing virtual hard disk file". At the far right side of the file-selection box is a little folder button. Click that to get the virtual-disk manager. Click "Add" and root around until you find the lubuntu.vdi disk image you unzipped.

At this point you should be able to start the virtual machine. It's a bit slow to boot, but it should eventually boot to a bluish graphical interface. You will have to log in as user "mininet", password "mininet". The VirtualBox Guest Additions have been installed, so the mouse should just work. If you have problems with the mouse, the right-cntl key "unlocks" the mouse from the virtual window.

When you're done with your Lubuntu session, just click "close" on your virtual machine and you should be asked if you want to save the machine state. If you click "yes", then you can just resume where you left off.

The directory "loyola" has several python files; some are for running Mininet. Open a terminal window (press cntl-alt-T) to run them. You will need to be root to run Mininet, so use the command sudo bash, which elevates your terminal session to root. I recommend having multiple terminal tabs (use cntl-shift-T to open a new one), with only one of them as root.

Lubuntu supports two "desktops" out of the box; so if all your windows seem to have gone away, you probably switched to the other desktop. Use the desktop icons at the lower middle-left, or else cntl-shift-left_arrow/right_arrow.

The editor is featherpad. Start it from the terminal with featherpad &; the ampersand allows you to then continue to use that terminal while leafpad is open.

You can change the terminals to a white background and dark text by using Edit => Preferences. Black is, in RGB terms, (0,0,0) while white is (255,255,255).

When starting featherpad, if you forget the '&', just leave that terminal alone, and create a new terminal tab. You can also specify a filename to open: featherpad demo.py &, but selecting the file to open with the File menu is just fine.

Here are a few very basic Linux bash commands:

Demo

For this demo, I will start Mininet with the topology below, and watch a TCP connection using WireShark.

    h1 ---- r1 ---- r2 ---- h2

We get this topology by running (as root) the command

    python routerline -N 2

in the loyola subdirectory.

At the mininet> prompt, we can run simple commands, like links and nodes. We can also run h1 ping h2, which runs the command "ping h2" on h1. Finally, if we run h1 ifconfig or h2 ifconfig, we can find the IPv4 addresses of h1 and h2. We will need these below, because the names h1 and h2 do not work in general.

For this demo, we can open an xterm terminal window on each of h1, r1 and h2 with xterm h1 r1 h2 at the mininet> prompt. Three black terminal windows should open up.

In the h2 window, we will run netcat -l 5432, which sets up netcat as a "listener" on port 5432.

On r1 we will start Wireshark, using the command wireshark. Have it listen on interface r1-eth0. 

Finally, on h1, run netcat 10.0.2.10 5432 (the 10.0.2.10 should be the IPv4 address of h2). You should see the three-way handshake. Type a couple data lines, such as "hello" or "floccinaucinihilipilification". Then press cntl-D to exit. You should see the strings printed on h2; you should also be able to see the data in the tcpdump output. Finally, you should see the closing handshake.


Getting files off your virtual machine

This is not quite straightforward! Here are two well-known solutions from makeuseof.com/tag/transfer-files-virtual-machine-guest-host-pc:

But here are three other ways that might be easier: