zoukankan      html  css  js  c++  java
  • Openflow

    1.1         Flow表

    通过CLI或者Controller配置流表

    1.1.1         拓扑

    1.1.2         配置

    1)CLI配置一条流表(in_port = ge1, out_port = ge48):

    xNet#configure terminal

    xNet(config)#openflow

    xNet(config-openflow)#member ge1,ge47-48

    xNet(config-openflow)#flow add match in-port 1 actions output 48

    xNet(config-openflow)#end

    xNet#

    2)查看流表

    3)PC-101发包,查看PC-92是否能收到包

    1.1.3         结果

    通过配置流表,能使报文按流表规则转发

    1.2         Meter表

    通过CLI或者Controller配置openflow1.3的Meter,来对端口限速

    1.2.1         拓扑

    1.2.2         配置

    添加一条meter,限制pkt每秒16个,超过的为drop。

    1)CLI配置member:

    xNet#configure terminal

    xNet(config)#openflow

    xNet(config-openflow)#member ge1,ge48

    xNet(config-openflow)#version 1.3

    2)添加Meter表

    xNet(config-openflow)#meter add "meter=18 pktps burst stats bands= type=drop rate=16 burst_size=16"

    CLI查看meter表:

    3)添加一条flow表,使用Meter

    xNet(config-openflow)#flow add "in_port=1,actions=meter=18,output=48"

    查看flow表:

    4)PC-101发包,查看208的ge1口流量统计情况

    1.2.3         结果

    通过配置meter表和flow表,能使报文限速转发

    1.3         Group表

    通过CLI或者Controller配置openflow1.3的Group,Group表项被流表项所引用,提供额外的报文转发功能。

    1.3.1         拓扑

    1.3.2         配置

    添加一个group,添加两个action,

    action1为修改源MAC,出口为ge47;

    action2为修改目的MAC,出口为ge48;

    1)CLI配置member:

    xNet#configure terminal

    xNet(config)#openflow

    xNet(config-openflow)#member ge1,ge47-48

    xNet(config-openflow)#version 1.3

    2)创建一个Group表,每个动作桶由一个或多个动作组成

    xNet(config-openflow)#group add "group_id=101,type= all,bucket=output:48"

    CLI查看Group表:

    3)添加一条flow表,使用Group,来实现多个action

    xNet(config-openflow)#group modify "group_id=101,type=all,bucket=mod_dl_src:22:11:11:22:22:47,output:47,bucket=mod_dl_dst:22:11:11:22:22:48,output:48"

    xNet(config-openflow)#flow add "in_port=1,actions=group:101"

    查看group和flow表:

    4)PC-101发包,查看208的ge1口流量统计情况

    PC-91和PC-92均能收到报文,且抓取报文查看:

    src_mac= 22:11:11:22:22:47

    dst_mac= 22:11:11:22:22:48

    1.3.3         结果

    通过配置group表和flow表,能使报文按多个action规则转发

    1.4         GRE

    通过CLI配置GRE

    1.4.1         拓扑

    1.4.2         封包配置

    1)CLI创建GRE和flow table(in_port = ge1, out_port = ge48):

    xNet#configure terminal

    xNet(config)#openflow

    xNet(config-openflow)#member ge1,ge48

    xNet(config-openflow)#version 1.3

    xNet(config-openflow)#gre-add gre1 src-mac 0.0.1 dst-mac 0.0.2 local-ip 1.1.1.1 remote-ip 2.2.2.2 egress-port ge48

    xNet(config-openflow)#flow add "in_port=1,actions=output:201"

    xNet(config-openflow)#end

    xNet#

    注:gre1对应201, gre2对应202,以此类推。

    2)查看flow table和GRE

    3)PC-101发包,抓包查看PC-92收到的报文,已封包

    1.4.3         解包配置

    1)配置GRE,解包时,GRE报文流入端口ge1,所以in_port要设置为1,此时创建的GRE中的egress-port也为ge1

    xNet#configure terminal

    xNet(config)#openflow

    xNet(config-openflow)# gre-add gre1 src-mac 0003.6B00.0000 dst-mac 0028.74FE.0003 local-ip 5.5.5.5 remote-ip 6.6.6.6 egress-port ge1

    xNet(config-openflow)#flow add "in_port=1,actions=output:48"

    xNet(config-openflow)#end

    xNet#

    2)PC-101发包,抓包查看PC-92收到的报文,已解包

    解包前:

    解包后:

    注:在做解包测试时,发包器构造GRE报文的MAC和IP的src和dst都与创建的GRE相反,如例。

    1.4.4         结果

    通过创建GRE和配置flow表,能使报文封包或解包进行转发

    1.5         MPLS

    通过CLI配置MPLS

    1.5.1         拓扑

    1.5.2         PUSH配置

    1)CLI配置一条流表(in_port = ge1, out_port = ge48, push_mpls):

    xNet#configure terminal

    xNet(config)#openflow

    xNet(config-openflow)#version 1.3

    xNet(config-openflow)#member ge1,ge48

    xNet(config-openflow)#flow add "in_port=1,dl_src=00:28:74:FE:00:03,dl_dst=0:03:6B:00:00:00,dl_vlan=5,actions=push_mpls:0x8847,set_field:10->mpls_label,output:48"

    xNet(config-openflow)#end

    xNet#

    注:src_mac, dst_mac, vlan, in_port这几个参数不能少

    2)查看流表

    3)PC-101发包,查看PC-92收到的包结构,已push上了一个标签。

    1.5.3         结果

    通过配置MPLS流表,能push/pop/swap MPLS Label再转发

  • 相关阅读:
    VysorPro助手
    Play 2D games on Pixel running Android Nougat (N7.1.2) with Daydream View VR headset
    Play 2D games on Nexus 6P running Android N7.1.1 with Daydream View VR headset
    Native SBS for Android
    ADB和Fastboot最新版的谷歌官方下载链接
    How do I install Daydream on my phone?
    Daydream Controller手柄数据的解析
    蓝牙BLE传输性能及延迟分析
    VR(虚拟现实)开发资源汇总
    Android(Java)控制GPIO的方法及耗时分析
  • 原文地址:https://www.cnblogs.com/niezhongle/p/11075380.html
Copyright © 2011-2022 走看看