1. 利用Mininet仿真平台构建如下图所示的网络拓扑,配置主机h1和h2的IP地址(h1:10.0.0.1,h2:10.0.0.2),测试两台主机之间的网络连通性

2. 利用Wireshark工具,捕获拓扑中交换机与控制器之间的通信数据,对OpenFlow协议类型的各类报文(hello, features_request, features_reply, set_config, packet_in, packet_out等)进行分析

hello

控制器6633端口 ---> 交换机56694端口

Features Request

控制器6633端口 ---> 交换机56694端口

Set Config

控制器6633端口 ---> 交换机56694端口

Features Reply

交换机56694端口--- 控制器6633端口

Packet_in

交换机56694端口--- 控制器6633端口

//结合Packet_in的结构
struct ofp_packet_in {
    struct ofp_header header;
    uint32_t buffer_id; /*Packet-in消息所携带的数据包在交换机缓存区中的ID*/
    uint16_t total_len; /*data字段的长度*/
    uint16_t in_port; /*数据包进入交换机时的端口号*/
    uint8_t reason; /*发送Packet-in消息的原因,具体见 ofp_packet_in_reason*/
    uint8_t pad;
    uint8_t data[0]; /*携带的数据包*/
};

Packet_out

交换机6633端口--- 控制器56694端口

接下来是另一台交换机(端口35536)与控制器(端口6633)的交互过程

h1 ping h2

Packet_in

Flow_mod


```c++
//结合flow_mod结构
struct ofp_flow_mod {
struct ofp_header header;
struct ofp_match match; /流表的匹配域/
uint64_t cookie; /流表项标识符/
uint16_t command; /可以是ADD,DELETE,DELETE-STRICT,MODIFY,MODIFY-STRICT/
uint16_t idle_timeout; /空闲超时时间/
uint16_t hard_timeout; /最大生存时间/
uint16_t priority; /优先级,优先级高的流表项优先匹配/
uint32_t buffer_id; /缓存区ID ,用于指定缓存区中的一个数据包按这个消息的action列表处理/
uint16_t out_port; /如果这条消息是用于删除流表则需要提供额外的匹配参数/
uint16_t flags; /标志位,可以用来指示流表删除后是否发送flow‐removed消息,添加流表时是否检查流表重复项,添加的流表项是否为应急流表项。/
struct ofp_action_header actions[0]; /action列表/
};

https://img2018.cnblogs.com/blog/1791976/201911/1791976-20191119000229014-1797307140.png)


把控制器从openflow reference改成ovs controller

 posted on 2019-11-18 23:05  潮鸣人  阅读(147)  评论(0编辑  收藏  举报