• OVS流表table之间的跳转


    OVS流表table之间的跳转

    前言

    今天在帮学弟解决问题的时候,遇到一个table0、table1之间的微妙小插曲,引起了注意,后来查了一下资料发现原因了。

    问题描述

    wpq@wpq:~$ sudo ovs-ofctl dump-flows -O OpenFlow13 s1
    
    OFPST_FLOW reply (OF1.3) (xid=0x2):
     cookie=0x0, duration=275.673s, table=0, n_packets=22, n_bytes=2156, priority=1000,ip,nw_src=10.0.0.2,nw_dst=10.0.0.1 actions=output:1
     cookie=0x0, duration=285.517s, table=0, n_packets=16, n_bytes=672, priority=1000,arp actions=FLOOD
     cookie=0x0, duration=53.643s, table=1, n_packets=0, n_bytes=0, priority=1000,ip,nw_src=10.0.0.1,nw_dst=10.0.0.2 actions=output:2
    
    

    如上输出所示,位于table1的流表的n_packet始终无法上涨,说明流表始终没有被匹配到。

    问题解决

    还是自己太年轻,把最基本的openflow协议都给忘了,流表之间的跳转是要action
    OVS流表分析
    上述链接中有句话引到

    流表间的跳转并没有用标准OpenFlow规范中的指令GOTO_TABLE,而是使用了Nicira(开发OVS的公司)的扩展动作resubmit

    所以可以用两种方法

    1、resubmit

    wpq@wpq:~$ sudo ovs-ofctl -O OpenFlow13 add-flow s1 "table=0,priority=0,idle_timeout=0,actions=resubmit(,1)"
    
    wpq@wpq:~$ sudo ovs-ofctl dump-flows -O OpenFlow13 s1
    
    OFPST_FLOW reply (OF1.3) (xid=0x2):
     cookie=0x0, duration=2.370s, table=0, n_packets=0, n_bytes=0, priority=0 actions=resubmit(,1)
     cookie=0x0, duration=1139.038s, table=0, n_packets=23, n_bytes=2254, priority=1000,ip,nw_src=10.0.0.2,nw_dst=10.0.0.1 actions=output:1
     cookie=0x0, duration=1148.882s, table=0, n_packets=16, n_bytes=672, priority=1000,arp actions=FLOOD
     cookie=0x0, duration=917.008s, table=1, n_packets=0, n_bytes=0, priority=1000,ip,nw_src=10.0.0.1,nw_dst=10.0.0.2 actions=output:2
    

    2、goto_table

    wpq@wpq:~$ sudo ovs-ofctl -O OpenFlow13 add-flow s1 "table=0,priority=0,idle_timeout=0,actions=goto_table=1"
    
    wpq@wpq:~$ sudo ovs-ofctl dump-flows -O OpenFlow13 s1 
    
    OFPST_FLOW reply (OF1.3) (xid=0x2):
     cookie=0x0, duration=6.110s, table=0, n_packets=0, n_bytes=0, priority=0 actions=goto_table:1
     cookie=0x0, duration=101.774s, table=0, n_packets=0, n_bytes=0, priority=1000,ip,nw_src=10.0.0.2,nw_dst=10.0.0.1 actions=output:1
     cookie=0x0, duration=94.002s, table=0, n_packets=0, n_bytes=0, priority=1000,arp actions=FLOOD
     cookie=0x0, duration=1745.115s, table=1, n_packets=4, n_bytes=392, priority=1000,ip,nw_src=10.0.0.1,nw_dst=10.0.0.2 actions=output:2
    
    
  • 相关阅读:
    leetcode刷题29
    leetcode刷题28
    leetcode刷题27
    leetcode刷题23
    leetcode刷题22
    leetcode刷题21
    leetcode刷题20
    Unity中通过DoTween实现转盘效果
    U3D工作注意事项,不要再犯!
    Unity中String字符串的优化
  • 原文地址:https://www.cnblogs.com/wpqwpq/p/6701603.html
Copyright © 2020-2023  润新知