#Mininet-1
Basic Environment:
[email protected]:~$ uname -r4.13.0-43-generic[email protected]:~$ uname -aLinux parallels-vm 4.13.0-43-generic #48~16.04.1-Ubuntu SMP Thu May 17 12:56:46 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
# #Mininet基本操作:
# # #在操作前 We can use mn -h
to view the user manual
[email protected]:~$ sudo mn-husage:mn [options] (type mn-h for details), the MN utility creates mininet network from The command line. It can createparametrized topologies, invoke the Mininet CLI, and run tests. Options:-H,--help show this help message and exit--switch=switch Default|ivs|lxbr|ovs|ovsbr|ovsk|use R[,param=value ...] Ovs=ovsswitch default=ovsswitch ovsk=ovsswitch Lxbr=linuxbridge user=userswitch ivs=IVSSwitch Ovsbr=ovsbridge--host=host Cfs|proc|rt[,param=value ...] rt=cpulimitedhost{' sched ': ' RT '} proc=host cfs=cpulimitedhost{' sched ': ' CFS '}--controller=control LER Default|none|nox|ovsc|ref|remote|ryu[,param=value ...] Ovsc=ovscontroller None=nullcontroller Remote=remotecontroller Default=defaultcontroller Nox=nox Ryu=ryu Ref=controlLer--link=link default|ovs|tc|tcu[,param=value ...] default=link ovs=ovslink tcu=tculink Tc=tclink--topo=topo linear|minimal|reversed|single|torus|tree[,param=value ...] linea R=lineartopo Torus=torustopo Tree=treetopo Single=singleswitchtopo reversed= Singleswitchreversedtopo minimal=minimaltopo-c,--clean clean and exit--custom=custom Read Custom Clas SES or params from. py file (s)--test=test none|build|all|iperf|pingpair|iperfudp|pingall-x,--xterms Spawn xterms for each node-i ipbase,--ipbase=ipbase base IP address for Hosts--mac Automatically set host MACs--arp set all-pairs arp entries-v verbosity,--verbosity=verbosity Info|warning|critical|error|debug|output--innamespace SW and Ctrl in namespace? --listenport=listenport Base port for passive switch listening--nolistenport don ' t use passive listening port--pre=pre CLI script to run before tests--post=post CLI script to run after tests--pin pin h OSTs to CPU cores (requires--host CFS or--host RT)--nat [Option=val ...] adds a NAT to the topology, connects Mininet hosts to the physical network. Warning:this may route no traffic on the machine that uses mininet ' s IP subnet into the mininet Network. If you need to change mininet ' s IP subnet, see the--ipbase option. --version prints the version and exits--cluster=server1,server2 ... run on multiple SE RVers (experimental!) --placement=block|random node placement for--cluster (experimental!)
The above is the parameter we can mininet inside, below, we start to build the basic topology
# # #基本拓朴
Create the simplest network environmentsudo mn
Quickly observe which nodes are in the network(mininet)nodes
mininet> nodesavailable nodes are: c0 h1 h2 s1
Check network Lu (each node) connection status(mininet)net
mininet> neth1 h1-eth0:s1-eth1h2 h2-eth0:s1-eth2s1 lo: s1-eth1:h1-eth0 s1-eth2:h2-eth0c0
operate on a specific device(mininet) (设备名 ex. h1 ) (指令)
mininet> h1 ifconfigh1-eth0 Link encap:Ethernet HWaddr e6:06:6d:77:e4:c5 inet addr:10.0.0.1 Bcast:10.255.255.255 Mask:255.0.0.0 inet6 addr: fe80::e406:6dff:fe77:e4c5/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:59 errors:0 dropped:0 overruns:0 frame:0 TX packets:31 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:5911 (5.9 KB) TX bytes:2630 (2.6 KB)lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Close Mininet(mininet) exit
mininet> exit*** Stopping 1 controllersc0 *** Stopping 2 links..*** Stopping 1 switchess1 *** Stopping 2 hostsh1 h2 *** Donecompleted in 779.394 seconds
NOTE!!!! If there is a problem with the mininet operation (network, Unknown bug), then use sudo mn -c
can completely clean up the environment!!
Mininet (lightweight software defined network and test platform) one