赞
踩
Action Set
,在所有流表匹配完成后,取出Action Set
中所有操作逐一执行。Action Set
从一开始的空集,随每个包在流表项中被逐一匹配后,逐渐增多,最后在Ingress
处理流程的最后阶段统一执行。Table-miss
这个特殊的流表项,如果有配置,则按照流表项中的指令执行,通常有几种行为,丢弃报文、转发报文到其它流表继续匹配、通过控制通道发送报文到controller;如果没有配置,则丢弃报文。Action Set
中的操作。Action Set
中最后一个要执行的操作总是output
转发操作,如果output
操作不存在,但包含group
操作,则进入另一个由group
描述的Action Set
,如此迭代执行。如果output
和group
都不存在,丢弃报文。Action Set
中包含output
操作的情况下,如果交换机不包含出向的流表,则直接从端口出去,如果包含出向流表,则需要重复1-3类似的流程,最终从端口转发出去或者执行其它操作。Pipeline fields
。Apply-Actions action
),比如修改报文头、更新Pipeline fields
中的信息;第二类是针对Action Set
的操作,包括对集合的增、删;另一类就是跳转到其它流表操作。Pipeline Fields
和Action Set
,整个流表匹配过程中,会用到这三类数据。Pipeline Fields
一起,作为匹配流表项的信息,逐一匹配每个表项。Apply-Actions
,执行这类指令可能会修改报文头,更新匹配域或者报文关联的Pipeline Fields
等等;第二类是对Action Set
集合的增删操作;第三类是跳转到其它流表操作。Action Set
集合中的所有操作。流表项匹配成功后,指令的执行会不断增删Action Set
集合,其最终结果受此影响。Apply-Actions
,则会执行具体操作Action
,如果操作类型为output
,则会将报文从端口转发出去,如果有出向流表,则报文会继续匹配。OFPT_TABLE_MOD
类型消息给交换机,控制器可以实现流表属性的修改操作,通过发送OFPT_FLOW_MOD
类型消息给交换机,控制器可以实现流表项的增加、删除和修改等操作。[root@Hyman_server1 ~]# virsh domiflist c81_node1
Interface Type Source Model MAC
-------------------------------------------------------------
vnet0 bridge vs virtio 24:42:53:21:52:4e
vnet1 network default virtio 24:42:53:20:50:45
[root@Hyman_server1 ~]# ovs-vsctl show
f1011f20-73a8-44f1-979e-bc4fd82a106f
Bridge vs
Port vs
Interface vs
type: internal
Port "vnet0"
Interface "vnet0"
ovs_version: "2.11.0"
[root@Hyman_server1 ~]# ovs-ofctl dump-tables vs
OFPST_TABLE reply (OF1.3) (xid=0x2):
table 0:
active=1, lookup=12675, matched=12609
table 1:
active=1, lookup=6666, matched=6580
table 2:
active=0, lookup=0, matched=0
tables 3...253: ditto
[root@Hyman_server1 ~]# ovs-ofctl dump-flows vs table=0
cookie=0x0, duration=865.777s, table=0, n_packets=1790, n_bytes=169820, priority=0 actions=NORMAL
[root@Hyman_server1 ~]# ip addr show dev vs
[root@Hyman_server1 ~]# ip addr show dev vs
4: vs: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
link/ether 26:44:42:8c:47:4e brd ff:ff:ff:ff:ff:ff
inet 10.10.10.195/24 brd 10.10.10.255 scope global vs
valid_lft forever preferred_lft forever
[root@s1_vm1 ~]# ip add show dev ens7
3: ens7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 24:42:53:21:52:4e brd ff:ff:ff:ff:ff:ff
inet 10.10.10.196/24 brd 10.10.10.255 scope global noprefixroute ens7
valid_lft forever preferred_lft forever
ovs-ofctl add-flow vs "priority=1,table=0,actions=DROP"
,则按照规范定义,表项0和表项1都可以匹配任何报文,这种情况下,优先级高的表项会被流水线选择并执行其对应的指令,因此可以判断该表项增加后ping包的变化有几点:ovs-ofctl add-flow vs "priority=0,table=1,actions=NORMAL"
,然后修改table 0中的流表项 entry 1,将其drop的行为修改为goto_table,让其跳转到table 1继续处理,流表项操作如下:[root@Hyman_server1 ~]# ovs-ofctl dump-flows vs table=0
cookie=0x0, duration=3735.372s, table=0, n_packets=2282, n_bytes=214992, priority=0 actions=NORMAL
cookie=0x0, duration=1053.146s, table=0, n_packets=17, n_bytes=826, priority=1 actions=drop
[root@Hyman_server1 ~]# ovs-ofctl del-flows vs table=0
[root@Hyman_server1 ~]# ovs-ofctl dump-flows vs table=0
[root@Hyman_server1 ~]# ovs-ofctl add-flow vs "priority=0,table=0,actions=NORMAL"
[root@Hyman_server1 ~]# ovs-ofctl add-flow vs "priority=1,table=0,actions=goto_table:1"
[root@Hyman_server1 ~]# ovs-ofctl add-flow vs "priority=0,table=1,actions=NORMAL"
[root@Hyman_server1 ~]# ovs-ofctl dump-flows vs table=0
cookie=0x0, duration=29.879s, table=0, n_packets=0, n_bytes=0, priority=0 actions=NORMAL
cookie=0x0, duration=12.290s, table=0, n_packets=0, n_bytes=0, priority=1 actions=goto_table:1
[root@Hyman_server1 ~]# ovs-ofctl dump-flows vs table=1
cookie=0x0, duration=8.473s, table=1, n_packets=6580, n_bytes=622160, priority=0 actions=NORMAL
[root@Hyman_server1 ~]# ovs-ofctl dump-flows vs table=0 cookie=0x0, duration=752.154s, table=0, n_packets=0, n_bytes=0, priority=0 actions=NORMAL cookie=0x0, duration=734.565s, table=0, n_packets=24, n_bytes=1680, priority=1 actions=goto_table:1 [root@Hyman_server1 ~]# ovs-ofctl dump-flows vs table=1 cookie=0x0, duration=731.350s, table=1, n_packets=6604, n_bytes=623840, priority=0 actions=NORMAL [root@Hyman_server1 ~]# ovs-ofctl dump-flows vs table=2 [root@Hyman_server1 ~]# ovs-ofctl del-flows vs table=0 [root@Hyman_server1 ~]# ovs-ofctl dump-flows vs cookie=0x0, duration=748.760s, table=1, n_packets=6604, n_bytes=623840, priority=0 actions=NORMAL [root@Hyman_server1 ~]# ovs-ofctl del-flows vs table=1 [root@Hyman_server1 ~]# ovs-ofctl dump-flows vs [root@Hyman_server1 ~]# ovs-ofctl add-flow vs "priority=0,table=0,actions=NORMAL" [root@Hyman_server1 ~]# ovs-ofctl add-flow vs "priority=1,table=0,actions=goto_table:2" [root@Hyman_server1 ~]# ovs-ofctl add-flow vs "priority=0,table=1,actions=NORMAL" [root@Hyman_server1 ~]# ovs-ofctl add-flow vs "priority=0,table=2,actions=NORMAL" [root@Hyman_server1 ~]# ovs-ofctl dump-flows vs cookie=0x0, duration=29.547s, table=0, n_packets=0, n_bytes=0, priority=0 actions=NORMAL cookie=0x0, duration=18.605s, table=0, n_packets=0, n_bytes=0, priority=1 actions=goto_table:2 cookie=0x0, duration=10.962s, table=1, n_packets=0, n_bytes=0, priority=0 actions=NORMAL cookie=0x0, duration=5.784s, table=2, n_packets=0, n_bytes=0, priority=0 actions=NORMAL
虚拟机1: [root@s1_vm1 ~]# ip addr show ens7 3: ens7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 24:42:53:21:52:4e brd ff:ff:ff:ff:ff:ff inet 10.10.10.196/24 brd 10.10.10.255 scope global noprefixroute ens7 valid_lft forever preferred_lft forever 虚拟机2: [root@s1_vm2 ~]# ip addr show ens7 3: ens7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 24:42:53:21:50:4e brd ff:ff:ff:ff:ff:ff inet 10.10.10.197/24 brd 10.10.10.255 scope global noprefixroute ens7 valid_lft forever preferred_lft forever 主机: [root@Hyman_server1 qemu]# ovs-ofctl show vs OFPT_FEATURES_REPLY (OF1.3) (xid=0x2): dpid:00002644428c474e n_tables:254, n_buffers:0 capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS OFPST_PORT_DESC reply (OF1.3) (xid=0x3): 2(vnet2): addr:fe:42:53:21:52:4e config: 0 state: LIVE current: 10MB-FD COPPER speed: 10 Mbps now, 0 Mbps max 3(vnet4): addr:fe:42:53:21:50:4e config: 0 state: LIVE current: 10MB-FD COPPER speed: 10 Mbps now, 0 Mbps max LOCAL(vs): addr:26:44:42:8c:47:4e config: 0 state: LIVE speed: 0 Mbps now, 0 Mbps max OFPT_GET_CONFIG_REPLY (OF1.3) (xid=0x9): frags=normal miss_send_len=0 [root@Hyman_server1 qemu]# ovs-vsctl show f1011f20-73a8-44f1-979e-bc4fd82a106f Bridge vs Port "vnet2" Interface "vnet2" Port "vnet4" Interface "vnet4" Port vs Interface vs type: internal ovs_version: "2.11.0"
[root@Hyman_server1 qemu]# ovs-ofctl del-flows vs
[root@Hyman_server1 qemu]# ovs-ofctl dump-flows vs
[root@Hyman_server1 qemu]# ovs-ofctl add-flow vs "priority=0,table=0,actions=NORMAL"
[root@Hyman_server1 qemu]# ovs-ofctl add-flow vs "priority=1,table=0,dl_type=0x800,nw_proto=1,icmp_code=0,icmp_type=8,nw_dst=10.10.10.197,actions=drop"
[root@Hyman_server1 qemu]# ovs-ofctl add-flow vs "priority=1,table=0,in_port=3,dl_type=0x800,nw_proto=1,icmp_code=0,icmp_type=8,nw_dst=10.10.10.195,actions=drop"
[root@Hyman_server1 qemu]# ovs-ofctl add-flow vs "priority=0,table=1,in_port=3,dl_type=0x800,nw_proto=1,icmp_code=0,icmp_type=8,nw_dst=10.10.10.196,actions=normal"
[root@Hyman_server1 qemu]# ovs-ofctl dump-flows vs
cookie=0x0, duration=1094.045s, table=0, n_packets=8, n_bytes=784, priority=1,icmp,nw_dst=10.10.10.197,icmp_type=8,icmp_code=0 actions=drop
cookie=0x0, duration=325.604s, table=0, n_packets=3, n_bytes=294, priority=1,icmp,in_port=vnet4,nw_dst=10.10.10.195,icmp_type=8,icmp_code=0 actions=drop
cookie=0x0, duration=1252.963s, table=0, n_packets=85, n_bytes=6454, priority=0 actions=NORMAL
cookie=0x0, duration=369.321s, table=1, n_packets=0, n_bytes=0, priority=0,icmp,in_port=vnet4,nw_dst=10.10.10.196,icmp_type=8,icmp_code=0 actions=NORMAL
[root@Hyman_server1 qemu]# ovs-ofctl dump-flows vs
cookie=0x0, duration=2058.484s, table=0, n_packets=8, n_bytes=784, priority=1,icmp,nw_dst=10.10.10.197,icmp_type=8,icmp_code=0 actions=drop
cookie=0x0, duration=1290.043s, table=0, n_packets=3, n_bytes=294, priority=1,icmp,in_port=vnet4,nw_dst=10.10.10.195,icmp_type=8,icmp_code=0 actions=drop
cookie=0x0, duration=2217.402s, table=0, n_packets=117, n_bytes=8862, priority=0 actions=NORMAL
cookie=0x0, duration=1333.760s, table=1, n_packets=0, n_bytes=0, priority=0,icmp,in_port=vnet4,nw_dst=10.10.10.196,icmp_type=8,icmp_code=0 actions=NORMAL
虚侧: [root@s1_vm1 ~]# ping 10.10.10.195 -c 4 PING 10.10.10.195 (10.10.10.195) 56(84) bytes of data. 64 bytes from 10.10.10.195: icmp_seq=1 ttl=64 time=1.87 ms 64 bytes from 10.10.10.195: icmp_seq=2 ttl=64 time=0.250 ms 64 bytes from 10.10.10.195: icmp_seq=3 ttl=64 time=0.250 ms 64 bytes from 10.10.10.195: icmp_seq=4 ttl=64 time=0.468 ms --- 10.10.10.195 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 67ms 主机侧: [root@Hyman_server1 qemu]# ovs-ofctl dump-flows vs cookie=0x0, duration=2198.824s, table=0, n_packets=8, n_bytes=784, priority=1,icmp,nw_dst=10.10.10.197,icmp_type=8,icmp_code=0 actions=drop cookie=0x0, duration=1430.383s, table=0, n_packets=3, n_bytes=294, priority=1,icmp,in_port=vnet4,nw_dst=10.10.10.195,icmp_type=8,icmp_code=0 actions=drop cookie=0x0, duration=2357.742s, table=0, n_packets=129, n_bytes=9814, priority=0 actions=NORMAL cookie=0x0, duration=1474.100s, table=1, n_packets=0, n_bytes=0, priority=0,icmp,in_port=vnet4,nw_dst=10.10.10.196,icmp_type=8,icmp_code=0 actions=NORMAL
虚机:
[root@s1_vm1 ~]# ping 10.10.10.197 -c 4
PING 10.10.10.197 (10.10.10.197) 56(84) bytes of data.
--- 10.10.10.197 ping statistics ---
4 packets transmitted, 0 received, 100% packet loss, time 65ms
主机侧:
[root@Hyman_server1 qemu]# ovs-ofctl dump-flows vs
cookie=0x0, duration=2288.083s, table=0, n_packets=12, n_bytes=1176, priority=1,icmp,nw_dst=10.10.10.197,icmp_type=8,icmp_code=0 actions=drop
cookie=0x0, duration=1519.642s, table=0, n_packets=3, n_bytes=294, priority=1,icmp,in_port=vnet4,nw_dst=10.10.10.195,icmp_type=8,icmp_code=0 actions=drop
cookie=0x0, duration=2447.001s, table=0, n_packets=131, n_bytes=9898, priority=0 actions=NORMAL
cookie=0x0, duration=1563.359s, table=1, n_packets=0, n_bytes=0, priority=0,icmp,in_port=vnet4,nw_dst=10.10.10.196,icmp_type=8,icmp_code=0 actions=NORMAL
虚机: [root@s1_vm2 ~]# ping 10.10.10.196 -c 4 PING 10.10.10.196 (10.10.10.196) 56(84) bytes of data. 64 bytes from 10.10.10.196: icmp_seq=1 ttl=64 time=0.673 ms 64 bytes from 10.10.10.196: icmp_seq=2 ttl=64 time=0.572 ms 64 bytes from 10.10.10.196: icmp_seq=3 ttl=64 time=0.542 ms 64 bytes from 10.10.10.196: icmp_seq=4 ttl=64 time=0.593 ms --- 10.10.10.196 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 8ms 主机侧: [root@Hyman_server1 qemu]# ovs-ofctl dump-flows vs cookie=0x0, duration=2410.358s, table=0, n_packets=12, n_bytes=1176, priority=1,icmp,nw_dst=10.10.10.197,icmp_type=8,icmp_code=0 actions=drop cookie=0x0, duration=1641.917s, table=0, n_packets=3, n_bytes=294, priority=1,icmp,in_port=vnet4,nw_dst=10.10.10.195,icmp_type=8,icmp_code=0 actions=drop cookie=0x0, duration=2569.276s, table=0, n_packets=143, n_bytes=10850, priority=0 actions=NORMAL cookie=0x0, duration=1685.634s, table=1, n_packets=0, n_bytes=0, priority=0,icmp,in_port=vnet4,nw_dst=10.10.10.196,icmp_type=8,icmp_code=0 actions=NORMAL
虚机侧:
[root@s1_vm2 ~]# ping 10.10.10.195 -c 4
PING 10.10.10.195 (10.10.10.195) 56(84) bytes of data.
--- 10.10.10.195 ping statistics ---
4 packets transmitted, 0 received, 100% packet loss, time 112ms
主机侧:
[root@Hyman_server1 qemu]# ovs-ofctl dump-flows vs
cookie=0x0, duration=2605.175s, table=0, n_packets=12, n_bytes=1176, priority=1,icmp,nw_dst=10.10.10.197,icmp_type=8,icmp_code=0 actions=drop
cookie=0x0, duration=1836.734s, table=0, n_packets=7, n_bytes=686, priority=1,icmp,in_port=vnet4,nw_dst=10.10.10.195,icmp_type=8,icmp_code=0 actions=drop
cookie=0x0, duration=2764.093s, table=0, n_packets=145, n_bytes=10934, priority=0 actions=NORMAL
cookie=0x0, duration=1880.451s, table=1, n_packets=0, n_bytes=0, priority=0,icmp,in_port=vnet4,nw_dst=10.10.10.196,icmp_type=8,icmp_code=0 actions=NORMAL
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。