Lecture 4 Mininet¶
Introduction¶
- How to maintain connection between two hosts without high cost?
- Easily Utilized on Laptop
- linux命令行 + 进入root用户 (su)
Create Network Namespaces¶
| Bash | |
|---|---|
1 2 3 4 | |
Hence, there are 3 network namespaces in system now
- h1
- h2
- root

Create Virtual Ethernet Pair¶
| Bash | |
|---|---|
1 2 3 4 | |
Hence, we created 2 links now in the root namespace
- h1-eth0 => s1-eth1
- h2-eth0 => s1-eth2

Move Ports into Host Namespaces¶
| Bash | |
|---|---|
1 2 3 4 5 | |
Now, we put NIC h1-eth0 and h2-eth0 into namespace h1 and h2 independently
Hence, if we try to input "ip link show" in the CLI now:
We will not see the link h1-eth0->s1-eth1 and h2-eth0->s1-eth2

Configure Host Interfaces¶
| Bash | |
|---|---|
1 2 3 4 | |
In fact, ip netns exec h1 ifconfig lo up and ip netns exec h2 ifconfig lo up can be ignored practically

Create Virtual Switch¶
| Bash | |
|---|---|
1 2 3 | |
ovs-vsctl是 Open vSwitch 的管理工具之一,用于配置和管理 OVS。show参数指示该命令显示当前 OVS 的配置信息,包括网桥、端口、控制器、流表等。
运行 ovs-vsctl show 命令将列出当前 OVS 实例中的各种配置信息

Create Switch Ports to OVS¶
| Bash | |
|---|---|
1 2 3 | |
The ports of S1 Switch are connected with links

Test the Network¶
| Bash | |
|---|---|
1 2 3 4 | |

Test Client and Server¶
| Bash | |
|---|---|
1 2 | |

Mininet¶
Mininet creates a realistic virtual network, running real kernel, switch and application code, on a single machine (VM/cloud/native), in seconds, with a single command
Traits:
- A simple API that did this for us automatically
- Easily create topologies of varying size
- You must make orders in su
A summary for the listed orders above:

They can be easily transmitted as below:
| Bash | |
|---|---|
1 2 3 4 5 6 7 8 9 | |
Show Nodes and Links¶
| Bash | |
|---|---|
1 2 | |
| Bash | |
|---|---|
1 2 | |
| Bash | |
|---|---|
1 2 | |
Show Interface Configurations¶
| Bash | |
|---|---|
1 2 3 4 5 | |
| Bash | |
|---|---|
1 2 3 4 5 | |
Show the Process¶
| Bash | |
|---|---|
1 2 3 4 | |
Conclusion
- Only the network is virtualized
- Each host process sees the same set of processes and directories
Test Connectivity¶
| Bash | |
|---|---|
1 2 3 4 5 | |
Simple Web Server and Client¶
| Bash | |
|---|---|
1 2 3 | |
Customize Topologies¶
详见Lab1 Tutorial