学习资料:
详细安装教程 http://mininet.org/download/
workthrough http://mininet.org/walkthrough/
1.mininet的几个常见基本查询命令
Display Mininet CLI commands:
mininet> help
Display nodes:
mininet> nodes
Display links:
mininet> net
Dump information about all nodes:
mininet> dump
2.host之间的互ping命令
mininet> h1 ping -c 1 h2
3.测试命令
$ sudo mn --test pingpair
This command created a minimal topology, started up the OpenFlow reference controller, ran an all-pairs-ping
test, and tore down both the topology and the controller.
$ sudo mn --test iperf
This command created the same Mininet, ran an iperf server on one host, ran an iperf client on the second host, and parsed the bandwidth achieved.
4.以上用到的都是自定义拓扑,使用--topo选项可以更改拓扑结构
$ sudo mn --test pingall --topo single,3
$ sudo mn --test pingall --topo linear,4
5.自定义拓扑结构
自定义拓扑结构需要自己编写一小段简单的Python代码实现,在 mininet/custom
中有一个示例文件topo-2sw-2host.py
.。可以按照该文件的内容进行相应地修改,定义自己的拓扑结构。
修改完成后执行以下命令建立拓扑:
sudo mn --custom ~/mininet/custom/topo-2sw-2host.py. --topo mytopo --mac--switch ovsk --controller remote,ip=127.0.0.1,port=6633
该命令中包含了mininet命令中其他一些重要的选项及参数,在此一起说明:
(1)--custom ~/mininet/custom/topo1.py --topomytopo
define CustomTopologies
(2)--mac:
The --mac optionis super-useful, and sets the host MAC and IP addrs to small, unique,easy-to-read IDs.例如将host1的mac地址设置为00:00:00:00:00:01
(3)--switch:
指定交换机类型,如the user-space switch: --switch user;或者Open vSwitch (OVS): --switch ovsk
(4)--controller remote,ip=127.0.0.1,port=6633:
Using a RemoteController and fill in the host IP and/or listening port
sudo mn--controller=remote,ip=[controller IP],port=[controller listening port]