Introduction to Mininet, Lecture notes of Network Design

An introduction to Mininet, a network emulator that allows network software to be run as is. It includes lab settings, objectives, and a lab roadmap. The document covers topics such as invoking Mininet using the CLI, building and emulating a network using the GUI, and configuring a router. It also includes references for further reading.

Typology: Lecture notes

2021/2022

Uploaded on 05/11/2023

obesix
obesix 🇺🇸

4.3

(19)

237 documents

1 / 26

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
SOFTWARE DEFINED NETWORKING
Lab 1: Introduction to Mininet
Document Version: 05-27-2020
Award 1829698
CyberTraining CIP: Cyberinfrastructure Expertise on High-throughput
Networks for Big Science Data Transfers
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a

Partial preview of the text

Download Introduction to Mininet and more Lecture notes Network Design in PDF only on Docsity!

SOFTWARE DEFINED NETWORKING

Lab 1: Introduction to Mininet

Document Version: 05 - 27 - 2020

Award 1829698

“CyberTraining CIP: Cyberinfrastructure Expertise on High-throughput

Networks for Big Science Data Transfers”

Contents

  • Overview
  • Objectives............................................................................................................................
  • Lab settings
  • Lab roadmap
  • 1 Introduction to Mininet
  • 2 Invoke Mininet using the CLI
    • 2.1 Invoke Mininet using the default topology
    • 2.2 Test connectivity
  • 3 Build and emulate a network in Mininet using the GUI
    • 3.1 Build the network topology
      1. 2 Test connectivity
    • 3.3 Automatic assignment of IP addresses
    • 3.4 Save and load a Mininet topology
  • 4 Configure router r1
    • 4.1 Verify end-hosts configuration...........................................................................
    • 4.2 Configure router’s interface
    • 4.3 Verify router r1 configuration
    • 4.4 Test connectivity between end-hosts
  • References

an inexpensive solution and streamlined development running in line with production networks^1. Mininet offers the following features:

  • Fast prototyping for new networking protocols.
  • Simplified testing for complex topologies without the need of buying expensive hardware.
  • Realistic execution as it runs real code on the Unix and Linux kernels.
  • Open source environment backed by a large community contributing extensive documentation. Figure 1. Hardware network vs. Mininet emulated network. Mininet is useful for development, teaching, and research as it is easy to customize and interact with it through the CLI or the GUI. Mininet was originally designed to experiment with OpenFlow^2 and Software-Defined Networking (SDN)^3. This lab, however, only focuses on emulating a simple network environment without SDN-based devices. Mininet’s logical nodes can be connected into networks. These nodes are sometimes called containers, or more accurately, network namespaces. Containers consume sufficiently fewer resources that networks of over a thousand nodes have created, running on a single laptop. A Mininet container is a process (or group of processes) that no longer has access to all the host system’s native network interfaces. Containers are then assigned virtual Ethernet interfaces, which are connected to other containers through a virtual switch^4. Mininet connects a host and a switch using a virtual Ethernet (veth) link. The veth link is analogous to a wire connecting two virtual interfaces, as illustrated below. Figure 2. Network namespaces and virtual Ethernet links. h1 (^) s1 s2 h s Mininet Emulated Network Hardware Network

Each container is an independent network namespace, a lightweight virtualization feature that provides individual processes with separate network interfaces, routing tables, and Address Resolution Protocol (ARP) tables. Mininet provides network emulation opposed to simulation, allowing all network software at any layer to be simply run as is ; i.e. nodes run the native network software of the physical machine. On the other hand, in a simulated environment applications and protocol implementations need to be ported to run within the simulator before they can be used. 2 Invoke Mininet using the CLI The first step to start Mininet using the CLI is to start a Linux terminal. 2.1 Invoke Mininet using the default topology Step 1. Launch a Linux terminal by holding the Ctrl+Alt+T keys or by clicking on the Linux terminal icon. Figure 3. Shortcut to open a Linux terminal. The Linux terminal is a program that opens a window and permits you to interact with a command-line interface (CLI). A CLI is a program that takes commands from the keyboard and sends them to the operating system for execution. Step 2. To start a minimal topology, enter the command shown below. When prompted for a password, type password and hit enter. Note that the password will not be visible as you type it. sudo mn

Figure 6. Mininet’s help command. Step 4. To display the available nodes, type the following command: nodes Figure 7. Mininet’s nodes command. The output of this command shows that there is a controller, two hosts (host h1 and host h2), and a switch (s1). Step 5. It is useful sometimes to display the links between the devices in Mininet to understand the topology. Issue the command shown below to see the available links. net

Figure 8. Mininet’s net command. The output of this command shows that:

  1. Host h1 is connected using its network interface h1-eth0 to the switch on interface s1-eth.
  2. Host h2 is connected using its network interface h2-eth0 to the switch on interface s1-eth.
  3. Switch s1: a. has a loopback interface lo. b. connects to h1-eth0 through interface s1-eth. c. connects to h2-eth0 through interface s1-eth.
  4. Controller c0 is the brain of the network, where it has a global knowledge about the network. A controller instructs the switches on how to forward/drop packets in the network. Mininet allows you to execute commands on a specific device. To issue a command for a specific node, you must specify the device first, followed by the command. Step 6. To proceed, issue the command: h1 ifconfig

Figure 1 1. Stopping the emulation using exit. The command sudo mn - c is often used on the Linux terminal (not on the Mininet CLI) to clean a previous instance of Mininet (e.g., after a crash). 3 Build and emulate a network in Mininet using the GUI In this section, you will use the application MiniEdit^5 to deploy the topology illustrated below. MiniEdit is a simple GUI network editor for Mininet. Figure 12. Lab topology. 3.1 Build the network topology Step 1. A shortcut to MiniEdit is located on the machine’s Desktop. Start MiniEdit by clicking on MiniEdit’s shortcut. When prompted for a password, type password. Figure 13. MiniEdit Desktop shortcut.

MiniEdit will start, as illustrated below. Figure 14. MiniEdit Graphical User Interface (GUI). The main buttons in this lab are:

  1. Select : allows selection/movement of the devices. Pressing Del on the keyboard after selecting the device removes it from the topology.
  2. Host : allows addition of a new host to the topology. After clicking this button, click anywhere in the blank canvas to insert a new host.
  3. Legacy switch : allows addition of a new legacy switch to the topology. After clicking this button, click anywhere in the blank canvas to insert the switch.
  4. Link : connects devices in the topology (mainly switches and hosts). After clicking this button, click on a device and drag to the second device to which the link is to be established.
  5. Run : starts the emulation. After designing and configuring the topology, click the run button.
  6. Stop : stops the emulation. Step 2. To build the topology illustrated in Figure 12 , two hosts and one switch must be deployed. Deploy these devices in MiniEdit, as shown below.

Step 1. Click on the Run button to start the emulation. The emulation will start and the buttons of the MiniEdit panel will gray out, indicating that they are currently disabled. Figure 1 7. Starting the emulation. Step 2. Open a terminal on host h1 by holding the right click on host h1 and selecting Terminal. This opens a terminal on host h1 and allows the execution of commands on the host h1. Repeat the procedure on host h2. Figure 18. Opening a terminal on host h1. The network and terminals at host h1 and host h2 will be available for testing.

Figure 19. Terminals at host h1 and host h2. Step 3. On host h1’s terminal, type the command shown below to display its assigned IP addresses. The interface h1-eth0 at host h1 should be configured with the IP address 10.0.0.1 and subnet mask 255.0.0.0. ifconfig Figure 20. Output of ifconfig command on host h1. Repeat Step 3 on host h2. Its interface h2-eth0 should be configured with IP address 10.0.0. 2 and subnet mask 255.0.0.0. Step 4. On host h1’s terminal, type the command shown below. This command tests the connectivity between host h1 and host h2. To stop the test, press Ctrl+c. The figure

Figure 23. Host h1 properties. Step 2. Click on Edit , Preferences button. The default IP base is 10.0.0.0/8. Modify this value to 15.0.0.0/8, and then press the OK button. Figure 24. Modification of the IP Base (network address and prefix length). Step 3. Run the emulation again by clicking on the Run button. The emulation will start and the buttons of the MiniEdit panel will be disabled. Step 4. Open a terminal on host h1 by holding the right click on host h1 and selecting Terminal.

Figure 25. Opening a terminal on host h1. Step 5. Type the command shown below to display the IP addresses assigned to host h1. The interface h1-eth0 at host h1 now has the IP address 15 .0.0.1 and subnet mask 255.0.0.0. ifconfig Figure 26. Output of ifconfig command on host h1. You can also verify the IP address assigned to host h2 by repeating Steps 4 and 5 on host h2’s terminal. The corresponding interface h2-eth0 at host h2 has now the IP address 15 .0.0.2 and subnet mask 255.0.0.0. Step 6. Stop the emulation by clicking on Stop button.

Figure 29. Opening a topology. 4 Configure router r In the previous section, you loaded a topology that consists in two networks directly connected to router r1. Consider Figure 30. In this topology two LANs, defined by switch s1 and switch s2 are connected to router r1. Initially, host h1 and host h2 do not have connectivity thus, you will configure router r1’s interfaces in order to establish connectivity between the two networks. Figure 30. Topology. Table 2 summarized the IP addresses used to configure router r1 and the end-hosts. Table 2. Topology information. Device Interface IIP Address Subnet Default gateway r r1-eth0 192.168.1.1 /24 N/A r1-eth1 192.168. 2 .1 / 24 N/A h1 h1-eth0 192.168.1.10 /24 192.168.1.

h2 h2-eth0 192.168.2.10 /24 192.168.2. Step 1. Click on the Run button to start the emulation. The emulation will start and the buttons of the MiniEdit panel will gray out, indicating that they are currently disabled. Figure 31. Starting the emulation. 4.1 Verify end-hosts configuration In this section, you will verify that the IP addresses are assigned according to Table 2. Additionally, you will check routing information. Step 1. Hold right-click on host h1 and select Terminal. This opens the terminal of host h1 and allows the execution of commands on that host. Figure 32. Opening a terminal on host h1. Step 2. In host h1 terminal, type the command shown below to verify that the IP address was assigned successfully. You will verify that host h1 has two interfaces, h1-eth configured with the IP address 192.168.1.10 and the subnet mask 255.255.255.0 and, the loopback interface lo configured with the IP address 127.0.0.1. ifconfig