1、-*, -*terms spawn *terms for each node-i IPBASE, -ipbase=IPBASEbase IP address for hosts-mac automatically set host MACs-arp set all-pairs ARP entries-v VERBOSITY, -verbosity=VERBOSITYinfo|warning|critical|error|debug|output-innamespace sw and ctrl in namespace-listenport=LISTENPORTbase port for pas
2、sive switch listening-nolistenport dont use passive listening port-pre=PRE CLI script to run before tests-post=POST CLI script to run after tests-pin pin hosts to CPU cores (requires -host cfs or -hostrt)-version如上所示,输出了 mn 的帮助信息。Start Wireshark为了使用 Wireshark 来查看 OpenFlow 的控制信息,我们先翻开 Wireshark 并让他在后
3、台运行。$ sudo wireshark &在 Wireshark 的过滤选项中,输入of,然后选择 Apply。In Wireshark, click Capture, then Interfaces, then select Start on the loopback interface (lo).现在窗口上暂时应该没有任何 OpenFlow 的数据包。注:在Mininet VM镜像中Wireshark是默认已经安装的。如果你的系统中没有Wireshark的和OpenFlow,您可以使用Mininet的install.sh脚本,按以下步骤安装:$ cd $ git clone s:/git
4、hub./mininet/mininet如果它尚不存在$ mininet/util/install.sh -w如果已经安装了 Wireshark,但是运行不了e.g. 你得到一个类似$DISPLAY not set之类的错误信息,可以参考 FAQ,: s:/github./mininet/mininet/wiki/FAQ*wiki-*11-forwarding设置好 *11就可以正常运行 GUI 程序,并且使用 *term 之类的终端仿真器了,后面的演示中可以用到。Interact with Hosts and SwitchesStart a minimal topology and ente
5、r the CLI:$ sudo mn默认的最小拓扑构造包含有两台主机h1,h2,还有一个 OpenFlow 的交换机,一个 OpenFlow 的控制器四台设备。这种拓扑接口也可以使用-topo=minimal来指定。当然我们也可以使用其他的拓扑构造,具体信息可以看-topo的信息。现在四个实体h1,h2,c0,s1都在运行着。c0作为控制器,是可以放在虚拟机外部的。如果没有具体的测试作为参数传递时,我们可以使用 Mininet 交互。在Wireshark的窗口中,你会看到核交换机连接到控制器。显示Mininet CLI命令:mininet helpDocumented mands (type
6、 help ):=EOF e*it intfs link noecho pingpair py source *termdpctl gterm iperf net pingall pingpairfull quit timedump help iperfudp nodes pingallfull p* sh *You may also send a mand to a node using: mand argsFor e*ample: mininet h1 ifconfigThe interpreter automatically substitutes IP addressesfor nod
7、e names when a node is the first arg, so mandslike h2 ping h3should work.Some character-oriented interactive mands requirenoecho: noecho h2 vi foo.pyHowever, starting up an *term/gterm is generally better: *term h2显示节点: nodesavailable nodes are:c0 h1 h2 s1显示网络: neth1 h1-eth0:s1-eth1h2 h2-eth0:s1-eth
8、2s1 lo: s1-eth1:h1-eth0 s1-eth2:h2-eth0c0输出所有节点的信息: dumpHost h2: h2-eth0:10.0.0.2 pid=3279OVSSwitch s1: lo:127.0.0.1,s1-eth1:None,s1-eth2:None pid=3282OVSController c0: 127.0.0.1:6633 pid=3268从上面的输出中,你可以看到有一台交换机和两台主机。在 Mininet 的CLI 中第一个字符串是设备名,那后面的命令就在该设备上执行。例如我们想在h1设备上执行ifconfig则输入如下命令: h1 ifconfig
9、 -ah1-eth0 Link encap:Ethernet HWaddr 3e:94:43:b1:ad:48 inet addr:10.0.0.1 Bcast:10.255.255.255 Mask:255.0.0.0 inet6 addr: fe80:3c94:43ff:feb1:ad48/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 R* packets:22 errors:0 dropped:0 overruns:0 frame: T* packets:8 errors:0 carrier: collisi
10、ons:0 t*queuelen:1000 R* bytes:1764 (1.7 KB) T* bytes:648 (648.0 B)lo Link encap:Local Loopback127.0.0.1 Mask: :1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:0 errors:0 (0.0 B) T* bytes:0 (0.0 B)上面的输出中,可以看见h1-eth0跟lo两个接口,需要注意的是,在 Linu* 系统的 shell 中运行ifconfig是看不到h1-eth0。与h1-eth0相反的是,switch默认是跑
11、在 root 的网络namespace上面,所以在switch上执行命令与在 Linu* 下的 shell 中是一样的。 s1 ifconfig-aeth0 Link encap:Ethernet HWaddr 08:00:27:98:dc:aa10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0a00:27ff:fe98:dcaa/64 Scope:46716 errors:40265 errors:10804203 (10.8 MB) T* bytes:40122199 (40.1 MB)43654 errors:37264504 (37.2 MB)
12、T* bytes:37264504 (37.2 MB)l*cbr0 Link encap:Ethernet HWaddr fe:5e:f0:f7:a6:f310.0.3.1 Bcast:10.0.3.255 Mask:a8c4:b5ff:fea6:2809/64 Scope:52 errors:20 errors:4759 (4.7 KB) T* bytes:2952 (2.9 KB)ovs-system Link encap:79:59:3d:d9:bb BROADCAST MULTICAST MTU:s1 Link encap:Ethernet HWaddr 6e:8c:5d:91:d5:
13、44fc47:8aff:fe6a:4155/64 Scope: UP BROADCAST RUNNING MTU:13 errors:1026 (1.0 KB) T* bytes:s1-eth1 Link encap:Ethernet HWaddr 5e:a2:86:f3:b15ca2:f7ff:fe86:f3b1/64 Scope:648 (648.0 B) T* bytes:1764 (1.7 KB)s1-eth2 Link encap:Ethernet HWaddr b2:c6:37:e0:61b0c6:37ff:fee0:d961/64 Scope:21 errors:1674 (1.
14、6 KB)veth14524J Link encap:ca:13:f5:dd:b4fcca:13ff:fef5:ddb4/64 Scope:40 errors:4190 (4.1 KB)veth2K19CE Link encap:f1:e8:49:45fcf1:fee8:4945/64 Scope:42 errors:4370 (4.3 KB)veth9WSHRK Link encap:87:1d:33:f6:41fc87:1dff:fe33:f641/64 Scope:43 errors:4460 (4.4 KB)vethH2K7R5 Link encap:fc5e:f0ff:fef7:a6
15、f3/64 Scope:14 errors:48 errors:1776 (1.7 KB) T* bytes:5030 (5.0 KB)vethO99MI2 Link encap:cf:ee:97:fb:7ffccf:eeff:fe97:fb7f/64 Scope:51 errors:1767 (1.7 KB) T* bytes:5294 (5.2 KB)上面的输出中包含交换机的虚拟网卡 s1,以及主机的 eth0。为了区别显示host 主机的网络是隔离的,我们可以通过arp与route命令来做演示,分别在 s1与h1上面演示如下: s1 arpAddress HWtype HWaddress
16、 Flags Mask Ifacelocalhost ether 00:16:3e:54:9c:03 C l*cbr0localhost ether 52:12:35:02 C eth003 C eth051:24:a7 C l*cbr0 s1 routeKernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Ifacedefault localhost 0.0.0.0 UG 0 0 0 eth010.0.2.0 * 255.255.255.0 U 0 0 0 eth010.0.3.0 * 255.255.
17、255.0 U 0 0 0 l*cbr0172.17.0.0 * 255.255.0.0 U 0 0 0 docker0 h1 arp h1 route10.0.0.0 * 255.0.0.0 U 0 0 0 h1-eth0这样可以做到将每一个主机,交换机,以及控制器都放到他自己的标准的 network namespace 中,但是这种做法并没有什么特别的优势,除非你想复制一个非常复杂的网络。Mininet 不支持这种做法,你可以通过-innamespace参数来查看更多的信息。感觉有点像 L*C 或者说想最近比拟火的 Docker注意:只有网络是虚拟出来的,每一个主机里面的进程使用的都是同一套目录,可以看到一样的进程集合,我们打印不同主机下面的进程列表看看: h1 ps -a PID TTY TIME CMD 3899 pts/3 00:
copyright@ 2008-2023 冰点文库 网站版权所有
经营许可证编号:鄂ICP备19020893号-2