基于OpenFlow协议的分流聚合基础应用笔记

网络 网络管理
本文从一对多实验与Tap Aggregation实验对OpenFlow进行实例分析。

实验一: 一对多实验

将1个10G端口的流量镜像至5个端口的配置如下。同样配置方法可应用于更多的端口。

实验一: 一对多实验

注:Pica8交换机同时支持传统的2-3层协议和OpenFlow协议,本实验中交换机均配置为OpenFlow模式;

首先我们创建一个新的Bridge br0,并将端口1-6添加到br0;

# Add Bridge br0 - for PCAP Replication - 1st Port
##############################
# te-1/1/1 is input te-1/1/2, te-1/1/3, te-1/1/4, te-1/1/5, te-1/1/6 are output
#-------------------------------------------------------------------------------------
$VSCTL add-br br0 -- set bridge br0 datapath_type=pica8 other-config=datapath-id=100
$VSCTL add-port br0 te-1/1/1 -- set interface te-1/1/1 type=pica8
$VSCTL add-port br0 te-1/1/2 -- set interface te-1/1/2 type=pica8
$VSCTL add-port br0 te-1/1/3 -- set interface te-1/1/3 type=pica8
$VSCTL add-port br0 te-1/1/4 -- set interface te-1/1/4 type=pica8
$VSCTL add-port br0 te-1/1/5 -- set interface te-1/1/5 type=pica8
$VSCTL add-port br0 te-1/1/6 -- set interface te-1/1/6 type=pica8

然后我们移除默认的流保证各端口按照新的指令工作;最后我们将镜像流量出端口的ingress流量全部丢弃;

# Remove Default Flow (not treating this as HUB!)
ovs-ofctl del-flows br0
# Add replication flow 1 -> 2,3,4,5,6
ovs-ofctl add-flow br0 in_port=1,dl_dst="*",dl_src="*",dl_type="*",dl_vlan_pcp="*",dl_vlan="*",actions=output:2,3,4,5,6

 

最后我们将镜像流量出端口的ingress流量全部丢弃;

# Drop ingress traffic from mirror ports
ovs-ofctl add-flow br0 in_port=2,dl_dst="*",dl_src="*",dl_type="*",dl_vlan_pcp="*",dl_vlan="*",actions=drop
ovs-ofctl add-flow br0 in_port=3,dl_dst="*",dl_src="*",dl_type="*",dl_vlan_pcp="*",dl_vlan="*",actions=drop
ovs-ofctl add-flow br0 in_port=4,dl_dst="*",dl_src="*",dl_type="*",dl_vlan_pcp="*",dl_vlan="*",actions=drop
ovs-ofctl add-flow br0 in_port=5,dl_dst="*",dl_src="*",dl_type="*",dl_vlan_pcp="*",dl_vlan="*",actions=drop
ovs-ofctl add-flow br0 in_port=6,dl_dst="*",dl_src="*",dl_type="*",dl_vlan_pcp="*",dl_vlan="*",actions=drop

实验二:Tap Aggregation实验

在实验一的基础上我们将四个端口的流量bridge到一起,并且mirror至其他端口;

实验二:Tap Aggregation实验

idge br20 - for TAP Span - 1st Port
#######################################################################################
# Bridged : te-1/1/21, te-1/1/22, te-1/1/23, te-1/1/24
# Output : te-1/1/25, te-1/1/26, te-1/1/27, te-1/1/28
#-------------------------------------------------------------------------------------
$VSCTL add-br br20 -- set bridge br20 datapath_type=pica8 other-config=datapath-id=120
$VSCTL add-port br20 te-1/1/21 -- set interface te-1/1/21 type=pica8
$VSCTL add-port br20 te-1/1/22 -- set interface te-1/1/22 type=pica8
$VSCTL add-port br20 te-1/1/23 -- set interface te-1/1/23 type=pica8
$VSCTL add-port br20 te-1/1/24 -- set interface te-1/1/24 type=pica8
$VSCTL add-port br20 te-1/1/25 -- set interface te-1/1/25 type=pica8
$VSCTL add-port br20 te-1/1/26 -- set interface te-1/1/26 type=pica8
$VSCTL add-port br20 te-1/1/27 -- set interface te-1/1/27 type=pica8
$VSCTL add-port br20 te-1/1/28 -- set interface te-1/1/28 type=pica8
# Remove Default Flow (not treating this as HUB!)
ovs-ofctl del-flows br20
# Add replication flow from each bridged port to each of the other ports in the group
ovs-ofctl add-flow br20 in_port=21,dl_dst="*",dl_src="*",dl_type="*",dl_vlan_pcp="*",dl_vlan="*",actions=output:22,23,24,25,26,27,28
ovs-ofctl add-flow br20 in_port=22,dl_dst="*",dl_src="*",dl_type="*",dl_vlan_pcp="*",dl_vlan="*",actions=output:21,23,24,25,26,27,28
ovs-ofctl add-flow br20 in_port=23,dl_dst="*",dl_src="*",dl_type="*",dl_vlan_pcp="*",dl_vlan="*",actions=output:21,22,24,25,26,27,28
ovs-ofctl add-flow br20 in_port=24,dl_dst="*",dl_src="*",dl_type="*",dl_vlan_pcp="*",dl_vlan="*",actions=output:21,22,23,25,26,27,28
# Drop ingress traffic from mirror ports
ovs-ofctl add-flow br20 in_port=25,dl_dst="*",dl_src="*",dl_type="*",dl_vlan_pcp="*",dl_vlan="*",actions=drop
ovs-ofctl add-flow br20 in_port=26,dl_dst="*",dl_src="*",dl_type="*",dl_vlan_pcp="*",dl_vlan="*",actions=drop
ovs-ofctl add-flow br20 in_port=27,dl_dst="*",dl_src="*",dl_type="*",dl_vlan_pcp="*",dl_vlan="*",actions=drop
ovs-ofctl add-flow br20 in_port=28,dl_dst="*",dl_src="*",dl_type="*",dl_vlan_pcp="*",dl_vlan="*",actions=drop

 

责任编辑:林琳 来源: 新浪微博
相关推荐

2012-03-05 13:41:58

OpenFlow

2011-05-24 16:18:30

OpenFlow应用

2015-07-15 15:24:25

OpenFlowSDN

2010-06-01 18:47:11

Rsync 使用

2015-07-27 14:57:32

OpenFlow协议Ryu

2024-04-14 18:43:18

2015-04-15 11:23:05

2014-06-05 10:21:29

HTTP

2015-09-24 15:19:27

2014-06-16 14:35:31

OpenFlow

2014-07-30 09:48:23

OpenflowSDN

2010-06-09 15:23:25

2015-10-10 09:31:03

网络协议NETCONFOpenFlow

2014-01-07 09:38:34

OpenFlowSDN测试

2015-07-02 09:46:55

OpenFlowOpenStackSDN

2011-04-19 14:15:13

OpenFlow开源项目网络协议

2011-05-24 15:57:42

OpenFlow

2011-05-24 15:52:47

OpenFlow起源

2015-09-02 10:33:11

OpenFlowSDN

2010-07-07 15:11:39

H.323协议
点赞
收藏

51CTO技术栈公众号