Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   ovs-vsctl    ( 8 )

утилита для запроса и настройки ovs-vswitchd (utility for querying and configuring ovs-vswitchd)

  Name  |  Synopsis  |  Description  |  Options  |  Commands  |  Examples  |    Configuration cookbook    |  Exit  |  See also  |

CONFIGURATION COOKBOOK

Port Configuration Add an ``internal port'' vlan10 to bridge br0 as a VLAN access port for VLAN 10, and configure it with an IP address:

ovs-vsctl add-port br0 vlan10 tag=10 -- set Interface vlan10 type=internal

ip addr add 192.168.0.123/24 dev vlan10

Add a GRE tunnel port gre0 to remote IP address 1.2.3.4 to bridge br0:

ovs-vsctl add-port br0 gre0 -- set Interface gre0 type=gre options:remote_ip=1.2.3.4

Port Mirroring Mirror all packets received or sent on eth0 or eth1 onto eth2, assuming that all of those ports exist on bridge br0 (as a side- effect this causes any packets received on eth2 to be ignored):

ovs-vsctl -- set Bridge br0 mirrors=@m \

-- --id=@eth0 get Port eth0 \

-- --id=@eth1 get Port eth1 \

-- --id=@eth2 get Port eth2 \

-- --id=@m create Mirror name=mymirror select-dst- port=@eth0,@eth1 select-src-port=@eth0,@eth1 output- port=@eth2

Remove the mirror created above from br0, which also destroys the Mirror record (since it is now unreferenced):

ovs-vsctl -- --id=@rec get Mirror mymirror \

-- remove Bridge br0 mirrors @rec

The following simpler command also works:

ovs-vsctl clear Bridge br0 mirrors

Quality of Service (QoS) Create a linux-htb QoS record that points to a few queues and use it on eth0 and eth1:

ovs-vsctl -- set Port eth0 qos=@newqos \

-- set Port eth1 qos=@newqos \

-- --id=@newqos create QoS type=linux-htb other-config:max-rate=1000000000 queues=0=@q0,1=@q1 \

-- --id=@q0 create Queue other-config:min-rate=100000000 other-config:max-rate=100000000 \

-- --id=@q1 create Queue other-config:min-rate=500000000

Deconfigure the QoS record above from eth1 only:

ovs-vsctl clear Port eth1 qos

To deconfigure the QoS record from both eth0 and eth1 and then delete the QoS record (which must be done explicitly because unreferenced QoS records are not automatically destroyed):

ovs-vsctl -- destroy QoS eth0 -- clear Port eth0 qos -- clear Port eth1 qos

(This command will leave two unreferenced Queue records in the database. To delete them, use "ovs-vsctl list Queue" to find their UUIDs, then "ovs-vsctl destroy Queue uuid1 uuid2" to destroy each of them or use "ovs-vsctl -- --all destroy Queue" to delete all records.)

Connectivity Monitoring Monitor connectivity to a remote maintenance point on eth0.

ovs-vsctl set Interface eth0 cfm_mpid=1

Deconfigure connectivity monitoring from above:

ovs-vsctl clear Interface eth0 cfm_mpid

NetFlow Configure bridge br0 to send NetFlow records to UDP port 5566 on host 192.168.0.34, with an active timeout of 30 seconds:

ovs-vsctl -- set Bridge br0 netflow=@nf \

-- --id=@nf create NetFlow targets=\"192.168.0.34:5566\" active-timeout=30

Update the NetFlow configuration created by the previous command to instead use an active timeout of 60 seconds:

ovs-vsctl set NetFlow br0 active_timeout=60

Deconfigure the NetFlow settings from br0, which also destroys the NetFlow record (since it is now unreferenced):

ovs-vsctl clear Bridge br0 netflow

sFlow Configure bridge br0 to send sFlow records to a collector on 10.0.0.1 at port 6343, using eth1´s IP address as the source, with specific sampling parameters:

ovs-vsctl -- --id=@s create sFlow agent=eth1 target=\"10.0.0.1:6343\" header=128 sampling=64 polling=10 \

-- set Bridge br0 sflow=@s

Deconfigure sFlow from br0, which also destroys the sFlow record (since it is now unreferenced):

ovs-vsctl -- clear Bridge br0 sflow

IPFIX Configure bridge br0 to send one IPFIX flow record per packet sample to UDP port 4739 on host 192.168.0.34, with Observation Domain ID 123 and Observation Point ID 456, a flow cache active timeout of 1 minute (60 seconds), maximum flow cache size of 13 flows, and flows sampled on output port with tunnel info(sampling on input and output port is enabled by default if not disabled) :

ovs-vsctl -- set Bridge br0 ipfix=@i \

-- --id=@i create IPFIX targets=\"192.168.0.34:4739\" obs_domain_id=123 obs_point_id=456 cache_active_timeout=60 cache_max_flows=13 \

other_config:enable-input-sampling=false other_config:enable-tunnel-sampling=true

Deconfigure the IPFIX settings from br0, which also destroys the IPFIX record (since it is now unreferenced):

ovs-vsctl clear Bridge br0 ipfix

802.1D Spanning Tree Protocol (STP) Configure bridge br0 to participate in an 802.1D spanning tree:

ovs-vsctl set Bridge br0 stp_enable=true

Set the bridge priority of br0 to 0x7800:

ovs-vsctl set Bridge br0 other_config:stp-priority=0x7800

Set the path cost of port eth0 to 10:

ovs-vsctl set Port eth0 other_config:stp-path-cost=10

Deconfigure STP from above:

ovs-vsctl set Bridge br0 stp_enable=false

Multicast Snooping Configure bridge br0 to enable multicast snooping:

ovs-vsctl set Bridge br0 mcast_snooping_enable=true

Set the multicast snooping aging time br0 to 300 seconds:

ovs-vsctl set Bridge br0 other_config:mcast-snooping- aging-time=300

Set the multicast snooping table size br0 to 2048 entries:

ovs-vsctl set Bridge br0 other_config:mcast-snooping- table-size=2048

Disable flooding of unregistered multicast packets to all ports. When set to true, the switch will send unregistered multicast packets only to ports connected to multicast routers. When it is set to false, the switch will send them to all ports. This command disables the flood of unregistered packets on bridge br0.

ovs-vsctl set Bridge br0 other_config:mcast-snooping- disable-flood-unregistered=true

Enable flooding of multicast packets (except Reports) on a specific port.

ovs-vsctl set Port eth1 other_config:mcast-snooping- flood=true

Enable flooding of Reports on a specific port.

ovs-vsctl set Port eth1 other_config:mcast-snooping-flood- reports=true

Deconfigure multicasting snooping from above:

ovs-vsctl set Bridge br0 mcast_snooping_enable=false

802.1D-2004 Rapid Spanning Tree Protocol (RSTP) Configure bridge br0 to participate in an 802.1D-2004 Rapid Spanning Tree:

ovs-vsctl set Bridge br0 rstp_enable=true

Set the bridge address of br0 to 00:aa:aa:aa:aa:aa :

ovs-vsctl set Bridge br0 other_config:rstp- address=00:aa:aa:aa:aa:aa

Set the bridge priority of br0 to 0x7000. The value must be specified in decimal notation and should be a multiple of 4096 (if not, it is rounded down to the nearest multiple of 4096). The default priority value is 0x800 (32768).

ovs-vsctl set Bridge br0 other_config:rstp-priority=28672

Set the bridge ageing time of br0 to 1000 s. The ageing time value should be between 10 s and 1000000 s. The default value is 300 s.

ovs-vsctl set Bridge br0 other_config:rstp-ageing- time=1000

Set the bridge force protocol version of br0 to 0. The force protocol version has two acceptable values: 0 (STP compatibility mode) and 2 (normal operation).

ovs-vsctl set Bridge br0 other_config:rstp-force-protocol- version=0

Set the bridge max age of br0 to 10 s. The max age value should be between 6 s and 40 s. The default value is 20 s.

ovs-vsctl set Bridge br0 other_config:rstp-max-age=10

Set the bridge forward delay of br0 to 15 s. This value should be between 4 s and 30 s. The default value is 15 s.

ovs-vsctl set Bridge br0 other_config:rstp-forward- delay=15

Set the bridge transmit hold count of br0 to 7 s. This value should be between 1 s and 10 s. The default value is 6 s.

ovs-vsctl set Bridge br0 other_config:rstp-transmit-hold- count=7

Enable RSTP on the Port eth0:

ovs-vsctl set Port eth0 other_config:rstp-enable=true

Disable RSTP on the Port eth0:

ovs-vsctl set Port eth0 other_config:rstp-enable=false

Set the priority of port eth0 to 32. The value must be specified in decimal notation and should be a multiple of 16 (if not, it is rounded down to the nearest multiple of 16). The default priority value is 0x80 (128).

ovs-vsctl set Port eth0 other_config:rstp-port-priority=32

Set the port number of port eth0 to 3:

ovs-vsctl set Port eth0 other_config:rstp-port-num=3

Set the path cost of port eth0 to 150:

ovs-vsctl set Port eth0 other_config:rstp-path-cost=150

Set the admin edge value of port eth0:

ovs-vsctl set Port eth0 other_config:rstp-port-admin- edge=true

Set the auto edge value of port eth0:

ovs-vsctl set Port eth0 other_config:rstp-port-auto- edge=true

Set the admin point to point MAC value of port eth0. Acceptable values are 0 (not point-to-point), 1 (point-to-point, the default value) or 2 (automatic detection). The auto-detection mode is not currently implemented, and the value 2 has the same effect of 0 (not point-to-point).

ovs-vsctl set Port eth0 other_config:rstp-admin-p2p-mac=1

Set the admin port state value of port eth0. true is the default value.

ovs-vsctl set Port eth0 other_config:rstp-admin-port- state=false

Set the mcheck value of port eth0:

ovs-vsctl set Port eth0 other_config:rstp-port-mcheck=true

Deconfigure RSTP from above:

ovs-vsctl set Bridge br0 rstp_enable=false

OpenFlow Version Configure bridge br0 to support OpenFlow versions 1.0, 1.2, and 1.3:

ovs-vsctl set bridge br0 protocols=OpenFlow10,OpenFlow12,OpenFlow13

Flow Table Configuration Make flow table 0 on bridge br0 refuse to accept more than 100 flows:

ovs-vsctl -- --id=@ft create Flow_Table flow_limit=100 overflow_policy=refuse -- set Bridge br0 flow_tables=0=@ft

Make flow table 0 on bridge br0 evict flows, with fairness based on the matched ingress port, when there are more than 100:

ovs-vsctl -- --id=@ft create Flow_Table flow_limit=100 overflow_policy=evict groups='"NXM_OF_IN_PORT[]"' -- set Bridge br0 flow_tables:0=@ft