码迷,mamicode.com
首页 > Web开发 > 详细

Mininet(轻量级软件定义网络和测试平台) 之二

时间:2018-05-24 11:51:47      阅读:295      评论:0      收藏:0      [点我收藏+]

标签:mininet

Mininet-2

进行回归测试 mn --test

透过 --test可以对建立的拓朴进行测试

pingpair则可以测试主机之间连线是否正常(Ping between first two hosts, useful for testing)

root@parallels-vm:~# mn --test pingpair
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2 
*** Adding switches:
s1 
*** Adding links:
(h1, s1) (h2, s1) 
*** Configuring hosts
h1 h2 
*** Starting controller
c0 
*** Starting 1 switches
s1 ...
*** Waiting for switches to connect
s1 
h1 -> h2 
h2 -> h1 
*** Results: 0% dropped (2/2 received)
*** Stopping 1 controllers
c0 
*** Stopping 2 links
..
*** Stopping 1 switches
s1 
*** Stopping 2 hosts
h1 h2 
*** Done
completed in 5.681 seconds

iperf(Simple iperf TCP test between two (optionally specified) hosts.Usage: iperf node1 node2)

root@parallels-vm:~# mn --test iperf
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2 
*** Adding switches:
s1 
*** Adding links:
(h1, s1) (h2, s1) 
*** Configuring hosts
h1 h2 
*** Starting controller
c0 
*** Starting 1 switches
s1 ...
*** Waiting for switches to connect
s1 
*** Iperf: testing TCP bandwidth between h1 and h2 
.*** Results: [‘36.3 Gbits/sec‘, ‘36.3 Gbits/sec‘]
*** Stopping 1 controllers
c0 
*** Stopping 2 links
..
*** Stopping 1 switches
s1 
*** Stopping 2 hosts
h1 h2 
*** Done
completed in 10.987 seconds

用参数调整拓朴--topo

--topo=TOPO           linear|minimal|reversed|single|torus|tree[,param=value
                        ...] linear=LinearTopo torus=TorusTopo tree=TreeTopo
                        single=SingleSwitchTopo
                        reversed=SingleSwitchReversedTopo minimal=MinimalTopo

single

single 指的是单个,这类的拓朴只有一个交换机(Switch),而主机个数可以任意指定,拓朴成星型

技术分享图片

root@parallels-vm:~# mn --topo=single,3
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2 h3 
*** Adding switches:
s1 
*** Adding links:
(h1, s1) (h2, s1) (h3, s1) 
*** Configuring hosts
h1 h2 h3 
*** Starting controller
c0 
*** Starting 1 switches
s1 ...
*** Starting CLI:
mininet> net
h1 h1-eth0:s1-eth1
h2 h2-eth0:s1-eth2
h3 h3-eth0:s1-eth3
s1 lo:  s1-eth1:h1-eth0 s1-eth2:h2-eth0 s1-eth3:h3-eth0
c0

linear

linear指的是直线, 一个交换机配一个主机,而主机和交换机的个数可以任意指定,拓朴形状成直线型
技术分享图片

root@parallels-vm:~# mn --topo=linear,3
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2 h3 
*** Adding switches:
s1 s2 s3 
*** Adding links:
(h1, s1) (h2, s2) (h3, s3) (s2, s1) (s3, s2) 
*** Configuring hosts
h1 h2 h3 
*** Starting controller
c0 
*** Starting 3 switches
s1 s2 s3 ...
*** Starting CLI:
mininet> net
h1 h1-eth0:s1-eth1
h2 h2-eth0:s2-eth1
h3 h3-eth0:s3-eth1
s1 lo:  s1-eth1:h1-eth0 s1-eth2:s2-eth2
s2 lo:  s2-eth1:h2-eth0 s2-eth2:s1-eth2 s2-eth3:s3-eth2
s3 lo:  s3-eth1:h3-eth0 s3-eth2:s2-eth3
c0

tree

tree指的是树,这类的拓朴形状成树状,交换机成树状分散开来,树的最下面一层挂两台主机
技术分享图片

root@parallels-vm:~# mn --topo=tree,3
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2 h3 h4 h5 h6 h7 h8 
*** Adding switches:
s1 s2 s3 s4 s5 s6 s7 
*** Adding links:
(s1, s2) (s1, s5) (s2, s3) (s2, s4) (s3, h1) (s3, h2) (s4, h3) (s4, h4) (s5, s6) (s5, s7) (s6, h5) (s6, h6) (s7, h7) (s7, h8) 
*** Configuring hosts
h1 h2 h3 h4 h5 h6 h7 h8 
*** Starting controller
c0 
*** Starting 7 switches
s1 s2 s3 s4 s5 s6 s7 ...
*** Starting CLI:
mininet> net
h1 h1-eth0:s3-eth1
h2 h2-eth0:s3-eth2
h3 h3-eth0:s4-eth1
h4 h4-eth0:s4-eth2
h5 h5-eth0:s6-eth1
h6 h6-eth0:s6-eth2
h7 h7-eth0:s7-eth1
h8 h8-eth0:s7-eth2
s1 lo:  s1-eth1:s2-eth3 s1-eth2:s5-eth3
s2 lo:  s2-eth1:s3-eth3 s2-eth2:s4-eth3 s2-eth3:s1-eth1
s3 lo:  s3-eth1:h1-eth0 s3-eth2:h2-eth0 s3-eth3:s2-eth1
s4 lo:  s4-eth1:h3-eth0 s4-eth2:h4-eth0 s4-eth3:s2-eth2
s5 lo:  s5-eth1:s6-eth3 s5-eth2:s7-eth3 s5-eth3:s1-eth2
s6 lo:  s6-eth1:h5-eth0 s6-eth2:h6-eth0 s6-eth3:s5-eth1
s7 lo:  s7-eth1:h7-eth0 s7-eth2:h8-eth0 s7-eth3:s5-eth2
c0

minimal

minimal指的是最小,也是mininet默认的拓朴,为一个交换机连接两个主机

root@parallels-vm:~# mn --topo=minimal
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2 
*** Adding switches:
s1 
*** Adding links:
(h1, s1) (h2, s1) 
*** Configuring hosts
h1 h2 
*** Starting controller
c0 
*** Starting 1 switches
s1 ...
*** Starting CLI:
mininet> net
h1 h1-eth0:s1-eth1
h2 h2-eth0:s1-eth2
s1 lo:  s1-eth1:h1-eth0 s1-eth2:h2-eth0
c0

--mac

创建mininer时默认会给每一个设备(host,switch等..)分配一个MAC位址,但每一次分配的mac位置都会随之改变,调适难度较大。 --mac就是保证mac位置简单易懂。

尚未调适过的:

mininet> h1 ifconfig | grep HWaddr
h1-eth0   Link encap:Ethernet  HWaddr 8e:43:77:2e:47:c9 

加入--mac

mininet> h1 ifconfig | grep HWaddr
h1-eth0   Link encap:Ethernet  HWaddr 00:00:00:00:00:01

开启各别主机的 terminalxterm

mn -x会在开启mininet时,将各个设备的terminal打开
若要针对单一个设备打开xtrem,便在开启拓朴后,执行xterm (设备)

Mininet(轻量级软件定义网络和测试平台) 之二

标签:mininet

原文地址:http://blog.51cto.com/12098022/2119725

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!