mininet之miniedit可视化操作

Mininet 2.2.0之后的版本内置了一个mininet可视化工具miniedit,使用Mininet可视化界面方便了用户自定义拓扑创建,为不熟悉python脚本的使用者创造了更简单的环境,界面直观,可操作性强。

总之就是比写Python脚本简单,降低了SDN入门的门槛,尴尬,我也是最近才知道有这个功能的,一起来学习一波。

 

Mininet都是用root权限启动的,所以miniedit也不例外。

首先获得mininet目录的权限,这点就不细说了,chmod blablabla就可以了。

然后就能愉快的启动miniedit了

xxt@xxt-VirtualBox:~$ sudo ~/mininet/examples/miniedit.py 
[sudo] password for xxt: 

然后就弹出miniedit的界面了

左边类似工具栏的东西依次是select、Host、Switch、legancy switch、legancy router、netlink、controller。

接下来可以像操作C#里控件一样把需要的设备托到右边的面板上,例如:先摆4个host

miniedit会依次默认的给host命名h1,h2,···,hn。我们也可以通过右键点击某个host来指定该host的名字

可以看到除了名字还有许多其他参数可以设置,新型switch相比传统switch还是nb不少,这里我也不太清楚大部分参数的设置,略过

添加四个switch

 

添加一个controller

右键点击controller,可以设置ip,端口,类型等信息,这里我把控制器设为remote controller,ip设置为控制器所在主机ip,

连接各个主机和交换机与controller,需要注意,连接顺序和端口号一致,如果第一次连h1和s1,第二次连接h2和s1,那么s1的eth1就和h1连接,s1的eth2和h2连接,以此类推

拓扑基本已经OK,眼熟的同学会发现2016SDN大赛提高题第二道就是这么个拓扑,接着点击 Edit->Preferences,勾上start CLI ,选择你需要版本的OF协议

点击run,就可以和平时使用sudo mn blablabla好多参数 一样的效果

可以看到终端的显示

MiniEdit running against Mininet 2.2.1
topo=none
New controller details for c0 = {'remotePort': 6633, 'controllerProtocol': 'tcp', 'hostname': 'c0', 'remoteIP': '10.201.121.155', 'controllerType': 'remote'}
New Prefs = None
New Prefs = {'ipBase': '10.0.0.0/8', 'sflow': {'sflowPolling': '30', 'sflowSampling': '400', 'sflowHeader': '128', 'sflowTarget': ''}, 'terminalType': 'xterm', 'startCLI': '1', 'switchType': 'ovs', 'netflow': {'nflowAddId': '0', 'nflowTarget': '', 'nflowTimeout': '600'}, 'dpctl': '', 'openFlowVersions': {'ovsOf11': '0', 'ovsOf10': '1', 'ovsOf13': '0', 'ovsOf12': '0'}}
Build network based on our topology.
Getting Hosts and Switches.
<class 'mininet.node.Host'>
<class 'mininet.node.Host'>
Getting controller selection:remote
Unable to contact the remote controller at 10.201.121.155:6633
<class 'mininet.node.Host'>
<class 'mininet.node.Host'>
Getting Links.
*** Configuring hosts
h2 h3 h1 h4 
**** Starting 1 controllers
c0 
**** Starting 4 switches
s1 s3 s2 s4 
No NetFlow targets specified.
No sFlow targets specified.


 NOTE: PLEASE REMEMBER TO EXIT THE CLI BEFORE YOU PRESS THE STOP BUTTON. Not exiting will prevent MiniEdit from quitting and will prevent you from starting the network again during this sessoin.

*** Starting CLI:
mininet> 

启动控制器(floodlight)

在mininet端查看连接情况

mininet> pingall
*** Ping: testing ping reachability
h2 -> h3 h1 h4 
h3 -> h2 h1 h4 
h1 -> h2 h3 h4 
h4 -> h2 h3 h1 
*** Results: 0% dropped (12/12 received)
mininet> 

查看拓扑结构

mininet> net
h2 h2-eth0:s1-eth2
h3 h3-eth0:s4-eth1
h1 h1-eth0:s1-eth1
h4 h4-eth0:s4-eth2
s1 lo:  s1-eth1:h1-eth0 s1-eth2:h2-eth0 s1-eth3:s2-eth1 s1-eth4:s3-eth1
s3 lo:  s3-eth1:s1-eth4 s3-eth2:s4-eth4
s2 lo:  s2-eth1:s1-eth3 s2-eth2:s4-eth3
s4 lo:  s4-eth1:h3-eth0 s4-eth2:h4-eth0 s4-eth3:s2-eth2 s4-eth4:s3-eth2
c0
mininet> 

会发现和之前的连接顺序一致。除了这些功能外,还可以通过菜单栏file->save/save level 2 script直接将拓扑保存为.mn脚本或.py脚本方便建立相同topo时

使用。

最后退出时需要注意

NOTE: PLEASE REMEMBER TO EXIT THE CLI BEFORE YOU PRESS THE STOP BUTTON. Not exiting will prevent MiniEdit from quitting and will prevent you from starting the network again during this sessoin.

先推出CLI再STOP,就可以安全滴退出了。

posted @ 2016-05-26 20:55  _Just  阅读(13320)  评论(0编辑  收藏  举报