控制流表2.0
sh ovs-ofctl add-flow s1 dl_type=0x0806,actions=NORMAL
sh ovs-ofctl add-flow s1 dl_type=0x0800,nw_dst=192.168.0.17/32,actions=output:1
sh ovs-ofctl add-flow s1 dl_type=0x0800,nw_dst=192.168.0.18/32,actions=output:2
sh ovs-ofctl add-flow s1 dl_type=0x0800,nw_dst=192.168.0.19/32,actions=output:3
sh ovs-ofctl add-flow s1 dl_type=0x0800,nw_dst=192.168.0.36/30,actions=output:4
sh ovs-ofctl add-flow s2 dl_type=0x0806,actions=NORMAL
sh ovs-ofctl add-flow s2 dl_type=0x0800,nw_dst=192.168.0.36/32,actions=output:2
sh ovs-ofctl add-flow s2 dl_type=0x0800,nw_dst=192.168.0.37/32,actions=output:3
sh ovs-ofctl add-flow s2 dl_type=0x0800,nw_dst=192.168.0.38/32,actions=output:4
sh ovs-ofctl add-flow s2 dl_type=0x0800,nw_dst=192.168.0.39/32,actions=output:5
sh ovs-ofctl add-flow s2 dl_type=0x0800,nw_dst=192.168.0.16/30,actions=output:1
sh ovs-ofctl add-flow s3 in_port=1,actions=output:2
sh ovs-ofctl add-flow s3 in_port=2,actions=output:1
—————————————————————————————————————————————————————————————————————————————————————
方法1:
dpctl add-flow dl_type=0x0806,actions=NORMAL
dpctl add-flow dl_type=0x0800,priority=28,nw_dst=10.0.0.1/32,actions=output:1
dpctl add-flow dl_type=0x0800,priority=28,nw_dst=10.0.0.2/32,actions=output:2
dpctl add-flow dl_type=0x0800,priority=28,nw_dst=10.0.0.3/32,actions=output:3
dpctl add-flow dl_type=0x0800,priority=29,nw_src=10.0.0.1/32,nw_dst=10.0.0.2/32,actions=drop
方法2:
dpctl add-flow dl_type=0x0806,actions=NORMAL
dpctl add-flow dl_type=0x0800,nw_src=10.0.0.1/32,nw_dst=10.0.0.2/32,actions=drop
dpctl add-flow dl_type=0x0800,nw_dst=10.0.0.1/32,actions=output:1
dpctl add-flow dl_type=0x0800,nw_dst=10.0.0.2/32,actions=output:2
dpctl add-flow dl_type=0x0800,nw_dst=10.0.0.3/32,actions=output:3
特点:1.如果没有配置优先级,则优先级最大
2.如果配置了优先级,优先级大的匹配后,将不会再执行优先级小的;
3.优先级相同时,先配置的流表先执行。
—————————————————————————————————————————————————————————————————————————————————————
练习3:
保证网络的连通,并且为了保证所有线路都得到试用,需满足以下条件:
S1交换机访问h3的流量走上方
S1交换机访问h4的流量走下方
S4交换机访问h1的流量走上方
S4交换机访问h2的流量走下方

sh ovs-ofctl add-flow s2 in_port=1,actions=output:2
sh ovs-ofctl add-flow s2 in_port=2,actions=output:1
sh ovs-ofctl add-flow s3 in_port=1,actions=output:2
sh ovs-ofctl add-flow s3 in_port=2,actions=output:1
sh ovs-ofctl add-flow s1 dl_dst=00:00:00:00:00:03,actions=output:1
sh ovs-ofctl add-flow s1 dl_dst=00:00:00:00:00:04,actions=output:2
sh ovs-ofctl add-flow s1 dl_dst=00:00:00:00:00:01,actions=output:3
sh ovs-ofctl add-flow s1 dl_dst=00:00:00:00:00:02,actions=output:4
sh ovs-ofctl add-flow s4 dl_dst=00:00:00:00:00:01,actions=output:1
sh ovs-ofctl add-flow s4 dl_dst=00:00:00:00:00:02,actions=output:2
sh ovs-ofctl add-flow s4 dl_dst=00:00:00:00:00:03,actions=output:3
sh ovs-ofctl add-flow s4 dl_dst=00:00:00:00:00:04,actions=output:4
sh ovs-ofctl add-flow s1 dl_type=0x0806,actions=output:1,3,4
sh ovs-ofctl add-flow s4 dl_type=0x0806,actions=output:1,3,4
浙公网安备 33010602011771号