Skip to content

Commit a6eb777

Browse files
committed
Add a Mininet details markdown page
1 parent 08d464a commit a6eb777

File tree

3 files changed

+129
-3
lines changed

3 files changed

+129
-3
lines changed

MN.md

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# Mininet: `mn`
2+
3+
`mn` - create a Mininet network. (`v2.3.0`)
4+
5+
---
6+
7+
## Synopsis
8+
9+
```
10+
mn [options]
11+
```
12+
13+
## Description
14+
15+
```
16+
(type mn -h for details)
17+
18+
The mn utility creates Mininet network from the command line. It can create parametrized
19+
topologies, invoke the Mininet CLI, and run tests.
20+
```
21+
22+
## Options
23+
24+
```
25+
-h, --help
26+
show this help message and exit
27+
28+
--switch=SWITCH
29+
default|ivs|lxbr|ovs|ovsbr|ovsk|user[,param=value...] user=UserSwitch
30+
ovs=OVSSwitch ovsbr=OVSBridge ovsk=OVSSwitch ivs=IVSSwitch lxbr=LinuxBridge
31+
default=OVSSwitch
32+
33+
--host=HOST
34+
cfs|proc|rt[,param=value...] proc=Host rt=CPULimitedHost{'sched': 'rt'}
35+
cfs=CPULimitedHost{'sched': 'cfs'}
36+
37+
--controller=CONTROLLER
38+
default|none|nox|ovsc|ref|remote|ryu[,param=value...] ref=Controller
39+
ovsc=OVSController nox=NOX remote=RemoteController ryu=Ryu
40+
default=DefaultController none=NullController
41+
42+
--link=LINK
43+
default|ovs|tc|tcu[,param=value...] default=Link tc=TCLink tcu=TCULink ovs=OVSLink
44+
45+
--topo=TOPO
46+
linear|minimal|reversed|single|torus|tree[,param=value ...] minimal=MinimalTopo
47+
linear=LinearTopo reversed=SingleSwitchReversedTopo single=SingleSwitchTopo
48+
tree=TreeTopo torus=TorusTopo
49+
50+
-c, --clean
51+
clean and exit
52+
53+
--custom=CUSTOM
54+
read custom classes or params from .py file(s)
55+
56+
--test=TEST
57+
pingall|pingpair|iperf|iperfudp|all|none|build
58+
59+
-x, --xterms
60+
spawn xterms for each node
61+
62+
-i IPBASE, --ipbase=IPBASE
63+
base IP address for hosts
64+
65+
--mac automatically set host MACs
66+
67+
--arp set all-pairs ARP entries
68+
69+
-v VERBOSITY, --verbosity=VERBOSITY
70+
debug|info|output|warning|warn|error|critical
71+
72+
--innamespace
73+
sw and ctrl in namespace?
74+
75+
--listenport=LISTENPORT
76+
base port for passive switch listening
77+
78+
--nolistenport
79+
don't use passive listening port
80+
81+
--pre=PRE
82+
CLI script to run before tests
83+
84+
--post=POST
85+
CLI script to run after tests
86+
87+
--pin pin hosts to CPU cores (requires --host cfs or --host rt)
88+
89+
--nat [option=val...] adds a NAT to the topology that connects Mininet hosts to the
90+
physical network. Warning: This may route any traffic on the machine that uses
91+
Mininet's IP subnet into the Mininet network. If you need to change Mininet's IP
92+
subnet, see the --ipbase option.
93+
94+
--version
95+
prints the version and exits
96+
97+
-w, --wait
98+
wait for switches to connect
99+
100+
-t WAIT, --twait=WAIT
101+
timed wait (s) for switches to connect
102+
103+
--cluster=server1,server2...
104+
run on multiple servers (experimental!)
105+
106+
--placement=block|random
107+
node placement for --cluster (experimental!)
108+
```
109+
110+
## Examples
111+
112+
Create a linear topology with 3 switches, using Linux Bridge switches, no controller, and automatic MAC addressing:
113+
114+
```
115+
sudo mn --topo=linear,3 --mac --switch=lxbr --controller=none
116+
```
117+
118+
Create a tree topology of depth 2 and fanout 3, using Open vSwitch switches and a remote controller at IP address 192.168.1.100:
119+
120+
```
121+
sudo mn --topo=tree,2,3 --switch=ovs --controller=remote,ip=192.168.1.100
122+
```

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
all: output/lab-handout.html output/lab-material.zip
1+
all: output/lab-handout.html output/lab-material.zip output/MN.html
22

33
output/lab-handout.html: .resources/metadata.md README.md .resources/pandoc.css
44
mkdir -p output
55
cat .resources/metadata.md README.md | pandoc -s -f markdown+task_lists -t html5 --css .resources/pandoc.css --lua-filter=.resources/enable-checkbox.lua --embed-resources -o output/lab-handout.html
66

7+
output/MN.html: .resources/metadata.md MN.md .resources/pandoc.css
8+
mkdir -p output
9+
cat .resources/metadata.md MN.md | pandoc -s -f markdown+task_lists -t html5 --css .resources/pandoc.css --lua-filter=.resources/enable-checkbox.lua --embed-resources -o output/MN.html
10+
711
output/lab-material.zip: topology.py server.py solution/Makefile .devcontainer.json
812
mkdir -p output
913
zip -j output/lab-material.zip topology.py server.py solution/Makefile .devcontainer.json

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ In the previous task, we extended our Mininet topology to include a router and t
310310

311311
NAT is a technique that allows multiple devices in a private network to share a single public IP address when accessing the Internet. It works by modifying the source IP address and port number of outgoing packets from devices in the private network to the public IP address and a unique port number assigned by the router. When the response packets return from the Internet, the router translates the destination IP address and port number back to the original private IP address and port number of the device that initiated the request.
312312

313-
The Linux operating system provides built-in support for NAT through the use of iptables, a powerful firewall and packet filtering tool. To enable NAT on the router host in our Mininet topology, we need to configure iptables to perform source NAT (SNAT) for outgoing packets from the home network to the Internet services.
313+
The Linux OS provides built-in support for NAT through the use of iptables, a powerful firewall and packet filtering tool. To enable NAT on the router host in our Mininet topology, we need to configure iptables to perform source NAT (SNAT) for outgoing packets from the home network to the Internet services.
314314

315315
You can enable NAT on the router host by running the following commands in the Mininet CLI:
316316

@@ -321,4 +321,4 @@ mininet> router iptables -t nat -A POSTROUTING -o router-eth2 -j MASQUERADE
321321

322322
These commands add rules to the NAT table in iptables that specify that outgoing packets on interfaces `router-eth1` and `router-eth2` should have their source IP address modified to the IP address of the respective interface (i.e., perform source NAT). The `MASQUERADE` target is used to automatically determine the appropriate source IP address based on the outgoing interface.
323323

324-
> **Your task**: After enabling NAT on the router, test connectivity from the home network hosts to the Internet services by running the following commands in the Mininet CLI:
324+
> **Your task**: After enabling NAT on the router, test connectivity from the home network hosts to the Internet networks, answer the questions in the final part of the [Week1 Unassessed Quiz](https://modules.lancaster.ac.uk/mod/quiz/view.php?id=2824281).

0 commit comments

Comments
 (0)