首页 > 代码库 > 在mininet上基于ovs,ovx,pox搭建三点虚拟网络

在mininet上基于ovs,ovx,pox搭建三点虚拟网络

本次试验基于mininet平台,在平台中利用ovs新建1个交换机,以pox为控制器,ovx作为中间层实现虚拟化。

基础请参照http://ovx.onlab.us/getting-started/tutorial/

但是由于上述只是直线拓扑,而且中间不经过节点,因此我们要构建一个复杂的拓扑,如标红的拓扑

技术分享

 

首先我们将pox的l2_learing修改一下,也就是把host,switch与path信息写进去

其次开启ovx,pox

在/ovx/utils/具体代码如下:

新建虚拟网络,并制定控制器与host的ip域

python ovxctl.py -n createNetwork tcp:192.168.100.107:6633 10.0.0.0 16

由switch的DPID新建虚拟交换机

python ovxctl.py -n createSwitch 1 00:00:00:00:00:00:02:00
python ovxctl.py -n createSwitch 1 00:00:00:00:00:00:05:00
python ovxctl.py -n createSwitch 1 00:00:00:00:00:00:08:00

为每一个虚拟交换机添加port,指定物理port,注意返回的虚拟port_id

python ovxctl.py -n createPort 1 00:00:00:00:00:00:02:00 5
python ovxctl.py -n createPort 1 00:00:00:00:00:00:02:00 6

python ovxctl.py -n createPort 1 00:00:00:00:00:00:05:00 5
python ovxctl.py -n createPort 1 00:00:00:00:00:00:05:00 6

python ovxctl.py -n createPort 1 00:00:00:00:00:00:08:00 5
python ovxctl.py -n createPort 1 00:00:00:00:00:00:08:00 7

连接switchs,这里10 10 是因为我们对协议进行改变了,支持ooe了
python ovxctl.py -n connectLink 1 00:a4:23:05:00:00:00:01 2 00:a4:23:05:00:00:00:02 1 10 10 spf 1
python ovxctl.py -n connectLink 1 00:a4:23:05:00:00:00:01 1 00:a4:23:05:00:00:00:03 1 10 10 spf 1
python ovxctl.py -n connectLink 1 00:a4:23:05:00:00:00:02 2 00:a4:23:05:00:00:00:03 2 10 10 spf 1

新建port,并通过该port与host相连

python ovxctl.py -n createPort 1 00:00:00:00:00:00:02:00 1
python ovxctl.py -n connectHost 1 00:a4:23:05:00:00:00:01 3 00:00:00:00:02:01

python ovxctl.py -n createPort 1 00:00:00:00:00:00:05:00 2
python ovxctl.py -n connectHost 1 00:a4:23:05:00:00:00:02 3 00:00:00:00:05:02

python ovxctl.py -n createPort 1 00:00:00:00:00:00:08:00 3
python ovxctl.py -n connectHost 1 00:a4:23:05:00:00:00:03 3 00:00:00:00:08:03

开启虚拟网络

python ovxctl.py -n startNetwork 1

 

我们可以在mininet dump_flows查看流表信息

*** ATL ------------------------------------------------------------------------
NXST_FLOW reply (xid=0x4):
cookie=0x100000000, duration=10.141s, table=0, n_packets=0, n_bytes=0, idle_timeout=10000,priority=42,ooe,in_port=5,dl_src=http://www.mamicode.com/a4:23:05:01:00:00,dl_dst=a4:23:05:10:00:06,ooe_dst=0x2 actions=output:7
*** CLE ------------------------------------------------------------------------
NXST_FLOW reply (xid=0x4):
*** EWR ------------------------------------------------------------------------
NXST_FLOW reply (xid=0x4):
*** IAD ------------------------------------------------------------------------
NXST_FLOW reply (xid=0x4):
cookie=0x100000003, duration=9.167s, table=0, n_packets=0, n_bytes=0, idle_timeout=10000,priority=42,ooe,in_port=5,dl_src=http://www.mamicode.com/a4:23:05:01:00:00,dl_dst=a4:23:05:10:00:06,ooe_dst=0x2,ooe_start=11,ooe_length=2 actions=mod_dl_src:00:00:00:00:02:01,mod_dl_dst:00:00:00:00:05:02,output:2
*** IAH ------------------------------------------------------------------------
NXST_FLOW reply (xid=0x4):
cookie=0x100000000, duration=10.177s, table=0, n_packets=0, n_bytes=0, idle_timeout=10000,priority=42,ooe,in_port=5,dl_src=http://www.mamicode.com/a4:23:05:01:00:00,dl_dst=a4:23:05:10:00:06,ooe_dst=0x2 actions=output:7
*** LAX ------------------------------------------------------------------------
NXST_FLOW reply (xid=0x4):
cookie=0x100000000, duration=10.184s, table=0, n_packets=0, n_bytes=0, idle_timeout=10000,priority=42,ooe,in_port=5,dl_src=http://www.mamicode.com/a4:23:05:01:00:00,dl_dst=a4:23:05:10:00:06,ooe_dst=0x2 actions=output:7
*** MCI ------------------------------------------------------------------------
NXST_FLOW reply (xid=0x4):
*** ORD ------------------------------------------------------------------------
NXST_FLOW reply (xid=0x4):
*** SEA ------------------------------------------------------------------------
NXST_FLOW reply (xid=0x4):
*** SFO ------------------------------------------------------------------------
NXST_FLOW reply (xid=0x4):
cookie=0x100000003, duration=10.232s, table=0, n_packets=0, n_bytes=0, idle_timeout=10000,priority=42,ooe,in_port=1,dl_src=http://www.mamicode.com/00:00:00:00:02:01,dl_dst=00:00:00:00:05:02,ooe_dst=0x2 actions=mod_ooe_start:11,mod_ooe_length:2,mod_dl_src:a4:23:05:01:00:00,mod_dl_dst:a4:23:05:10:00:06,output:6
*** SLC ------------------------------------------------------------------------
NXST_FLOW reply (xid=0x4):

在mininet上基于ovs,ovx,pox搭建三点虚拟网络