zoukankan      html  css  js  c++  java
  • Floodlight中的临时流表

    运行Floodlight,在Mininet中新建一个拓扑之后,并未添加相关的流表项,但是主机之间却可以相互通信。执行pingall操作,任意两个主机之间都能通。相当于没有任何路由表的路由器,它是怎么让这些网络中的主机通信的呢?

    原因在于Floodlight默认启用了Forwarding模块。说这个模块之前,首先说说Floodlight 中流表的两种添加方式:主动式和反应式。


    官网上的文档是这么说的:
    http://docs.projectfloodlight.org/display/floodlightcontroller/Static+Flow+Pusher+API

    Proactive vs Reactive flow insertion

    OpenFlow supports two methods of flow insertion: proactive and reactive. Reactive flow insertion occurs when a packet reaches an OpenFlow switch without a matching flow. The packet is sent to the controller, which evaluates it, adds the appropriate flows, and lets the switch continue its forwarding. Alternatively, flows can be inserted proactively by the controller in switches before packets arrive.

    Floodlight supports both mechanisms of flow insertion. Static Flow Pusher is generally useful for proactive flow insertion.

    Note that by default, Floodlight loads the Forwarding module which does reactive flow pushing. If you would like to exclusively use static flows, you must remove Forwarding from the floodlight.properties file.

    主动式流插入与反应式流插入

    OpenFlow协议支持两种流插入方式:主动式和反应式。当一个数据包到达OpenFlow交换机后,没有被任何现有的流匹配,这个包就被发到控制器。控制器对此数据包进行评估,然后向交换机添加合适的流,让交换机把此数据包(以及后来的类似的数据包)正确的转发下去。这就是反应式流插入。对应的主动式流插入则是,在数据包到达交换机之前,控制器已经向交换机中插入了流表。

    Floodloght支持这两种插入方式。Static Flow Pusher 用于主动式流插入。

    需要注意的是,Floodlight默认加载了Forwarding模块,这个模块会实现反应式流插入。如果你想排除这种临时流,只用自己写入的静态流,你需要在配置文件floodlight.properties 里移除Forwarding模块。


    好,回到文章开始提出的问题:Floodlight默认启用了Forwarding模块,该模块的启用导致了没有流表的拓扑里,主机之间也能ping通。

    可见,Forwarding模块实现的功能就是实现反应式流插入。当运行pingall操作时,Forwarding模块会产生很多“临时流表”,这种流表存活时间只有5s。因为这些临时流表的存在,主机之间才能通信。

    以下是一个测试:

    建立如下的拓扑:

    执行 pingall 操作后立即在floodlight主页上查看5号交换机中的流表,如下图:

    一共有10条流表项,有兴趣可以仔细分析一下,发现确实如此。同样的可以在3号交换机中看到10条,4号交换机中8条。

    那么这种由Flowarding模块产生的流表项与通过python脚本(Static Flow Pusher API)写入的流表项是否一样呢?下图是通过 Static Flow Pusher 写入的流表项:

    可以发现很多地方是不一样的。比如优先级,“临时流表”的优先级最低,是0。静态流表的Timeout为0,表示永久有效。ForwardingBase 类中可见定义:

    public static int FLOWMOD_DEFAULT_IDLE_TIMEOUT = 5; // in seconds
    public static int FLOWMOD_DEFAULT_HARD_TIMEOUT = 0; // infinite
  • 相关阅读:
    凭这份pdf让我轻松拿下了蚂蚁金服、字节跳动、小米等大厂的offer
    阿里面试官看了我写的多线程博文,反问你也看过那本的(多线程)
    Docker简介及基本使用
    springboot常见问题之Rustful风格下,@PutMapping、@@DeleteMapping失效问题
    SpringBoot之国际化功能
    SpringBoot之Thymeleaf模板引擎
    SpringBoot之静态资源处理
    SpringBoot 配置原理
    SpringBoot: 配置文件用法
    SpringBoot版hello world
  • 原文地址:https://www.cnblogs.com/duanguyuan/p/3791271.html
Copyright © 2011-2022 走看看