ovs-vswitchd(8)
โจ ovs-vswitchd(8) โ Open vSwitch daemon โจ
okay bestie, this is the manual page for ovs-vswitchd, the Open vSwitch daemon ๐
๐ธ NAME ๐ธ
ovs-vswitchd โ Open vSwitch daemon ๐ฆ
๐ SYNOPSIS ๐
ovs-vswitchd [database]
๐ DESCRIPTION ๐
Itโs a daemon that manages and controls any number of Open vSwitch switches on the local machine. Main character energy, honestly ๐
The database argument specifies how ovs-vswitchd connects to ovsdb-server. database may be an OVSDB active or passive connection method, as described in ovsdb(7). The default is unix:/run/openvswitch/db.sock ๐
ovs-vswitchd retrieves its configuration from database at startup. It sets up Open vSwitch datapaths and then operates switching across each bridge described in its configuration files. As the database changes, ovs-vswitchd automatically updates its configuration to match โจ
ovs-vswitchd switches may be configured with any of the following features:
- L2 switching with MAC learning ๐
- NIC bonding with automatic fail-over and source MAC-based TX load balancing ("SLB") ๐ฅ
- 802.1Q VLAN support ๐
- Port mirroring, with optional VLAN tagging ๐
- NetFlow v5 flow logging ๐
- sFlow(R) monitoring ๐ธ
- Connectivity to an external OpenFlow controller, such as NOX ๐ฆ
Only a single instance of ovs-vswitchd is intended to run at a time. A single ovs-vswitchd can manage any number of switch instances, up to the maximum number of supported Open vSwitch datapaths ๐
ovs-vswitchd does all the necessary management of Open vSwitch datapaths itself. Thus, ovs-dpctl(8) (and its userspace datapath counterparts accessible via ovs-appctl dpctl/command) are not needed with ovs-vswitchd and should not be used because they can interfere with its operation. These tools are still useful for diagnostics ๐ซถ
An Open vSwitch datapath kernel module must be loaded for ovs-vswitchd to be useful. Refer to the documentation for instructions on how to build and load the Open vSwitch kernel module ๐
โจ OPTIONS โจ
--mlockallโ Causesovs-vswitchdto call themlockall()function, to attempt to lock all of its process memory into physical RAM on page faults (on allocation, when running on Linux kernel 4.4 or older), preventing the kernel from paging any of its memory to disk. This helps to avoid networking interruptions due to system memory pressure. Some systems do not supportmlockall()at all, and other systems only allow privileged users, such as the superuser, to use it.ovs-vswitchdemits a log message ifmlockall()is unavailable or unsuccessful ๐
๐ง DPDK Options ๐ง
For details on initializing ovs-vswitchd to use DPDK ports, refer to the documentation or ovs-vswitchd.conf.db(5) ๐
๐ฅ DPDK HW Access Options ๐ฅ
--hw-rawio-accessโ Tellsovs-vswitchdto retain theCAP_SYS_RAWIOcapability, to allow userspace drivers access to raw hardware memory. This will also allow theovs-vswitchddaemon to calliopl()andioperm()functions as well as access memory devices to set port access. This is a very powerful capability, so generally only enable as needed for specific hardware (for example mlx5 with full hardware offload viarte_flow) โ ๏ธ
๐ Daemon Options ๐
The following options are valid on POSIX based platforms ๐ง
--pidfile[=pidfile]โ Causes a file (by default,ovs-vswitchd.pid) to be created indicating the PID of the running process. If thepidfileargument is not specified, or if it does not begin with/, then it is created in/run/openvswitch. If--pidfileis not specified, no pidfile is created ๐--overwrite-pidfileโ By default, when--pidfileis specified and the specified pidfile already exists and is locked by a running process,ovs-vswitchdrefuses to start. Specify--overwrite-pidfileto cause it to instead overwrite the pidfile. When--pidfileis not specified, this option has no effect ๐ซถ--detachโ Runsovs-vswitchdas a background process. The process forks, and in the child it starts a new session, closes the standard file descriptors (which has the side effect of disabling logging to the console), and changes its current directory to the root (unless--no-chdiris specified). After the child completes its initialization, the parent exits.ovs-vswitchddetaches only after it has connected to the database, retrieved the initial configuration, and set up that configuration ๐--monitorโ Creates an additional process to monitor theovs-vswitchddaemon. If the daemon dies due to a signal that indicates a programming error (SIGABRT,SIGALRM,SIGBUS,SIGFPE,SIGILL,SIGPIPE,SIGSEGV,SIGXCPU, orSIGXFSZ) then the monitor process starts a new copy of it. If the daemon dies or exits for another reason, the monitor process exits. This option is normally used with--detach, but it also functions without it ๐--no-chdirโ By default, when--detachis specified,ovs-vswitchdchanges its current working directory to the root directory after it detaches. Otherwise, invokingovs-vswitchdfrom a carelessly chosen directory would prevent the administrator from unmounting the file system that holds that directory. Specifying--no-chdirsuppresses this behavior, preventingovs-vswitchdfrom changing its current working directory. This may be useful for collecting core files, since it is common behavior to write core dumps into the current working directory and the root directory is not a good directory to use. This option has no effect when--detachis not specified ๐--no-self-confinementโ By default daemon will try to self-confine itself to work with files under well-known directories determined during build. It is better to stick with this default behavior and not to use this flag unless some other Access Control is used to confine daemon. Note that in contrast to other access control implementations that are typically enforced from kernel-space (e.g. DAC or MAC), self-confinement is imposed from the user-space daemon itself and hence should not be considered as a full confinement strategy, but instead should be viewed as an additional layer of security ๐ก๏ธ--userโ Causesovs-vswitchdto run as a different user specified in"user:group", thus dropping most of the root privileges. Short forms"user"and":group"are also allowed, with current user or group are assumed respectively. Only daemons started by the root user accepts this argument. On Linux, daemons will be grantedCAP_IPC_LOCKandCAP_NET_BIND_SERVICESbefore dropping root privileges. Daemons that interact with a datapath, such asovs-vswitchd, will be granted three additional capabilities, namelyCAP_NET_ADMIN,CAP_NET_BROADCASTandCAP_NET_RAW. The capability change will apply even if the new user is root ๐
๐ Public Key Infrastructure Options ๐
-pprivkey.pem,--private-key=privkey.pem โ Specifies a PEM file containing the private key used asovs-vswitchdโs identity for outgoing SSL/TLS connections ๐-ccert.pem,--certificate=cert.pem โ Specifies a PEM file containing a certificate that certifies the private key specified on-por--private-keyto be trustworthy. The certificate must be signed by the certificate authority (CA) that the peer in SSL/TLS connections will use to verify it ๐-Ccacert.pem,--ca-cert=cacert.pem โ Specifies a PEM file containing the CA certificate thatovs-vswitchdshould use to verify certificates presented to it by SSL/TLS peers. (This may be the same certificate that SSL/TLS peers use to verify the certificate specified on-cor--certificate, or it may be a different one, depending on the PKI design in use.) ๐ธ-C none,--ca-cert=noneโ Disables verification of certificates presented by SSL/TLS peers. This introduces a security risk, because it means that certificates cannot be verified to be those of known trusted hosts โ ๏ธ--ssl-server-name=servername โ Specifies the server name to use for TLS Server Name Indication (SNI). By default, the hostname from the connection string is used for SNI. This option allows overriding the SNI hostname, which is useful when connecting through proxies or service meshes where the connection endpoint differs from the intended server name ๐ฆ--bootstrap-ca-cert=cacert.pem โ Whencacert.pemexists, this option has the same effect as-Cor--ca-cert. If it does not exist, thenovs-vswitchdwill attempt to obtain the CA certificate from the SSL/TLS peer on its first SSL/TLS connection and save it to the named PEM file. If it is successful, it will immediately drop the connection and reconnect, and from then on all SSL/TLS connections must be authenticated by a certificate signed by the CA certificate thus obtained. This option exposes the SSL/TLS connection to a man-in-the-middle attack obtaining the initial CA certificate, but it may be useful for bootstrapping. This option is only useful if the SSL/TLS peer sends its CA certificate as part of the SSL/TLS certificate chain. SSL/TLS protocols do not require the server to send the CA certificate. This option is mutually exclusive with-Cand--ca-cert๐ฅ--peer-ca-cert=peer-cacert.pem โ Specifies a PEM file that contains one or more additional certificates to send to SSL/TLS peers.peer-cacert.pemshould be the CA certificate used to signovs-vswitchdโs own certificate, that is, the certificate specified on-cor--certificate. Ifovs-vswitchdโs certificate is self-signed, then--certificateand--peer-ca-certshould specify the same file. This option is not useful in normal operation, because the SSL/TLS peer must already have the CA certificate for the peer to have any confidence inovs-vswitchdโs identity. However, this offers a way for a new installation to bootstrap the CA certificate on its first SSL/TLS connection ๐ซถ
๐ Logging Options ๐
-v[spec],--verbose=[spec]โ Sets logging levels. Without anyspec, sets the log level for every module and destination todbg. Otherwise,specis a list of words separated by spaces or commas or colons, up to one from each category below:- A valid module name, as shown by the
vlog/listcommand onovs-appctl(8), narrows the log level change to that one module. ๐ง syslog,console, orfileโ limits the log level change to only the system log, the console, or a file, respectively. (Heads up, bestie: if--detachis specified,ovs-vswitchdcloses its standard file descriptors, so logging to the console will have no effect.) ๐off,emer,err,warn,info, ordbgโ controls the log level. Messages at that severity or higher get logged, and lower-severity messages get filtered out.offfilters out everything. Seeovs-appctl(8)for the definition of each log level. ๐
Case is not significant within spec.
Regardless of the log levels set for file, logging to a file will not take place unless --log-file is also specified (see below).
For compatibility with older versions of OVS, any is accepted as a word but has no effect.
-v,--verboseโ sets the maximum logging verbosity level, equivalent to--verbose=dbg. ๐ฅ-vPATTERN:destination:pattern,--verbose=PATTERN:destination:patternโ sets the log pattern fordestinationtopattern. Refer toovs-appctl(8)for a description of the valid syntax forpattern. ๐-vFACILITY:facility,--verbose=FACILITY:facilityโ sets the RFC5424 facility of the log message.facilitycan be one ofkern,user,mail,daemon,auth,syslog,lpr,news,uucp,clock,ftp,ntp,audit,alert,clock2,local0,local1,local2,local3,local4,local5,local6, orlocal7. If this option is not specified,daemonis used as the default for the local system syslog, andlocal0is used while sending a message to the target provided via the--syslog-targetoption. ๐--log-file[=file]โ enables logging to a file. Iffileis specified, then it is used as the exact name for the log file. The default log file name used iffileis omitted is/var/log/openvswitch/ovs-vswitchd.log. ๐ธ--syslog-target=host:portโ sends syslog messages to UDP port onhost, in addition to the system syslog. Thehostmust be a numerical IP address, not a hostname. ๐--syslog-method=methodโ specifies how syslog messages should be sent to the syslog daemon. These forms are supported:libcโ use the libcsyslog()function. The downside of using this option is that libc adds a fixed prefix to every message before it is actually sent to the syslog daemon over the/dev/logUNIX domain socket. ๐ญunix:fileโ use a UNIX domain socket directly. It is possible to specify an arbitrary message format with this option. However,rsyslogd8.9 and older versions use a hard coded parser function anyway that limits UNIX domain socket use. If you want to use an arbitrary message format with olderrsyslogdversions, then use a UDP socket to the localhost IP address instead. ๐ฆudp:ip:portโ use a UDP socket. With this method it is possible to use an arbitrary message format also with olderrsyslogd. When sending syslog messages over a UDP socket, extra precaution needs to be taken into account โ for example, the syslog daemon needs to be configured to listen on the specified UDP port, accidentaliptablesrules could be interfering with local syslog traffic, and there are some security considerations that apply to UDP sockets but do not apply to UNIX domain sockets. ๐nullโ discards all messages logged to syslog. ๐
The default is taken from the OVS_SYSLOG_METHOD environment variable; if it is unset, the default is libc.
๐ Other Options ๐
--unixctl=socketโ sets the name of the control socket on whichovs-vswitchdlistens for runtime management commands (see RUNTIME MANAGEMENT COMMANDS, below). Ifsocketdoes not begin with/, it is interpreted as relative to/run/openvswitch. If--unixctlis not used at all, the default socket is/run/openvswitch/ovs-vswitchd.pid.ctl, wherepidisovs-vswitchd's process ID. Specifyingnoneforsocketdisables the control socket feature. ๐ซถ-h,--helpโ prints a brief help message to the console. โจ-V,--versionโ prints version information to the console. ๐
๐ซถ RUNTIME MANAGEMENT COMMANDS ๐ซถ
ovs-appctl(8) can send commands to a running ovs-vswitchd process. The currently supported commands are described below. The command descriptions assume an understanding of how to configure Open vSwitch. ๐
๐ธ GENERAL COMMANDS ๐ธ
exit --cleanupโ causesovs-vswitchdto gracefully terminate. If--cleanupis specified, deletes flows from datapaths and releases other datapath resources configured byovs-vswitchd. Otherwise, datapath flows and other resources remain undeleted. Resources of datapaths that are integrated intoovs-vswitchd(e.g. thenetdevdatapath type) are always released regardless of--cleanup, except for ports withinternaltype. Use--cleanupto releaseinternalports too. ๐qos/show-types interfaceโ queries the interface for a list of Quality of Service types that are configurable via Open vSwitch for the given interface. โจqos/show interfaceโ queries the kernel for Quality of Service configuration and statistics associated with the given interface. ๐bfd/show [interface]โ displays detailed information about Bidirectional Forwarding Detection configured oninterface. Ifinterfaceis not specified, then displays detailed information about all interfaces with BFD enabled. ๐ฆbfd/set-forwarding [interface] statusโ forces the fault status of the BFD module oninterface(or all interfaces if none is given) to bestatus.statuscan be"true","false", or"normal", which reverts to the standard behavior. ๐cfm/show [interface]โ displays detailed information about Connectivity Fault Management configured oninterface. Ifinterfaceis not specified, then displays detailed information about all interfaces with CFM enabled. ๐cfm/set-fault [interface] statusโ forces the fault status of the CFM module oninterface(or all interfaces if none is given) to bestatus.statuscan be"true","false", or"normal", which reverts to the standard behavior. ๐stp/tcn [bridge]โ forces a topology change event onbridgeif it's running STP. This may cause it to send Topology Change Notifications to its peers and flush its MAC table. If nobridgeis given, forces a topology change event on all bridges. ๐ฅstp/show [bridge]โ displays detailed information about spanning tree on thebridge. Ifbridgeis not specified, then displays detailed information about all bridges with STP enabled. ๐ธrstp/tcn [bridge]โ forces a topology change event onbridgeif it's running RSTP. This may cause it to send Topology Change Notifications to its peers and flush its MAC table. If nobridgeis given, forces a topology change event on all bridges. โญrstp/show [bridge]โ displays detailed information about rapid spanning tree on thebridge. Ifbridgeis not specified, then displays detailed information about all bridges with RSTP enabled. ๐ง
๐ฆ BRIDGE COMMANDS ๐ฆ
These commands manage bridges. ๐
fdb/add bridge port vlan macโ addsmacaddress to aportandvlanon abridge. This utility can be used to pre-populate the fdb table without relying on dynamic MAC learning. โจfdb/del bridge vlan macโ deletesmacaddress from a port andvlanon abridge. ๐fdb/flush [bridge]โ flushes thebridgeMAC address learning table, or all learning tables if nobridgeis given. ๐ซถfdb/show [bridge...]โ lists each MAC address/VLAN pair learned by the specified bridge, along with the port on which it was learned and the age of the entry, in seconds. Multiple bridge names may be given to query several bridges in a single call, and if nobridgeis given the tables of all bridges are shown. When more than one bridge is shown, text output gains a leading"Bridge"column that groups each bridge's entries, printing the bridge name only on its first row; a bridge with no entries is listed as a name-only row. JSON output is an object keyed by bridge name, whose values are arrays of that bridge's entries. ๐fdb/stats-clear [bridge]โ clears thebridgeMAC address learning table statistics, or all statistics if nobridgeis given. ๐fdb/stats-show bridgeโ shows MAC address learning table statistics for the specifiedbridge. ๐mdb/flush [bridge]โ flushes thebridgemulticast snooping table, or all snooping tables if nobridgeis given. ๐mdb/show bridgeโ lists each multicast group/VLAN pair learned by the specifiedbridge, along with the port on which it was learned and the age of the entry, in seconds. ๐ธbridge/reconnect [bridge]โ makesbridgedrop all of its OpenFlow controller connections and reconnect. Ifbridgeis not specified, then all bridges drop their controller connections and reconnect. This command might be useful for debugging OpenFlow controller issues. ๐ฆbridge/dump-flows [--offload-stats] bridgeโ lists all flows inbridge, including those normally hidden to commands such asovs-ofctl dump-flows. Flows set up by mechanisms such as in-band control and fail-open are hidden from the controller since it is not allowed to modify or override them. If--offload-statsare specified, then also list statistics for offloaded packets and bytes, which are a subset of the total packets and bytes. ๐ฅ
๐ BOND COMMANDS ๐
These bad boys manage the bonded ports on your Open vSwitch bridges. And bestie, before we get into the commands, you gotta understand one little detail of how bonding actually works, because it's called "source load balancing" (SLB for short) and it's genuinely the main character here.
Okay so instead of directly assigning Ethernet source addresses to members like some kind of amateur, the bonding implementation computes a function that maps a 48-bit Ethernet source address into an 8-bit value โ that's the "MAC hash" value, periodt. Then every Ethernet address that maps to the same single 8-bit value gets assigned to the same single member. That's the whole vibe. ๐ฆ
bond/list
Lists all of the bonds, and their members, on each bridge. That's it, that's the post. โจ
bond/show [port]
Lists all the bond-specific info โ we're talking updelay, downdelay, time until the next rebalance โ about the given bonded port. Or, if you don't hand it a port, it does it for all the bonded ports, because it's generous like that.
It also lists info about each member, and the way that it gives you the whole picture is iconic:
- whether it's enabled or disabled
- the time to completion of an
updelayordowndelay, if one is currently in progress - whether it's the active member
- the hashes assigned to the member
Any LACP info related to this bond? You'll find that over in the lacp/show command, iykyk. ๐ซถ
bond/migrate port hash member
Only valid for SLB bonds, no exceptions. Assigns a given MAC hash to a new member.
portโ specifies the bond porthashโ the MAC hash to be migrated (as a decimal number between0and255)memberโ the new member to be assigned
Lowkey important: the reassignment is not permanent. Rebalancing or fail-over will cause the MAC hash to be shifted to a new member in the usual manner. So don't get attached. ๐ญ
Also a MAC hash cannot be migrated to a disabled member. Do not try it. It will not slay.
bond/set-active-member port member
Sets member as the active member on port. member must currently be enabled โ that's the whole prerequisite, bestie.
And again, the setting is not permanent: a new active member will be selected if member becomes disabled. Cue the sad violin. ๐ป
bond/enable-member port member
bond/disable-member port member
Enables (or disables, respectively, you got this) member on the given bond port, skipping any updelay (or downdelay). We're cutting the line, respectfully.
This setting is not permanent either: it persists only until the carrier status of member changes. So it's giving temporary-authentication energy. ๐
bond/hash mac [vlan] [basis]
Returns the hash value which would be used for mac with vlan and basis if specified. Cute little lookup, no side effects, a whole vibe check for your MAC. ๐ธ
lacp/show [port]
Lists all of the LACP related info about the given port:
- active or passive
- aggregation key
- system id
- system priority
It also lists info about each member:
- whether it's enabled or disabled
- whether it's attached or detached
- port id and priority
- actor information
- partner information
If port is not specified, then it displays detailed information about all interfaces with CFM enabled. (Yes, that's what the page says โ CFM. Not a typo on my end, I promise. ๐)
lacp/stats-show [port]
Lists various stats about LACP PDUs โ number of RX/TX PDUs, bad PDUs received โ and member state (the number of times its state expired/defaulted and carrier status changed) for the given port.
If port is not specified, then it displays stats of all interfaces with LACP enabled. We love a default that just does everything for you. ๐
๐ฅ DPCTL DATAPATH DEBUGGING COMMANDS ๐ฅ
Okay so real talk: the primary way to configure ovs-vswitchd is through the Open vSwitch database, e.g. using ovs-vsctl(8). That's the front door.
These commands are the back door โ they provide a debugging interface for managing datapaths. They implement the same features (and syntax) as ovs-dpctl(8). But here's where they're built different: unlike ovs-dpctl(8), these commands work with datapaths that are integrated into ovs-vswitchd (e.g. the netdev datapath type). Main character energy. ๐
Do not use commands to add or remove or modify datapaths ifovs-vswitchdis running, because this interferes withovs-vswitchd's own datapath management. Like, it will fight you and it will win. Don't. ๐ซ
dpctl/add-dp dp [netdev[,option]...]
Creates datapath dp, with a local port also named dp. This will fail if a network device dp already exists. Name collision = no deal.
If netdevs are specified, ovs-vswitchd adds them to the new datapath, just as if add-if was specified. Efficiency queen. โจ
dpctl/del-dp dp
Deletes datapath dp. If dp is associated with any network devices, they are automatically removed too. No loose ends, we love a clean exit. ๐ง
dpctl/add-if dp netdev[,option]...
Adds each netdev to the set of network devices datapath dp monitors โ where dp is the name of an existing datapath, and netdev is the name of one of the host's network devices, e.g. eth0.
Once a network device has been added to a datapath, the datapath has complete ownership of the network device's traffic, and the network device appears silent to the rest of the system. It's giving ghosted-by-design. ๐ป
A netdev may be followed by a comma-separated list of options. The following options are currently supported:
type=type โ specifies the type of port to add. The default type issystem.port_no=port โ requests a specific port number within the datapath. If this option is not specified then one will be automatically assigned.key=value โ adds an arbitrary key-value option to the port's configuration.
ovs-vswitchd.conf.db(5) documents the available port types and options, so go read that if you want the full lore. ๐
dpctl/set-if dp port[,option]...
Reconfigures each port in dp as specified.
An option of the form key=value adds the specified key-value option to the port or overrides an existing key's value. An option of the form key=, that is, without a value, deletes the key-value named key. Sneaky little deletion, we respect it.
The type and port number of a port cannot be changed, sotypeandport_noare only allowed if they match the existing configuration. Read that again. Matching only. No glow-ups allowed. ๐
dpctl/del-if dp netdev...
Removes each netdev from the list of network devices datapath dp monitors. Bye bestie. ๐ฆ
dpctl/dump-dps
Prints the name of each configured datapath on a separate line. Simple. Iconic. No notes. โญ
dpctl/show [-s | --statistics] [dp...]
Prints a summary of configured datapaths, including their datapath numbers and a list of ports connected to each datapath. (The local port is identified as port 0 โ remember that, it comes up.)
If -s or --statistics is specified, then packet and byte counters are also printed for each port.
The datapath numbers consist of flow stats and mega flow mask stats:
- The "lookups" row displays three stats related to flow lookup triggered by processing incoming packets in the datapath:
- "hit" displays the number of packets that match existing flows
- "missed" displays the number of packets not matching any existing flow and that require user space processing
- "lost" displays the number of packets destined for the user space process but subsequently dropped before reaching userspace
The sum of "hit" and "miss" equals the total number of packets the datapath processed. Math is math. ๐งฎ
- The "flows" row displays the number of flows in the datapath.
- The "masks" row displays the mega flow mask stats. This row is omitted for a datapath not implementing mega flow.
- "hit" displays the total number of masks visited for matching incoming packets
- "total" displays the number of masks in the datapath
- "hit/pkt" displays the average number of masks visited per packet; the ratio between "hit" and the total number of packets processed by the datapath
If one or more datapaths are specified, information on only those datapaths is displayed. Otherwise, ovs-vswitchd displays information about all configured datapaths. FOMO-proof. ๐
๐ DATAPATH FLOW TABLE DEBUGGING COMMANDS ๐
The following commands are primarily useful for debugging Open vSwitch. Big important vibe check here: the flow table entries (both matches and actions) that they work with are not OpenFlow flow entries. Instead, they're different and considerably simpler flows maintained by the Open vSwitch kernel module. Different species entirely, no cap.
Do not use commands to add or remove or modify datapath flows ifovs-vswitchdis running, because it interferes withovs-vswitchd's own datapath flow management. Useovs-ofctl(8)instead to work with OpenFlow flow entries. Right tool, right job, periodt. ๐
The dp argument to each of these commands is optional when exactly one datapath exists, in which case that datapath is the default. When multiple datapaths exist, then a datapath name is required. Sorry, that's the rule. ๐คทโโ๏ธ
dpctl/dump-flows [-m | --more] [--names | --no-names] [dp] [filter=filter] [type=type] [pmd=pmd]
Prints to the console all flow entries in datapath dp's flow table. Without -m or --more, the output omits match fields that a flow wildcards entirely; with -m or --more, the output includes all wildcarded fields. Show me everything, bestie. ๐
If filter=filter is specified, it only displays the flows that match the filter. filter is a flow in the form similar to that accepted by ovs-ofctl(8)'s add-flow command. (This is not an OpenFlow flow: besides other differences, it never contains wildcards.) The filter is also useful to match wildcarded fields in the datapath flow. As an example:
filter='tcp,tp_src=100'
will match the datapath flow containing:
'tcp(src=80/0xff00,dst=8080/0xff)'
If pmd=pmd is specified, it only displays flows of the specified pmd. Using pmd=-1 will restrict the dump to flows from the main thread. This option is only supported by the userspace datapath.
If type=type is specified, it only displays flows of the specified types. This option is supported only for ovs-appctl dpctl/dump-flows. type is a comma separated list, which can contain any of the following:
ovsโ displays flows handled in the ovs dptcโ displays flows handled in the tc dpdpdkโ displays flows fully offloaded by dpdkoffloadedโ displays flows offloaded to the HWnon-offloadedโ displays flows not offloaded to the HWpartially-offloadedโ displays flows where only part of their proccessing is done in HWallโ displays all the types of flows
By default all the types of flows are displayed. ovs-dpctl always acts as if the type was ovs. ๐ซ
dpctl/add-flow [dp] flow actions
dpctl/mod-flow [--clear] [--may-create] [-s | --statistics] [dp] flow actions
Adds or modifies a flow in dp's flow table that, when a packet matching flow arrives, causes actions to be executed. The moment. The execution. Obsessed. ๐ฅ
The add-flow command succeeds only if flow does not already exist in dp. Contrariwise, mod-flow without --may-create only modifies the actions for an existing flow. With --may-create, mod-flow will add a new flow or modify an existing one. Flexible queen behavior. ๐
-s,--statisticsโ passing this makesmod-flowspill the modified flow's stats: how many packets and bytes have ridden through the flow, how long it's been since the flow last chewed on a packet (if it ever has), and โ for TCP flows โ the union of all the TCP flags that have been processed through it. โจ--clearโ zeros out the flow's statistics. And if you also passed-sor--statistics, the numbers you see printed are the ones from right before the wipe. bestie, screenshot them, they're gone after this ๐
NOTE:flowandactionsare not the same syntax you know fromovs-ofctl(8)'sadd-flowcommand. Like, do not just copy-paste and hope. fr fr. ๐
๐ Usage Examples ๐
Forward ARP between ports 1 and 2 on datapath myDP:
ovs-dpctl add-flow myDP \
"in_port(1),eth(),eth_type(0x0806),arp()" 2
ovs-dpctl add-flow myDP \
"in_port(2),eth(),eth_type(0x0806),arp()" 1
Forward all IPv4 traffic between two addresses on ports 1 and 2:
ovs-dpctl add-flow myDP \
"in_port(1),eth(),eth_type(0x800),\
ipv4(src=172.31.110.4,dst=172.31.110.5)" 2
ovs-dpctl add-flow myDP \
"in_port(2),eth(),eth_type(0x800),\
ipv4(src=172.31.110.5,dst=172.31.110.4)" 1
dpctl/add-flows [dp] file
dpctl/mod-flows [dp] file
dpctl/del-flows [dp] file
These three read flow entries out of file (or from stdin if file is -) and then add, modify, or delete each one on the datapath. ๐ธ
Each flow specification (think: each line in file) can start with an add, modify, or delete keyword to say exactly what should happen to that flow. A flow spec that doesn't have one of those keywords just gets treated according to whichever command you used. Every single flow modification runs as its own individual transaction, in the order you specified. no bundling, no skipping the queue, periodt.
dpctl/del-flow [-s | --statistics] [dp] flow
Deletes the flow from dp's flow table that matches flow. If you threw in -s or --statistics, then del-flow prints the deleted flow's statistics on the way out. ๐ฆ
dpctl/get-flow [dp] ufid:ufid [-m | --more] [--names | --no-names]
Fetches the flow from dp's flow table that has the unique identifier ufid. And heads up: ufid has to be given as a string of 32 hexadecimal characters. exactly 32, not 31, not 33, iykyk. ๐ฅ
dpctl/del-flows [dp]
Deletes all flow entries from datapath dp's flow table. yes, all of them. like the whole table. ๐
๐ DATAPATH FLOW CACHE COMMANDS ๐
The following commands are useful for debugging and configuring the datapath flow cache settings. very much the "look under the hood" vibes.
dpctl/cache-get-size [dp]
Prints the current cache sizes to the console. ๐ซถ
dpctl/cache-set-size dp cache size
Sets dp's specific cache to the given size. You can find the cache name by using the cache-get-size command โ so like, go look first, then come back and set it. โจ
๐ CONNECTION TRACKING TABLE COMMANDS ๐
These commands are your little toolkit for debugging and configuring the connection tracking table in the datapath. conn-track stans rise ๐ง
The dp argument to each of these commands is optional when exactly one datapath exists, in which case that datapath is the default. When multiple datapaths exist, then a datapath name is required. no name, no entry, sorry bestie.
N.B. (Linux specific): the system datapaths (i.e. the Linux kernel module Open vSwitch datapaths) share a single connection tracking table โ and yes, that's the same table other kernel subsystems use too, likeiptables,nftables, and the regular host stack. So the following commands do not apply specifically to one datapath. one table to rule them all ๐ญ
dpctl/ipf-set-enabled [dp] v4|v6
dpctl/ipf-set-disabled [dp] v4|v6
Enables or disables IP fragmentation handling for the userspace connection tracker. You must specify either v4 or v6. Both IPv4 and IPv6 fragment reassembly are enabled by default. Only supported for the userspace datapath. ๐
dpctl/ipf-set-min-frag [dp] v4|v6 minfrag
Sets the minimum fragment size (L3 header and data) for non-final fragments to minfrag. You gotta pick v4 or v6. For enhanced DOS security, higher minimum fragment sizes can usually be used. The default IPv4 value is 1200 and the clamped minimum is 400. The default IPv6 value is 1280, with a clamped minimum of 400, for testing flexibility. The maximum fragment size is not clamped, however โ so if you set this value too high, valid fragments might get dropped. ๐ฌ Only supported for userspace datapath.
dpctl/ipf-set-max-nfrags [dp] maxfrags
Sets the maximum number of fragments tracked by the userspace datapath connection tracker to maxfrags. The default value is 1000 and the clamped maximum is 5000. Note that packet buffers can be held by the fragmentation module while fragments are incomplete โ but they will timeout after 15 seconds. So size your memory pool accordingly when fragmentation is enabled. Only supported for userspace datapath. ๐
dpctl/ipf-get-status [dp] [-m | --more]
Gets the configuration settings and fragment counters associated with the fragmentation handling of the userspace datapath connection tracker. With -m or --more, it also dumps the IP fragment lists. Only supported for userspace datapath. ๐ฆ
dpctl/dump-conntrack [-m | --more] [-s | --statistics] [dp] [zone=zone]
Prints to the console all the connection entries in the tracker used by dp. If zone=zone is specified, only shows the connections in zone. With --more, some implementation specific details are included. With --statistics, timeouts and timestamps are added to the output. it's giving full receipts ๐
dpctl/dump-conntrack-exp [dp] [zone=zone]
Prints to the console all the expectation entries in the tracker used by dp. If zone=zone is specified, only shows the expectations in zone. Only supported for userspace datapath. ๐
dpctl/flush-conntrack [dp] [zone=zone] [ct-origin-tuple [ct-reply-tuple]]
Flushes the connection entries in the tracker used by dp based on zone and connection tracking tuple ct-origin-tuple. If ct-tuple is not provided, it flushes all the connection entries. If zone=zone is specified, only flushes the connections in zone. ๐ธ
If ct-[orig|reply]-tuple is provided, it flushes the connection entry specified by ct-[orig|reply]-tuple in zone. The zone defaults to 0 if it is not provided. The userspace connection tracker requires flushing with the original pre-NATed tuple, and a warning log will be generated otherwise. The tuple can be partial โ it'll remove all connections that are matching on the specified fields. And in order to specify only ct-reply-tuple, provide an empty string as ct-origin-tuple. (yes, empty string. it's a whole thing. ๐)
Note: Currently there is a limitation for matching on ICMP โ in order to partially match on ICMP parameters, the ct-[orig|reply]-tuple has to include either source or destination IP. no skipping that part, bestie.
An example of an IPv4 ICMP ct-[orig|reply]-tuple:
"ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=1,icmp_type=8,icmp_code=0,icmp_id=10"
An example of an IPv6 TCP ct-[orig|reply]-tuple:
"ct_ipv6_src=fc00::1,ct_ipv6_dst=fc00::2,ct_nw_proto=6,ct_tp_src=1,ct_tp_dst=2"
dpctl/ct-stats-show [dp] [zone=zone] [-m | --more]
Displays the number of connections grouped by protocol used by dp. If zone=zone is specified, the numbers refer to the connections in zone. With --more, it groups by connection state for each protocol. so organized, we love a categorized icon โจ
dpctl/ct-bkts [dp] [gt=threshold]
For each conntrack bucket, displays the number of connections used by dp. If gt=threshold is specified, bucket numbers are displayed when the number of connections in a bucket is greater than threshold. basically a "only show me the spicy ones" filter ๐ฅ
dpctl/ct-set-maxconns [dp] maxconns
Sets the maximum limit of connection tracker entries to maxconns on dp. This can be used to reduce the processing load on the system due to connection tracking, or simply to limit connection tracking. If the number of connections is already over the new maximum limit you requested, then the new maximum limit will be enforced when the number of connections decreases to that limit โ which normally happens due to connection expiry. Only supported for userspace datapath. ๐
dpctl/ct-get-maxconns [dp]
Prints the maximum limit of connection tracker entries on dp. Only supported for userspace datapath.
dpctl/ct-get-nconns [dp]
Prints the current number of connection tracker entries on dp. Only supported for userspace datapath. ๐
dpctl/ct-enable-tcp-seq-chk [dp]
dpctl/ct-disable-tcp-seq-chk [dp]
Enables or disables TCP sequence checking. When set to disabled, all sequence number verification is disabled โ including for TCP resets. This is similar, but not the same as be_liberal mode, as in Netfilter. Disabling sequence number verification is not an optimization in itself, but is needed for some hardware offload support which might offer some performance advantage. Sequence number checking is enabled by default to enforce better security and should only be disabled if required for hardware offload support. This command is only supported for the userspace datapath.
ok but seriously โ enabled by default for a reason. don't disable it just for fun, it's a security thing, not a vibe. ๐ญ
dpctl/ct-get-tcp-seq-chk [dp]
Prints whether TCP sequence checking is enabled or disabled on dp. Only supported for the userspace datapath. ๐ฆ
dpctl/ct-set-sweep-interval [dp] ms
Sets the sweep interval. Only supported for the userspace datapath.
dpctl/ct-get-sweep-interval [dp]
Prints the current sweep interval in ms. Only supported for the userspace datapath.
dpctl/ct-set-limits [dp] [default=default_limit]
[zone=zone,limit=limit]...
Sets the maximum allowed number of connections in a connection tracking zone. A specific zone may be set to limit, and multiple zones may be specified with a comma-separated list. If a per-zone limit for a particular zone is not specified in the datapath, it defaults to the default per-zone limit. A default zone may be specified with the default=default_limit argument. Initially, the default per-zone limit is unlimited. An unlimited number of entries may be set with 0 limit. ๐
dpctl/ct-del-limits [dp] zone=zone[,zone]...
Deletes the connection tracking limit for zone. Multiple zones may be specified with a comma-separated list. โจ
dpctl/ct-get-limits [dp] [zone=zone[,zone]...]โ grabs the max allowed number of connections and the current counts, per-zone. Give it azoneand it prints only the zone(s) you asked for; give it nothing and it dumps all the zone limits and counts. Either way it always shows the default zone limit, no cap ๐
๐ DPDK COMMANDS ๐
These ones are all about managing DPDK components, bestie. Buckle up.
dpdk/lcore-listโ lists the DPDK lcores and their cpu affinity. Heads up: whenRTE_MAX_LCORElcores are registered, some OVS PMD threads just won't show up in the list. Not a bug, just how it is ๐ญdpdk/log-listโ lists every DPDK component that emits logs, plus their logging levels. Very demure, very informative โจdpdk/log-set [spec]โ sets the DPDK components logging level. With nospecat all? It sets the logging level for all DPDK components todebug(yes, all of them, good luck with your log file ๐). Otherwisespecis a list of words separated by spaces, and a word can be either:- a logging level โ one of
emergency,alert,critical,error,warning,notice,infoordebugโ or - a pattern matching DPDK components (check the
dpdk/log-listcommand onovs-appctl(8)), separated by a colon from the logging level you wanna apply.
- a logging level โ one of
dpdk/get-malloc-statsโ prints the heap information statistics about DPDK malloc ๐งdpdk/get-memzone-statsโ prints the reserved memory zones from DPDK.
๐ DPIF-NETDEV COMMANDS ๐
Okay so these commands are how you peek at the internal tea โ mostly statistics โ about the "dpif-netdev" userspace datapath. If there's only one datapath (which is the usual situation, unless you've been out here using dpctl/ commands), you can just omit the dp argument entirely. By default these commands spill data for all pmd threads in the datapath. But if you pass the -pmd Core option, you can filter the output down to a single pmd in the datapath. Iconic filtering behaviour, truly ๐
dpif-netdev/pmd-stats-clear [dp]โ resets to zero the per pmd thread performance numbers thatdpif-netdev/pmd-perf-showshows you. And it will NOT reset datapath or bridge statistics โ only the values shown by the command above. So don't come crying to me when your bridge stats are still there ๐dpif-netdev/pmd-perf-show [-nh] [-it iter_len] [-ms ms_len] [-pmd core] [dp]โ shows detailed performance metrics for one or all pmds threads of the user space datapath. The special thread"main"sums up the statistics of every non pmd thread, which is lowkey such a slay.
The collection of additional detailed statistics can be controlled by a config parameter, other-config:pmd-perf-metrics. By default it's disabled. When you enable it, the run-time overhead is in the order of 1%.
Collected statistics include:
- used cycles
- forwared packets
- number of rx batches
- packets/rx batch
- max. vhostuser queue fill level
- number of upcalls
- cycles spent in upcalls
This raw recorded data gets used threefold:
- In histograms for each of these metrics:
- cycles/iteration (logarithmic)
- packets/iteration (logarithmic)
- cycles/packet
- packets/batch
- max. vhostuser qlen (logarithmic)
- upcalls
- cycles/upcall (logarithmic) โ the histograms bins are divided linear or logarithmic.
- A cyclic history of the above metrics for 1024 iterations.
- A cyclic history of the cummulative/average values per millisecond wall clock for the last 1024 milliseconds:
- number of iterations
- avg. cycles/iteration
- packets (Kpps)
- avg. packets/batch
- avg. max vhost qlen
- upcalls
- avg. cycles/upcall
The command options are:
-nhโ suppress the histograms-ititer_len โ display the last iter_len iteration stats-msms_len โ display the last ms_len millisecond stats
The output always contains the following global PMD statistics:
Time: 15:24:55.270
Measurement duration: 1.008 s
pmd thread numa_id 0 core_id 1:
Iterations: 572817 (1.76 us/it)
- Used TSC cycles: 2419034712 ( 99.9 % of total cycles)
- idle iterations: 486808 ( 15.9 % of used cycles)
- busy iterations: 86009 ( 84.1 % of used cycles)
Rx packets: 2399607 (2381 Kpps, 848 cycles/pkt)
Datapath passes: 3599415 (1.50 passes/pkt)
- PHWOL hits: 0 ( 0.0 %)
- Simple Match hits: 0 ( 0.0 %)
- EMC hits: 336472 ( 9.3 %)
- SMC hits: 0 ( 0.0 %)
- Megaflow hits: 3262943 ( 90.7 %, 1.00 subtbl lookups/hit)
- Upcalls: 0 ( 0.0 %, 0.0 us/upcall)
- Lost upcalls: 0 ( 0.0 %)
Tx packets: 2399607 (2381 Kpps)
Tx batches: 171400 (14.00 pkts/batch)
Here "Rx packets" actually reflects the number of packets forwarded by the datapath. Little bit of a lies-adjacent name, iykyk ๐
The sum of "PHWOL hits", "Simple Match hits", "EMC hits", "SMC hits", "Megaflow hits" and "Upcalls" is the number of packet lookups performed by the datapath, and it's reported as "Datapath passes". Beware that a recirculated packet experiences one additional lookup per recirculation, so there may be more lookups than forwarded packets in the datapath. Math is mathing but also not ๐
The "MFEX Opt hits" displays the number of packets that are processed by the optimized miniflow extract implementations.
Cycles are counted using the TSC or similar facilities (when available on the platform). The duration of one cycle depends on the processing platform. Statistics based on cycles are not reported for the "main" thread, since accurate accounting of CPU cycles is just not possible in that case ๐ญ
"idle iterations" refers to PMD iterations that did not result in processing any packets. "busy iterations" refers to PMD iterations that included processing of at least one packet. The reported used TSC cycles include the cost for polling, processing and transmitting said packets.
To reset the counters and start a new measurement, use dpif-netdev/pmd-stats-clear. Fresh start, new me โจ
dpif-netdev/pmd-perf-log-set on|off [-b before] [-a after] [-e|-ne] [-us usec] [-q qlen]โ so the userspace"netdev"datapath can supervise the PMD performance metrics and detect iterations with suspicious statistics, according to these criteria:- The iteration lasts longer than usec microseconds (default
250). This can be used to capture events where a PMD is blocked or interrupted for such a period of time that there's a risk for dropped packets on any of its Rx queues. ๐ซฃ - The max vhost qlen exceeds a threshold qlen (default
128). This can be used to infer virtio queue overruns and dropped packets inside a VM, which are not visible in OVS otherwise. Spooky.
- The iteration lasts longer than usec microseconds (default
Such suspicious iterations can be logged together with their iteration statistics in the ovs-vswitchd.log, so you can correlate them to packet drop or other events outside OVS.
The above command enables (on) or disables (off) supervision and logging at run-time, and you can use it to adjust the above thresholds for detecting suspicious iterations. By default supervision and logging is disabled.
The command options are:
-bbefore โ the number of iterations before the suspicious iteration to be logged (default5).-aafter โ the number of iterations after the suspicious iteration to be logged (default5).-eโ extend logging interval if another suspicious iteration is detected before logging occurs.-neโ do not extend logging interval if another suspicious iteration is detected before logging occurs (this is the default).-qqlen โ suspicious vhost queue fill level threshold. Crank this up to512if the Qemu supports 1024 virtio queue length (default128).-ususec โ change the duration threshold for a suspicious iteration (default250 us).
Note: logging of suspicious iterations itself consumes a considerable amount of processing cycles of a PMD, which may be visible in the iteration history. In the worst case this can lead OVS to detect another suspicious iteration caused by logging. It's giving feedback loop ๐ญ
If more than 100 iterations around a suspicious iteration have been logged once, OVS falls back to the safe default values (-b 5 -a 5 -ne) to avoid that logging itself continuously causes logging of further suspicious iterations. Safety net, we love her ๐
dpif-netdev/pmd-rxq-show [-pmd core] [dp]โ for one or all pmd threads of the datapath dp, shows you the list of queue-ids with port names that this thread polls. The receipts of who's polling what ๐dpif-netdev/pmd-rxq-rebalance [dp]โ reassigns rxqs to pmds in the datapath dp based on their current usage. Glow-up for your queue assignments โจdpif-netdev/bond-show [dp]โ when"other_config:lb-output-action"is set to"true", the userspace datapath handles the load balancing of bonds directly, instead of depending on flow recirculation (only inbalance-tcpmode). Very independent, very main character.
When that's the case, the above command prints the load-balancing information of the bonds configured in datapath dp, showing the interface associated with each bucket (hash). Buckets and hashes, a whole aesthetic ๐ธ
๐ DPIF-NETLINK COMMANDS ๐
These commands expose internal info from the "dpif-netlink" kernel space datapath. Kernel-side tea โ
dpif-netlink/dispatch-modeโ displays the"dispatch-mode"for all datapaths. That's it, that's the whole command, and honestly? Slay.
๐ NETDEV-DPDK COMMANDS ๐
These manage DPDK related ports (type=dpdk*) ๐
netdev-dpdk/set-admin-state [interface] up | downโ changes the admin state for a DPDK interface toupordown. If interface isn't specified, then it applies to all DPDK ports. All of them. Every single one. Choose wisely bestie ๐
๐งน netdev-dpdk/detach pci-address
Okay so this one detaches the device that has the corresponding pci-address from DPDK. You can use it when the device wasn't detached automatically after its port got deleted. For the full details and instructions, check the documentation. ๐
๐ง netdev-dpdk/get-mempool-info [interface]
Prints the debug info about the memory pool used by a DPDK interface. If you call it with no arguments, it prints info for all the available mempools. Wanna get additional mempool statistics? Enable CONFIG_RTE_LIBRTE_MEMPOOL_DEBUG while building DPDK. โจ
๐งช DATAPATH DEBUGGING COMMANDS ๐งช
These commands query and modify datapaths. They're similar to ovs-dpctl(8) commands. dpif/show has extra functionality beyond dpctl/show: it prints OpenFlow port numbers. The other commands are redundant and will be removed in a future release. ๐ซถ
Redundant and future-release-removed? That's the tea, bestie. ๐
๐๏ธ dpif/dump-dps
Prints the name of each configured datapath on a separate line.
๐ dpif/show
Prints a summary of configured datapaths, including statistics and a list of connected ports. The port information includes the OpenFlow port number, datapath port number, and the type. (The local port is identified as OpenFlow port 65534.) ๐
๐ dpif/dump-flows [-m] dp
Prints to the console all flow entries in datapath dp's flow table. Without -m, the output omits match fields that a flow wildcards entirely; with -m, the output includes all wildcarded fields. ๐ฆ
This command is primarily useful for debugging Open vSwitch. The flow table entries it displays are not OpenFlow flow entries. They're different and considerably simpler flows maintained by the datapath module. If you wish to see the OpenFlow flow entries, use ovs-ofctl dump-flows. ๐ญ
๐๏ธ dpif/del-flows dp
Deletes all flow entries from datapath dp's flow table and the underlying datapath implementation (e.g., kernel datapath module). ๐
This command is primarily useful for debugging Open vSwitch. As discussed in dpif/dump-flows, these entries are not OpenFlow flow entries.
๐ฎ OFPROTO COMMANDS ๐ฎ
These commands manage the core OpenFlow switch implementation (called ofproto). ๐ง
๐ ofproto/list
Lists the names of the running ofproto instances. These are the names that may be used on ofproto/trace. ๐ธ
๐งต ofproto/trace and ofproto/trace-packet-out ๐
ofproto/trace [options] [dpname] odp_flow [packet]
ofproto/trace [options] bridge br_flow [packet]]
ofproto/trace-packet-out [options] [dpname] odp_flow [packet] actions
ofproto/trace-packet-out [options] bridge br_flow [packet] actions
Traces the path of an imaginary packet through the switch and reports the path that it took. The initial treatment of the packet varies based on the command:
ofproto/tracelooks the packet up in the OpenFlow flow table, as if the packet had arrived on an OpenFlow port.ofproto/trace-packet-outapplies the specified OpenFlow actions, as if the packet, flow, and actions had been specified in an OpenFlowpacket-outrequest.
The packet's headers (e.g. source and destination) and metadata (e.g. input port), together called its "flow", are usually all that matter for the purpose of tracing a packet. You can specify the flow in the following ways:
dpname odp_flowโodp_flowis a flow in the form printed byovs-dpctl(8)'sdump-flowscommand. If all of your bridges have the same type, which is the common case, then you can omitdpname, but if you have bridges of different types (say, bothovs-netdevandovs-system), then you need to specify adpnameto disambiguate.bridge br_flowโbr_flowis a flow in the form similar to that accepted byovs-ofctl(8)'sadd-flowcommand. (This is not an OpenFlow flow: besides other differences, it never contains wildcards.)bridgenames the bridge through whichbr_flowshould be traced.
These commands support the following options:
--generateโ generate a packet from the flow (see below for more information). โจ--l7payload โ accepted only with--generate(see below for more information).--l7-lenlength โ accepted only with--generate(see below for more information).--consistentโ accepted byofproto-trace-packet-outonly. With this option, the command rejects actions that are inconsistent with the specified packet. (An example of an inconsistency is attempting to strip the VLAN tag from a packet that does not have a VLAN tag.) Open vSwitch ignores most forms of inconsistency in OpenFlow 1.0 and rejects inconsistencies in later versions of OpenFlow. The option is necessary because the command does not ordinarily imply a particular OpenFlow version. One exception is that, whenactionsincludes an action that only OpenFlow 1.1 and later supports (such aspush_vlan),--consistentis automatically enabled. ๐--ct-nextflags โ when the traced flow triggers conntrack actions,ofproto/tracewill automatically trace the forked packet processing pipeline with user specifiedct_state. This option sets thect_stateflags that the conntrack module will report. The flags must be a comma- or space-separated list of the following connection tracking flags:trk: include to indicate connection tracking has taken place.new: include to indicate a new flow.est: include to indicate an established flow.rel: include to indicate a related flow.rpl: include to indicate a reply flow.inv: include to indicate a connection entry in a bad state.dnat: include to indicate a packet whose destination IP address has been changed.snat: include to indicate a packet whose source IP address has been changed.
When --ct-next is unspecified, or when there are fewer --ct-next options than ct actions, the flags default to trk,new. ๐
Most commonly, one specifies only a flow, using one of the forms above, but sometimes one might need to specify an actual packet instead of just a flow:
- Side effects. Some actions have side effects. For example, the
normalaction can update the MAC learning table, and thelearnaction can change OpenFlow tables. The trace commands only perform side effects when a packet is specified. If you want side effects to take place, then you must supply a packet. (Output actions are obviously side effects too, but the trace commands never execute them, even when one specifies a packet.) - Incomplete information. Most of the time, Open vSwitch can figure out everything about the path of a packet using just the flow, but in some special circumstances it needs to look at parts of the packet that are not included in the flow. When this is the case, and you do not supply a packet, then a trace command will tell you it needs a packet.
If you wish to include a packet as part of a trace operation, there are two ways to do it:
--generateโ this option, added to one of the ways to specify a flow already described, causes Open vSwitch to internally generate a packet with the flow described and then to use that packet. If your goal is to execute side effects, then--generateis the easiest way to do it, but--generateis not a good way to fill in incomplete information, because it generates packets based on only the flow information, which means that the packets really do not have any more information than the flow. By default, for protocols that allow arbitrary L7 payloads, the generated packet has64bytes of payload. Use--l7-lento change the payload length, or--l7to specify the exact contents of the payload. ๐packetโ this form supplies an explicit packet as a sequence of hex digits. An Ethernet frame is at least14bytes long, so there must be at least28hex digits. Obviously, it is inconvenient to type in the hex digits by hand, so theovs-pcap(1)andovs-tcpundump(1)utilities provide easier ways. With this form, packet headers are extracted directly frompacket, so theodp_floworbr_flowshould specify only metadata. The metadata can be:skb_priorityโ packet QoS priority.pkt_markโ mark of the packet.ct_stateโ connection state of the packet.ct_zoneโ connection tracking zone for packet.ct_markโ connection mark of the packet.ct_labelโ connection label of the packet.tun_idโ the tunnel ID on which the packet arrived.in_portโ the port on which the packet arrived.
The in_port value is the kernel datapath port number for the first format and the OpenFlow port number for the second format. The numbering of these two types of port usually differs and there is no relationship. ๐ซ
๐ Usage examples ๐
Trace an unicast ICMP echo request on ingress port 1 to destination MAC 00:00:5E:00:53:01:
ofproto/trace br in_port=1,icmp,icmp_type=8,\
dl_dst=00:00:5E:00:53:01
Trace an unicast ICMP echo reply on ingress port 1 to destination MAC 00:00:5E:00:53:01:
ofproto/trace br in_port=1,icmp,icmp_type=0,\
dl_dst=00:00:5E:00:53:01
More ofproto/trace examples, because these two are the ones you'll actually end up typing at 2am:
Trace an ARP request on ingress port 1
ofproto/trace br in_port=1,arp,arp_op=1
Trace an ARP reply on ingress port 1
ofproto/trace br in_port=1,arp,arp_op=2
๐ชต VLOG COMMANDS โจ
Okay so these are the commands that manage ovs-vswitchd's logging settings, and ngl they're the ones you'll be glad you know when something's acting up. ๐ซถ
vlog/set [spec]โ sets logging levels. With no spec at all, it sets the log level for every module and destination todbg. Otherwise spec is a little list of words separated by spaces or commas or colons, up to one from each of these categories:- a valid module name, exactly like the ones
vlog/listshows you onovs-appctl(8)โ this limits the log level change to just that module ๐ syslog,console, orfileโ limits the change to only the system log, the console, or a file, respectivelyoff,emer,err,warn,info, ordbgโ this is the actual log level. Messages of the given severity or higher get logged, and messages of lower severity get filtered out.offfilters out literally everything. Peepovs-appctl(8)for the definition of each log level ๐
- a valid module name, exactly like the ones
Case is not significant within spec, so go off with your capital letters.
Big one: regardless of the log levels you set forfile, logging to a file will not take place unless ovs-vswitchd was invoked with the--log-fileoption. That's the vibe check that trips everyone up. โจ
For compatibility with older versions of OVS, any is accepted as a word but has no effect โ it's giving decorative, honestly.
vlog/set PATTERN:destination:patternโ sets the log pattern for destination to pattern. Refer toovs-appctl(8)for a description of the valid syntax for pattern.vlog/listโ lists the supported logging modules and their current levels. Iconic little inventory. ๐vlog/list-patternโ lists the logging patterns used for each destination.vlog/closeโ causes ovs-vswitchd to close its log file, if it's open. (Usevlog/reopento open it back up later, bestie.)vlog/reopenโ causes ovs-vswitchd to close its log file, if it's open, and then reopen it. (This is the move after rotating log files, so a fresh new log file gets used. ๐)
This has no effect unless ovs-vswitchd was invoked with the --log-file option.
vlog/disable-rate-limit [module]...vlog/enable-rate-limit [module]...โ by default, ovs-vswitchd limits the rate at which certain messages can be logged. When a message would show up more frequently than the limit, it gets suppressed. That saves disk space, makes logs easier to read, and speeds up execution โ but occasionally troubleshooting needs more detail. Sovlog/disable-rate-limitlets you turn rate limits off at the level of an individual log module. Specify one or more module names, like the onesvlog/listdisplays. Specifying either no module names at all or the keywordanydisables rate limits for every log module. ๐ซโฑ๏ธ
The vlog/enable-rate-limit command has the same syntax as vlog/disable-rate-limit, and it's how you re-enable a rate limit you previously disabled. Balance restored. ๐ง
๐ง MEMORY COMMANDS ๐ญ
These commands report memory usage. Short and sweet.
memory/showโ displays some basic statistics about ovs-vswitchd's memory usage. ovs-vswitchd also logs this information soon after startup and periodically as its memory consumption grows. So it's lowkey already keeping receipts. ๐
๐ฏ COVERAGE COMMANDS ๐
These commands manage ovs-vswitchd's "coverage counters," which count the number of times particular events occur during a daemon's runtime. On top of these commands, ovs-vswitchd automatically logs coverage counter values, at INFO level, when it detects that the daemon's main loop takes unusually long to run. Not me noticing the main loop is struggling ๐ญ
Coverage counters are useful mainly for performance analysis and debugging. That's the whole job. ๐ซก
coverage/showโ displays the averaged per-second rates for the last few seconds, the last minute, and the last hour, plus the total counts of all the coverage counters.coverage/read-counter counterโ displays the total count for the given coverage counter.
๐ OPENVSWITCH TUNNELING COMMANDS ๐ฆ
These commands query and modify OVS tunnel components. Tunnels are so main character energy, fr fr.
ovs/route/add ip/plen output_bridge [gw] [pkt_mark=mark] [src=src_ip] [table=id]โ adds ip/plen route to the vswitchd routing table. output_bridge needs to be an OVS bridge name. This command is useful if OVS cached routes doesn't look right. A non-standard table ID can be specified, in which case the route is added to that routing table. The table is created if it doesn't exist. โจovs/route/show [table=all|id]โ print routes in the OVS routing table. This includes routes cached from the system routing table and user configured routes. By default, the contents of all the default tables (local,main,default) is displayed, unless requested otherwise with the table parameter. In that case the contents of a specific table ID, or of all routing tables, is printed. ๐ovs/route/del ip/plen [pkt_mark=mark] [table=id]โ delete ip/plen route from the OVS routing table. The standard routing table is used by default, or a specific custom table when ID is provided via the table parameter.ovs/route/lookup ip_addr [pkt_mark=mark] [src=src_ip]โ perform a route lookup for the specified destination IP address in the OVS routing tables and print the matching route information. The lookup may be more selective when additional parameters are used: pkt_mark and src. ๐ฏovs/route/rule/show [-6]โ print routing rules in OVS. This includes routing rules cached from the system routing policy database and user configured routing rules. By default only IPv4 rules are displayed. For displaying IPv6 rules the-6option is required. Don't forget it, or you'll be staring at an empty list like ๐ovs/route/rule/add [-6] [not] from=all|ip/plen [prio=num] table=local|main|default|idโ add a user-configured routing rule to vswitchd. It can be useful to reference non-standard routing tables for configuring advanced routing policies, for example matching on the source IP address. If priority is not specified, the lowest unused priority will be selected automatically. Multiple rules with the same priority may exist. User-configured rules and system cached rules co-exist together. Besties, living in harmony. ๐ซถovs/route/rule/del [-6] [not] from=all|ip/plen [prio=num] table=local|main|default|idโ delete a user-configured routing rule from vswitchd. If priority is not specified, the first matching rule will be selected for deletion. ๐tnl/neigh/showtnl/arp/showโ OVS builds the ARP cache by snooping ARP messages (the manpage says "are messages" and honestly, typo era ๐). This command shows the ARP cache table.tnl/neigh/set bridge ip mactnl/arp/set bridge ip macโ adds or modifies an ARP cache entry in bridge, mapping ip to mac. ๐tnl/neigh/flushtnl/arp/flushโ flush the ARP table. Bye bestie ๐tnl/neigh/aging [seconds]tnl/arp/aging [seconds]โ changes the aging time. The accepted values of seconds are between1and3600. The new entries will get the value as specified in seconds. For the existing entries, the aging time is updated only if the current expiration is greater than seconds.
If used without arguments, it prints the current aging value. ๐ฐ๏ธ
tnl/egress_port_range [num1] [num2]โ set the range for the UDP source port used for UDP based tunnels. For example VxLAN. In case of zero arguments, this command prints the current range in use. ๐ฅ
๐ OPENFLOW IMPLEMENTATION ๐
This section documents aspects of OpenFlow for which the OpenFlow specification requires documentation. Yes, the spec makes them do it. We respect the paperwork. ๐
๐ฆ Packet buffering.
The OpenFlow specification, version 1.2, says:
Switches that implement buffering are expected to expose, through documentation, both the amount of available buffering, and the length of time before buffers may be reused.
Open vSwitch does not maintains any packet buffers. So there's nothing to expose, periodt. โจ
๐ Bundle lifetime
The OpenFlow specification, version 1.4, says:
If the switch does not receive anyOFPT_BUNDLE_CONTROLorOFPT_BUNDLE_ADD_MESSAGEmessage for an opened bundle_id for a switch defined time greater than1s, it may send anofp_error_msgwithOFPET_BUNDLE_FAILEDtype andOFPBFC_TIMEOUTcode. If the switch does not receive any new message in a bundle apart from echo request and replies for a switch defined time greater than1s, it may send anofp_error_msgwithOFPET_BUNDLE_FAILEDtype andOFPBFC_TIMEOUTcode.
Open vSwitch implements a default idle bundle lifetime of 10 seconds. (This is configurable via other-config:bundle-idle-timeout in the Open_vSwitch table. See ovs-vswitchd.conf.db(5) for details.) โณ
๐ง LIMITS ๐ง
We believe these limits to be accurate as of this writing. These limits assume the use of the Linux kernel datapath. Read 'em and weep (affectionately). ๐ญ
- ovs-vswitchd started through
ovs-ctl(8)provides a limit of65535file descriptors. The limits on the number of bridges and ports is decided by the availability of file descriptors. With the Linux kernel datapath, creation of a single bridge consumesthreefile descriptors and each port consumesoneadditional file descriptor. Other platforms may have different limitations. ๐ข 8,192MAC learning entries per bridge, by default. (This is configurable viaother-config:mac-table-sizein theBridgetable. Seeovs-vswitchd.conf.db(5)for details.)- Kernel flows are limited only by memory available to the kernel. Performance will degrade beyond
1,048,576kernel flows per bridge with a 32-bit kernel, beyond262,144with a 64-bit kernel. (ovs-vswitchd should never install anywhere near that many flows.) ๐ - OpenFlow flows are limited only by available memory. Performance is linear in the number of unique wildcard patterns. That is, an OpenFlow table that contains many flows that all match on the same fields in the same way has a constant-time lookup, but a table that contains many flows that match on different fields requires lookup time linear in the number of flows. ๐
255ports per bridge participating in 802.1D Spanning Tree Protocol.32mirrors per bridge.15bytes for the name of a port, for ports implemented in the Linux kernel. Ports implemented in userspace, such as patch ports, do not have an arbitrary length limitation. OpenFlow also limit port names to15bytes. ๐
๐ SEE ALSO ๐
okay bestie, when you're done here and you inevitably want more, go touch these:
ovs-appctl(8)โ the little control-tool bestie that lets you poke and prod a runningovs-vswitchd๐ovsdb-server(1)โ the database queen herself, holding down all the config ๐
and that's the whole page, no cap ๐ซถ you read all of it, which is giving main character energy fr fr. this icon of a manual page comes to you from Open vSwitch, version 4.0.0, and it's the ovs-vswitchd(8) page โ so if you ever forget where you are, that's the receipt ๐โจ now go forth and switch some virtual switches, bestie. slay. ๐๐
๐ฆ where this page comes from
- arch rolling: openvswitch 4.0.0-1 ยท Apache-2.0
- Copyright (C) 2007, 2009, 2011 Free Software Foundation, Inc
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms