指令操作
1、转发
ovs-ofctl add-flow br0 in_port=1,actions=output:2
2、洪泛
ovs-ofctl add-flow br0 in_port=1,actions=flood
3、in_port,即从入口转发回去
ovs-ofctl add-flow br0 in_port=1,actions=in_port
4、controller
ovs-ofctl add-flow br0 in_port=1,actions=controller
5、丢弃
ovs-ofctl add-flow br0 in_port=1,actions=drop
6、修改报文的信息
ovs-ofctl add-flow br0 in_port=1,actions=mod_vlan_vid:8,output:2
ovs-ofctl add-flow br0 in_port=1,actions=mod_vlan_pcp:7,output:2
ovs-ofctl add-flow br0 in_port=1,actions=strip_vlan,output:2
ovs-ofctl add-flow -O OpenFlow13 br0 in_port=1,actions=push_vlan:0x8100,set_field:4097-\>vlan_vid,output:2
7、修改mac、IP
# 修改源MAC
ovs-ofctl add-flow br0 in_port=1,actions=mod_dl_src:00:00:00:00:00:01,output:2
# 修改目的MAC
ovs-ofctl add-flow br0 in_port=1,actions=mod_dl_dst:00:00:00:00:00:01,output:2
# 修改源IP
ovs-ofctl add-flow br0 in_port=1,actions=mod_nw_src:192.168.1.1,output:2
# 修改目的IP
ovs-ofctl add-flow br0 in_port=1,actions=mod_nw_dst:192.168.1.1,output:2
8、动作为修改TCP/UDP/SCTP源目的端口
# 修改TCP源端口
ovs-ofctl add-flow br0 tcp,in_port=1,actions=mod_tp_src:67,output:2
# 修改TCP目的端口
ovs-ofctl add-flow br0 tcp,in_port=1,actions=mod_tp_dst:68,output:2
# 修改UDP源端口
ovs-ofctl add-flow br0 udp,in_port=1,actions=mod_tp_src:67,output:2
# 修改UDP目的端口
ovs-ofctl add-flow br0 udp,in_port=1,actions=mod_tp_dst:68,output:2
SFLOW
1.对网桥br0进行sflow监控
agent: 与collector通信所在的网口名,通常为管理口
target: collector监听的IP地址和端口,端口默认为6343
header: sFlow在采样时截取报文头的长度
polling: 采样时间间隔,单位为秒
ovs-vsctl -- --id=@sflow create sflow agent=eth0 target=\"10.0.0.1:6343\" header=128 sampling=64 polling=10 -- set bridge br0 sflow=@sflow
2、查看创建的sflow
ovs-vsctl list sflow
3、删除对应的网桥sflow配置,参数为sFlow UUID
ovs-vsctl remove bridge br0 sflow 7b9b962e-fe09-407c-b224-5d37d9c1f2b3
4、删除网桥下所有sflow配置
ovs-vsctl -- clear bridge br0 sflow
QOS
1.配置ingress policing,对接口eth0入流限速10Mbps
ovs-vsctl set interface eth0 ingress_policing_rate=10000
ovs-vsctl set interface eth0 ingress_policing_burst=8000
2、清除相应接口的ingress policer配置
ovs-vsctl set interface eth0 ingress_policing_rate=0
ovs-vsctl set interface eth0 ingress_policing_burst=0
3、查看接口ingress policer配置
ovs-vsctl list interface eth0
4、查看网桥支持的Qos类型
ovs-appctl qos/show-types br0