ovn-nbctl(8)
β¨ ovn-nbctl β¨
the Open Virtual Network northbound db management utility, from the OVN manual π¦
π NAME π
ovn-nbctl β Open Virtual Network northbound db management utility
πΈ SYNOPSIS πΈ
ovn-nbctl [options] command [arg...]
β¨ DESCRIPTION β¨
okay bestie, listen. ovn-nbctl is the program that configures the OVN_Northbound database, and the way it does that is by giving you a high-level interface to its configuration database. like, you don't gotta talk to the raw tables yourself. if you want the full, comprehensive documentation of the database schema, go read ovn-nb(5). π
So. ovn-nbctl connects to an ovsdb-server process that maintains an OVN_Northbound configuration database. Through that connection it queries the database and possibly applies changes to it, depending on whatever commands you handed it. π₯
And here's the iconic part: ovn-nbctl can perform any number of commands in a single run, and it implements them all as a single atomic transaction against the database. no cap. one run, one transaction. π
The ovn-nbctl command line starts with global options (the OPTIONS section below has the deets). Then come one or more commands. Each command should start with -- all by itself as a command-line argument, so it's separated from the commands that follow it. (the -- before the first command is optional, bestie, you don't gotta.) The command itself starts with command-specific options, if there are any, then the command name, then any arguments. π
π§ DAEMON MODE π§
When you invoke it the most ordinary way possible, ovn-nbctl does this whole routine:
- connects to an OVSDB server hosting the northbound database,
- retrieves a partial copy of the database that's complete enough to do its work,
- sends a transaction request to the server,
- and receives and processes the server's reply.
In common interactive use, that's totally fine. but. if the database is large, that step where ovn-nbctl retrieves a partial copy of the database can take a long time, which gives you poor performance overall. π
To improve performance in that situation, ovn-nbctl offers a "daemon mode", where you first start ovn-nbctl running in the background, and afterward you use the daemon to execute operations. Over several ovn-nbctl command invocations, this performs better overall, because it retrieves a copy of the database only once at the beginning, not once per program run. obsessed tbh. π
Use the --detach option to start an ovn-nbctl daemon. With this option, ovn-nbctl prints the name of a control socket to stdout. The client should save this name in the environment variable OVN_NB_DAEMON. Under the Bourne shell this might be done like this:
export OVN_NB_DAEMON=$(ovn-nbctl --pidfile --detach)
When OVN_NB_DAEMON is set, ovn-nbctl automatically and transparently uses the daemon to execute its commands. β¨
When the daemon is no longer needed, kill it and unset the environment variable, like so:
kill $(cat $OVN_RUNDIR/ovn-nbctl.pid)
unset OVN_NB_DAEMON
When you're using daemon mode, there's an alternative to the OVN_NB_DAEMON environment variable: just specify a path for the Unix socket. When starting the ovn-nbctl daemon, specify the -u option with a full path to the location of the socket file. Here's an exmple:
ovn-nbctl --detach -u /tmp/mysock.ctl
Then to connect to the running daemon, use the -u option with the full path to the socket created when the daemon was started:
ovn-nbctl -u /tmp/mysock.ctl show
π¦ Daemon Commands π¦
Daemon mode is internally implemented using the same mechanism used by ovn-appctl. You may also use ovn-appctl directly with these commands:
run [options] command [arg...] [-- [options] command [arg...] ...]β Instructs the daemon process to run one or moreovn-nbctlcommands described above and reply with the results of running these commands. Accepts the--no-wait,--wait,--timeout,--dry-run,--oneline, and the options described under Table Formatting Options in addition to the the command-specific options. π₯exitβ Causesovn-nbctlto gracefully terminate. π
π OPTIONS π
The options listed below affect the behavior of ovn-nbctl as a whole. Some individual commands also accept their own options, which are given just before the command name. If the first command on the command line has options, then those options must be separated from the global options by --. π«Ά
ovn-nbctl also accepts options from the OVN_NBCTL_OPTIONS environment variable, in the same format as on the command line. Options from the command line override those in the environment. periodt.
--no-wait|--wait=none--wait=sb--wait=hvβ These options control whether and howovn-nbctlwaits for the OVN system to become up-to-date with changes made in anovn-nbctlinvocation.
By default, or if --no-wait or --wait=none, ovn-nbctl exits immediately after confirming that changes have been committed to the northbound database, without waiting. πβοΈ
With --wait=sb, before ovn-nbctl exits, it waits for ovn-northd to bring the southbound database up-to-date with the northbound database updates.
With --wait=hv, before ovn-nbctl exits, it additionally waits for all OVN chassis (hypervisors and gateways) to become up-to-date with the northbound database updates. (This can become an indefinite wait if any chassis is malfunctioning. π)
Ordinarily, --wait=sb or --wait=hv only waits for changes by the current ovn-nbctl invocation to take effect. Which means: if none of the commands you supplied to ovn-nbctl change the database, then the command doesn't wait at all. Use the sync command to override this behavior.
--dbdatabase β The OVSDB database remote to contact. If theOVN_NB_DBenvironment variable is set, its value is used as the default. Otherwise, the default isunix:/ovnnb_db.sock, but heads up: this default is unlikely to be useful outside of single-machine OVN test environments. π--leader-only--no-leader-onlyβ By default, or with--leader-only, when the database server is a clustered database,ovn-nbctlwill avoid servers other than the cluster leader. This ensures that any data thatovn-nbctlreads and reports is up-to-date. With--no-leader-only,ovn-nbctlwill use any server in the cluster, which means that for read-only transactions it can report and act on stale data (transactions that modify the database are always serialized even with--no-leader-only). Refer to Understanding Cluster Consistency inovsdb(7)for more information.--shuffle-remotes--no-shuffle-remotesβ By default, or with--shuffle-remotes, when there are multiple remotes specified in the OVSDB connection string specified by--dbor theOVN_NB_DBenvironment variable, the order of the remotes will be shuffled before the client tries to connect. The remotes will be shuffled only once to a new order before the first connection attempt. The following retries, if any, will follow the same new order. The default behavior is to make sure clients of a clustered database can distribute evenly to all members of the cluster. With--no-shuffle-remotes,ovn-nbctlwill use the original order specified in the connection string to connect. This allows the user to specify the preferred order, which is particularly useful for testing. π§ͺ--no-syslogβ By default,ovn-nbctllogs its arguments and the details of any changes that it makes to the system log. This option disables this logging. This option is equivalent to--verbose=nbctl:syslog:warn.--onelineβ Modifies the output format so that the output for each command is printed on a single line. New-line characters that would otherwise separate lines are printed as\n, and any instances of\that would otherwise appear in the output are doubled. Prints a blank line for each command that has no output. This option does not affect the formatting of output from thelistorfindcommands; see Table Formatting Options below.--dry-runβ Preventsovn-nbctlfrom actually modifying the database. π«-tsecs--timeout=secs β By default, or with a secs of0,ovn-nbctlwaits forever for a response from the database. This option limits runtime to approximately secs seconds. If the timeout expires,ovn-nbctlwill exit with aSIGALRMsignal. (A timeout would normally happen only if the database cannot be contacted, or if the system is overloaded.)--print-wait-timeβ When--waitis specified, the option--print-wait-timecan be used to print the time spent on waiting, depending on the value specified in--waitoption. If--wait=sbis specified, it prints "ovn-northd delay before processing", which is the time between the Northbound DB update by the command and the moment whenovn-northdstarts processing the update, and "ovn-northd completion", which is the time between the Northbound DB update and the moment whenovn-northdcompletes the Southbound DB updating successfully. If--wait=hvis specified, in addition to the above information, it also prints "ovn-controller(s) completion", which is the time between the Northbound DB update and the moment when the slowest hypervisor finishes processing the update. β±οΈ
π Daemon Options π
--pidfile[=pidfile] β Causes a file (by default,program.pid) to be created indicating the PID of the running process. If the pidfile argument is not specified, or if it does not begin with/, then it is created in.
If --pidfile is 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, the daemon refuses to start. Specify--overwrite-pidfileto cause it to instead overwrite the pidfile.
When --pidfile is not specified, this option has no effect.
--detachβ Runs this program as 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.
yes bestie it literally dips out and leaves a baby daemon behind, that's the whole bit π
--monitorβ Creates an additional process to monitor this program. If it 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.
it's giving helicopter parent but make it helpful π«Ά
--no-chdirβ By default, when--detachis specified, the daemon changes its current working directory to the root directory after it detaches. Otherwise, invoking the daemon from a carelessly chosen directory would prevent the administrator from unmounting the file system that holds that directory.
Specifying --no-chdir suppresses this behavior, preventing the daemon from 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 --detach is not specified.
--no-self-confinementβ By default this daemon will try to self-confine itself to work with files under well-known directories determined at build time. 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.
fr fr, do NOT just turn this off for the vibes. It's an extra lil security layer and the default is the default for a reason.
- *
--user=user*:group β Causes this program to 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 assumed, respectively. Only daemons started by the root user accepts this argument.
On Linux, daemons will be granted CAP_IPC_LOCK and CAP_NET_BIND_SERVICES before dropping root privileges. Daemons that interact with a datapath, such as ovs-vswitchd, will be granted three additional capabilities, namely CAP_NET_ADMIN, CAP_NET_BROADCAST and CAP_NET_RAW. The capability change will apply even if the new user is root.
downgrading from root but keeping the exact caps it needs, iconic honestly π
πΈ Logging options πΈ
-v[spec]--verbose=[spec]
Sets logging levels. Without any spec, sets the log level for every module and destination to dbg. Otherwise, spec is a list of words separated by spaces or commas or colons, up to one from each category below:
- A valid module name, as displayed by the
vlog/listcommand onovs-appctl(8), limits the log level change to the specified module. syslog,console, orfile, to limit the log level change to only to the system log, to the console, or to a file, respectively. (If--detachis specified, the daemon closes its standard file descriptors, so logging to the console will have no effect.)off,emer,err,warn,info, ordbg, to control the log level. Messages of the given severity or higher will be logged, and messages of lower severity will be filtered out.offfilters out all messages. Seeovs-appctl(8)for a 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 for destination to pattern. Refer to ovs-appctl(8) for a description of the valid syntax for pattern.
- *
-vFACILITY:facility* - *
--verbose=FACILITY:facility*
Sets the RFC5424 facility of the log message. facility can be one of kern, user, mail, daemon, auth, syslog, lpr, news, uucp, clock, ftp, ntp, audit, alert, clock2, local0, local1, local2, local3, local4, local5, local6 or local7. If this option is not specified, daemon is used as the default for the local system syslog and local0 is used while sending a message to the target provided via the --syslog-target option.
okay so those two are the special verbose forms, don't @ me, just copy them exactly π
--log-file[=file] β Enables logging to a file. If file is specified, then it is used as the exact name for the log file. The default log file name used if file is omitted is/var/log/ovn/program.log.- *
--syslog-target=host*:port β Send syslog messages to UDP port on host, in addition to the system syslog. The host must be a numerical IP address, not a hostname.
numerical IP only bestie, no hostnames allowed, it will simply not vibe with a name π
- *
--syslog-method=method* β Specify method as how syslog messages should be sent to syslog daemon. The following forms are supported:libc, to use the libcsyslog()function. Downside of using this options is that libc adds fixed prefix to every message before it is actually sent to the syslog daemon over/dev/logUNIX domain socket.unix:file, to use a UNIX domain socket directly. It is possible to specify arbitrary message format with this option. However,rsyslogd8.9 and older versions use hard coded parser function anyway that limits UNIX domain socket use. If you want to use arbitrary message format with olderrsyslogdversions, then use UDP socket to localhost IP address instead.udp:ip:port, to use a UDP socket. With this method it is possible to use arbitrary message format also with olderrsyslogd. When sending syslog messages over UDP socket extra precaution needs to be taken into account, for example, syslog daemon needs to be configured to listen on the specified UDP port, accidental iptables rules 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, to discard all messages logged to syslog.
The default is taken from the OVS_SYSLOG_METHOD environment variable; if it is unset, the default is libc.
four flavors, pick your fighter β¨
π¦ Table Formatting Options π¦
These options control the format of output from the list and find commands.
-fformat--format=format
Sets the type of table formatting. The following types of format are available:
tableβ 2-D text tables with aligned columns.list(default) β A list with one column per line and rows separated by a blank line.htmlβ HTML tables.csvβ Comma-separated values as defined in RFC 4180.jsonβ JSON format as defined in RFC 4627. The output is a sequence of JSON objects, each of which corresponds to one table. Each JSON object has the following members with the noted values:captionβ The table's caption. This member is omitted if the table has no caption.headingsβ An array with one element per table column. Each array element is a string giving the corresponding column's heading.dataβ An array with one element per table row. Each element is also an array with one element per table column. The elements of this second-level array are the cells that constitute the table. Cells that represent OVSDB data or data types are expressed in the format described in the OVSDB specification; other cells are simply expressed as text strings.
-dformat--data=format
Sets the formatting for cells within output tables unless the table format is set to json, in which case json formatting is always used when formatting cells. The following types of format are available:
string(default) β The simple format described in the Database Values section ofovs-vsctl(8).bareβ The simple format with punctuation stripped off:[]and{}are omitted around sets, maps, and empty columns, items within sets and maps are space-separated, and strings are never quoted. This format may be easier for scripts to parse.jsonβ The RFC 4627 JSON format as described above.
--no-headingsβ This option suppresses the heading row that otherwise appears in the first row of table output.--prettyβ By default, JSON in output is printed as compactly as possible. This option causes JSON in output to be printed in a more readable fashion. Members of objects and elements of arrays are printed one per line, with indentation.
This option does not affect JSON in tables, which is always printed compactly.
glow-up for your JSON, but only the JSON outside of tables, okurrr π
--bareβ Equivalent to--format=list --data=bare --no-headings.
one flag, three whole flags worth of energy, we love an efficient queen β
π PKI Options π
PKI configuration is required to use SSL/TLS for the connection to the database.
-pprivkey.pem- *
--private-key=privkey.pem*
Specifies a PEM file containing the private key used as identity for outgoing SSL/TLS connections.
your identity, your key, no cap π«Ά
-c cert.pem,--certificate=cert.pemβ points at a PEM file holding a certificate that proves the private key you gave on-por--private-keyis trustworthy π. That cert has to be signed by the certificate authority (CA) that your SSL/TLS peer is gonna use to verify it. No random self-signed nonsense, bestie, it has to chain up properly β¨-C cacert.pem,--ca-cert=cacert.pemβ points at a PEM file with the CA certificate used to verify the certificates that SSL/TLS peers show you π. (Fun fact: this can totally be the same cert the peers use to verify the one you passed to-cor--certificate, or it can be a whole different one β it just depends on how your PKI is designed. iykyk π¦)-C none,--ca-cert=noneβ turns OFF verification of certificates presented by SSL/TLS peers π. And likeβ¦ this is a security risk, fr fr. Because it means you literally cannot verify that the certificates belong to hosts you actually know and trust. Do not do this casually. π--ssl-server-name=servernameβ sets the server name used for TLS Server Name Indication (SNI) β¨. By default the hostname from the connection string is what gets used for SNI. This option lets you override that SNI hostname, which is a whole vibe when you're connecting through proxies or service meshes where the connection endpoint is not the same as the server name you actually mean πΈ.--bootstrap-ca-cert=cacert.pemβ okay so this one is doing the most, hear me out π. Whencacert.pemalready exists, it does exactly the same thing as-Cor--ca-cert. But if it does not exist, the executable will try to grab the CA certificate from the SSL/TLS peer on its very first SSL/TLS connection and save it to that named PEM file π . If that works, it immediately drops the connection and reconnects, and from then on every single SSL/TLS connection has to be authenticated by a certificate signed by the CA certificate it just obtained. Periodt.
β οΈ Real talk though: this option exposes the SSL/TLS connection to a man-in-the-middle attack while it's obtaining that initial CA certificate. It can still be useful for bootstrapping, but justβ¦ know what you're doing π«Ά.
This is only useful if the SSL/TLS peer actually sends its CA certificate as part of the SSL/TLS certificate chain. The SSL/TLS protocols do not require the server to send the CA certificate, so no cap, sometimes it just won't be there π.
This option is mutually exclusive with -C and --ca-cert. Pick one, bestie, you can't have both π₯.
β¨ Other Options β¨
-h,--helpβ prints a brief help message to the console π quick lil recap, no notes.-V,--versionβ prints version information to the console β the receipts, the credentials.
π COMMANDS π
The following sections describe the commands that ovn-nbctl supports. Buckle up, there's a lot and honestly? It's all iconic π
π General Commands π
initβ Initializes the database, if it is empty β¨. And if the database has already been initialized? This command justβ¦ has no effect. It's giving "I'm here, I'm doing nothing, I'm still serving" π. No harm, no drama.show [switch | router]β Prints a brief overview of the database contents π¦. If switch is provided, only records related to that logical switch get shown. If router is provided, only records related to that logical router get shown. So like, give it a name and it filters for you, main character energy π.
πΈ Logical Switch Commands πΈ
ls-addβ Creates a new, unnamed logical switch, which initially has no ports π. The switch does not have a name, so every other command has to refer to this switch by its UUID. Remember the UUID, bestie, it's the only way to reach her π.[--may-exist | --add-duplicate] ls-add switchβ Creates a new logical switch named switch, which initially has no ports β¨.
The OVN northbound database schema does not require logical switch names to be unique, but the entire point of names is to give humans an easy way to refer to switches, which honestly makes duplicate names super unhelpful π. So without any options, this command treats it as an error if switch is a duplicate name.
With --may-exist, adding a duplicate name succeeds but does not create a new logical switch π
. With --add-duplicate, the command really creates a new logical switch with a duplicate name. It is an error to specify both options, so don't try it π₯. And if there are multiple logical switches with a duplicate name, configure those logical switches using the UUID instead of the switch name. iykyk.
[--if-exists] ls-del switchβ Deletes switch π«Ά. It is an error if switch does not existβ¦ unless--if-existsis specified, in which case we keep it chill and just move on.ls-listβ Lists all existing switches on standard output, one per line π. Clean, simple, slay.
π ACL Commands π
These commands operate on ACL objects for a given entity β¨. The entity can be either a logical switch or a port group. The entity can be specified as uuid or name. The --type option can be used to specify the type of the entity, in case both a logical switch and a port group exist with the same name specified for entity. And type must be either switch or port-group. Okay? Okay π
[--type={switch | port-group}] [--log] [--meter=meter]
[--severity=severity] [--name=name] [--label=label]
[--sample-new=sample] [--sample-est=sample] [--may-exist]
[--apply-after-lb] [--tier] acl-add entity direction priority
match verdict [network-function-group]
- Adds the specified ACL to entity πΈ. direction must be either
from-lportorto-lport. priority must be between0and32767, inclusive. A full description of the fields lives inovn-nb(5). - If
--may-existis specified, adding a duplicated ACL succeeds but the ACL is not really created π¦. Without--may-exist, adding a duplicated ACL results in an error. Choose wisely. - The
--logoption enables packet logging for the ACL π. The options--severityand--namespecify a severity and a name, respectively, for log entries β and they also enable logging β¨. The severity must be one ofalert,warning,notice,info, ordebug. If a severity is not specified, the default isinfoπ. - The
--meter=meteroption is used to rate-limit packet logging. The meter argument names a meter configured bymeter-addπ. - The
--sample-new(and optionally--sample-est) enable ACL sampling π«. A valid uuid of a row of theSampletable must be provided. No uuid, no sample, fr fr. - The
--apply-after-lboption setsapply-after-lb=truein theoptionscolumn of the ACL table π. And as the option name literally suggests, the ACL will be applied after the logical switch load balancer stage. So it's post-LB, periodt. - The
--tieroption sets the ACL's tier to the specified value π₯. For more information about ACL tiers, see the documentation for theovn-nb(5)database.
[--type={switch | port-group}] [--tier] acl-del entity [direction
[priority match]]
- Deletes ACLs from entity π . If only entity is supplied, all the ACLs from the entity are deleted. If direction is also specified, then all the flows in that direction get deleted from the entity. And if all the fields are given, then a single flow that matches all the fields will be deleted π―.
- If the
--tieroption is provided, then only ACLs of the given tier value will be deleted, in addition to whatever other criteria you provided β¨.
[--type={switch | port-group}] [--all] acl-list entity
- Lists the ACLs on entity π¦.
- The
--alloption will also list the port group ACLs associated with each logical switch port, when a logical switch is provided as an argument π. So you get the whole picture, no crumbs left behind.
π§ Network Function Commands π§
[--may-exist] nf-add nf id inport [outport]β Creates a new network function named nf with the specified id (an integer between1and255) and logical switch ports inport and (optionally) outport π. The ports must be on the same logical switch and must already be created. Don't be late to your own party, bestie πΈ.
When the network function is used in an inline-mode network function group, both inport and outport must be specified π. Traffic matching the ACL is redirected to the inport for from-lport ACLs and to the outport for to-lport ACLs. The response packets are sent through the same ports in reverse order π. Cute, symmetric, we love it.
When the network function is used in a vtap-mode network function group, only inport is used π¦. Traffic matching the ACL is mirrored (cloned) to inport in both directions while the original packet continues to its destination. And outport must not be specified for vtap network functions. Don't add it, it's not the vibe π.
Without any options, this command regards it as an error if nf is a duplicate name. With --may-exist, adding a network function with a duplicate name overwrites the existing config β¨.
[--if-exists] nf-del nfβ Deletes nf specified as name or uuid π . It is an error if nf does not existβ¦ unless--if-existsis specified. Then we're unbothered π«Ά.nf-listβ Lists all network functions β. Every single one, on display.[--may-exist] nfg-add nfg id mode [nf]...β Creates a new network function group named nfg with optionally one or more nf added to the group π. The *nf*s must be already created. Traffic redirection/mirroring is performed towards one of the active network functions, based on health monitoring (inline) or port binding status (vtap) π. And if all of them are down, the configured fallback behavior applies. She always has a plan B, that's why she's the main character π.
Each network function group must have a unique id between 1 and 255. The supported values for mode are:
inline: traffic matching the ACL is redirected through the active network function π. Both inport and outport must be set on every member network function.vtap: traffic matching the ACL is mirrored (cloned) to the active network function while the original packet continues to its destination π¦. Only inport is used on member network functions.
Without any options, this command regards it as an error if nfg is a duplicate name. With --may-exist, adding a network function group with a duplicate name overwrites the existing config β¨.
[--if-exists] nfg-del nfgβ Deletes nfg specified as name or uuid π . It is an error if nfg does not exist, unless--if-existsis specified π₯.nfg-list [nfg]β Lists all network function groups πΈ. And if you hand it a specific network function group nfg, only that one group is listed. Targeted, efficient, iconic π.[--may-exist] nfg-add-nf nfg nfβ bestie, this one drops a network function named nf into a network function group named nfg. If nfg or nf doesn't exist? error, immediately, no vibes. And unless you pass--may-exist, it's also an error if the nf you're adding is already part of the nfg (like, we already knew her π ).nfg-del-nf nfg nfβ removes network function nf from network function group nfg. Errors out if nfg or nf doesn't exist. And it's an error if nf isn't even part of nfg β unless you hit it with--if-exists, in which case it just shrugs and moves on π.
β¨ Logical Switch QoS Rule Commands β¨
[--may-exist] qos-add switch direction priority match [mark=mark] [dscp=dscp] [rate=rate [burst=burst]]β adds QoS marking and metering rules to switch. Let's break it down, bestie:- direction has to be either
from-lportorto-lport. Those are literally the only two options, no in-between energy. - priority must be between
0and32767, inclusive. - If you pass
dscp=dscp, then matching packets get DSCP marking applied. dscp must be between0and63, inclusive. - If you pass
rate=rate, then matching packets get metering applied at rate kbps. And if metering is configured,burst=burstsets the burst rate limit in kilobits. dscpand/orrateare required arguments, so don't come in here empty-handed π.- If you pass
mark=mark, matching packets get marked (throughpkt.mark). mark must be a positive integer.
- direction has to be either
Okay so about--may-exist: if you specify it and try to add a duplicated QoS rule, it succeeds β but the QoS rule isn't actually created. Sneaky. Without--may-exist, adding a duplicated QoS rule just results in an error. Periodt.
qos-del switch [direction [priority match]]β deletes QoS rules from switch. How much gets deleted depends on how much you give it:- Only switch supplied β all the QoS rules from the logical switch get deleted. Clean slate, iconic.
- direction also specified β all the flows in that direction get deleted from the logical switch.
- All the fields supplied β a single flow matching the given fields gets deleted.
Also, if switch and uuid are supplied, then the QoS rule with the specified uuid is deleted.
qos-list switchβ lists the QoS rules on switch. Just, like, shows you everything. π
β‘ Meter Commands β‘
[--fair] [--may-exist] meter-add name action rate unit [burst]β adds the meter you asked for. The details:- name must be a unique name to identify this meter.
- action says what should happen when this meter gets exceeded. The only supported action is
drop. That's it. That's the list. - unit sets the unit for the rate argument. Valid values are
kbpsandpktpsfor kilobits per second and packets per second, respectively. - The burst option configures the maximum burst allowed for the band in kilobits or packets β depending on whether you chose
kbpsorpktps, respectively. If you don't supply a burst, the switch is free to pick some reasonable value based on its own configuration. She'll decide, and honestly? Let her. π¦ ovn-nbctlonly supports adding a meter with a single band, but the other commands do support meters with multiple bands. iykyk.- Names that start with
__(two underscores) are reserved for internal use by OVN, soovn-nbctlwill not let you add them. Hands off the underscore names, bestie π«.
--fairvibes: if you specify it, the meter'sfaircolumn is set totrue, which enables fair bandwidth sharing among rows that reference this meter. Sharing is caring π.
--may-exist vibes: if you specify it, adding a meter with a name that already exists will update the existing meter instead of reporting an error. Glow-up, not conflict.
meter-del [name]β deletes meters. By default, all meters are deleted (scorched earth, slay). If name is supplied, only the meter with that name gets deleted.meter-listβ lists all meters. All of them. Every single one. β¨
π Logical Switch Port Commands π
[--may-exist] lsp-add switch portβ creates on lswitch a new logical switch port named port.
It's an error if a logical port named port already exists β unless --may-exist is specified. And regardless of --may-exist, it's an error if the existing port lives in some logical switch other than switch, or if it has a parent port. So like, don't try it. π
[--may-exist] lsp-add switch port parent tag_requestβ creates on switch a logical switch port named port that's a child of parent, identified with VLAN ID tag_request, which must be between0and4095, inclusive.
If tag_request is 0, ovn-northd generates a tag that's unique in the scope of parent. Super useful in cases like virtualized container environments, where Open vSwitch doesn't have a direct connection to the container's port and it has to be shared with the virtual machine's port.
It's an error if a logical port named port already exists, unless --may-exist is specified. And regardless of --may-exist, it's an error if the existing port is not in switch, or if it doesn't have the specified parent and tag_request.
[--if-exists] lsp-del portβ deletes port. It's an error if port doesn't exist β unless--if-existsis specified, in which case, no drama π«Ά.lsp-list switchβ lists all the logical switch ports within switch on standard output, one per line.lsp-get-parent portβ if it's set, gets the parent port of port. If it's not set, prints nothing. Silence is also an answer π.lsp-get-tag portβ if it's set, gets the tag for port traffic. If it's not set, prints nothing.lsp-set-addresses port [address]...β sets the addresses associated with port to address. Each address should be one of these:- an Ethernet address, optionally followed by a space and one or more IP addresses β OVN delivers packets for the Ethernet address to this port.
unknownβ OVN delivers unicast Ethernet packets whose destination MAC address isn't in any logical port'saddressescolumn to ports with addressunknown.dynamicβ use this keyword to makeovn-northdgenerate a globally unique MAC address and choose an unused IPv4 address within the logical port's subnet, then store them in the port'sdynamic_addressescolumn. Auto-magic β¨.routerβ accepted only when the type of the logical switch port isrouter. This indicates that the Ethernet, IPv4, and IPv6 addresses for this logical switch port should be obtained from the connected logical router port, as specified byrouter-portinlsp-set-options.
Multiple addresses may be set. And if no address argument is given, port will have no addresses associated with it. Naked port, no addresses, we move.
lsp-get-addresses portβ lists all the addresses associated with port on standard output, one per line.lsp-set-port-security port [addrs]...β sets the port security addresses associated with port to addrs. Multiple sets of addresses may be set by using multiple addrs arguments. If no addrs argument is given, port will not have port security enabled.
Port security limits the addresses from which a logical port may send packets and to which it may receive packets. See the ovn-nb(5) documentation for the port_security column in the Logical_Switch_Port table for the deets π.
lsp-get-port-security portβ lists all the port security addresses associated with port on standard output, one per line.lsp-get-up portβ prints the state of port, eitherupordown. Vibe check, essentially.lsp-set-enabled port stateβ sets the administrative state of port, eitherenabledordisabled. When a port is disabled, no traffic is allowed into or out of the port. Closed for business, bestie πͺ.lsp-get-enabled portβ prints the administrative state of port, eitherenabledordisabled.lsp-set-type port type [peer=peer]β sets the type for the logical port. The type must be one of these:(empty string)β a VM (or VIF) interface.routerβ a connection to a logical router.switchβ a connection to another logical switch. The optional argument peer identifies a logical switch port that connects to this one.
All logical switch ports of that type have implicit unknown addresses and FDB learning enabled. This comes with all the positive and negative sides of the unknown address. Static addresses-to-port mappings don't need to be maintained on each node and only the actually used mappings get learned β but at the cost of broadcasting packets for which the destination address isn't learned yet. Trade-offs, we love to see them.
FDB learning will also cause not-learned-yet packets to be sent to controller from each switch-switch connection they traverse. So keep that in mind if you're planning to have many directly connected switches within a single availability zone. Plan accordingly, queen π.
localnetβ a connection to a locally accessible network from eachovn-controllerinstance. A logical switch can only have a singlelocalnetport attached. This is used to model direct connectivity to an existing network.localportβ a connection to a local VIF. Traffic that arrives on alocalportis never forwarded over a tunnel to another chassis. These ports are present on every chassis and have the same address in all of them. This models connectivity to local services that run on every hypervisor.l2gatewayβ a connection to a physical network.vtepβ a port to a logical switch on a VTEP gateway.
lsp-get-type portβ gets the type for the logical port.lsp-set-options port [key=value]...β sets type-specific key-value options for the logical port.lsp-get-options portβ gets the type-specific options for the logical port.lsp-set-dhcpv4-options port dhcp_optionsβ sets the DHCPv4 options for the logical port. The dhcp_options is a UUID referring to a set of DHCP options in theDHCP_Optionstable.lsp-get-dhcpv4-options portβ gets the configured DHCPv4 options for the logical port.lsp-set-dhcpv6-options port dhcp_optionsβ sets the DHCPv6 options for the logical port. The dhcp_options is a UUID referring to a set of DHCP options in theDHCP_Optionstable.lsp-get-dhcpv6-options portβ gets the configured DHCPv6 options for the logical port.lsp-get-ls portβ gets the logical switch which the port belongs to. Home address, basically π .lsp-attach-mirrorport m β attaches the mirror m to the logical port port. basically matchmaking but for mirrors πͺπlsp-detach-mirrorport m β detaches the mirror m from the logical port port. we are UN-matching them, it's giving closure β¨[--may-exist] lsp-add-router-portswitch port lrp_peer β makes a brand new logical switch port named port on switch, gives it typerouter, sets therouter-portoption to lrp_peer, and sets addresses torouter. π
with --may-exist, it's not an error if the port already exists β as long as it's chillin' in the same switch, has the same type, and has the same router-port option. same vibe, no drama.
[--may-exist] lsp-add-localnet-portswitch port network β makes a new logical switch port named port on switch with typelocalnet, sets thenetwork_nameoption to network, and sets addresses tounknown. π
with --may-exist, again not an error if the port's already there, as long as it's in the same switch, same type, same network_name option. no cap.
π¦ Forwarding Group Commands π¦
[--liveness]fwd-group-addgroup switch vip vmac ports β creates a new forwarding group named group as the name, with the vip and vmac you hand it. vip should be a virtual IP address and vmac should be a virtual MAC address used to access the forwarding group. ports are the logical switch port names that get put in the forwarding group β example for ports islsp1 lsp2 .... traffic destined to the virtual IP of the forwarding group will be load balanced to all the child ports. π
when --liveness is specified, the child ports are expected to be bound to external devices like routers. BFD should be configured between hypervisors and those external devices. the child port selection will become dependent on BFD status with its external device. so like, the vibes of the port now depend on the BFD π
[--if-exists] fwd-group-delgroup β deletes group. it's an error if group does not exist, unless--if-existsis specified. bestie, if you don't say--if-exists, it WILL yell at you πfwd-group-list[switch] β lists all existing forwarding groups. if switch is specified, then only the forwarding groups configured for switch get listed. filtered, curated, iconic β¨
π Logical Router Commands π
lr-addβ creates a new, unnamed logical router, which initially has no ports. the router does not have a name, so other commands must refer to this router by its UUID. yes it's the mysterious no-name router, main character energy tbh π[--may-exist | --add-duplicate] lr-addrouter β creates a new logical router named router, which initially has no ports.
okay so real talk: the OVN northbound database schema does not require logical router names to be unique, but the whole point of the names is to give humans an easy way to refer to routers β which makes duplicate names unhelpful. so without any options, this command regards it as an error if router is a duplicate name. with --may-exist, adding a duplicate name succeeds but does not create a new logical router. with --add-duplicate, the command really does create a new logical router with a duplicate name. it is an error to specify both options. if there are multiple logical routers with a duplicate name, configure the logical routers using the UUID instead of the router name. π«Ά
[--if-exists] lr-delrouter β deletes router. it's an error if router does not exist, unless--if-existsis specified. protect your peace, pass the flag πlr-listβ lists all existing routers on standard output, one per line. cute little lineup, we love to see it π
πΈ Logical Router Port Commands πΈ
[--may-exist] lrp-addrouter port mac [network]... [peer=peer] β creates on router a new logical router port named port with Ethernet address mac and IP address/netmask for each network. β¨
the optional argument peer identifies a logical router port that connects to this one. the following example adds a router port with an IPv4 and IPv6 address with peer lr1:
lrp-add lr0 lrp0 00:11:22:33:44:55 192.168.0.1/24 2001:db8::1/64
peer=lr1
it's an error if a logical router port named port already exists, unless --may-exist is specified. and regardless of --may-exist, it's an error if the existing router port is in some logical router other than router. so don't try to sneak it across routers π
[--if-exists] lrp-delport β deletes port. it's an error if port does not exist, unless--if-existsis specified.lrp-listrouter β lists all the logical router ports within router on standard output, one per line. πlrp-set-enabledport state β sets the administrative state of port, eitherenabledordisabled. when a port is disabled, no traffic is allowed into or out of the port. it's giving do-not-disturb π«lrp-get-enabledport β prints the administrative state of port, eitherenabledordisabled. vibe check on the port β¨lrp-set-gateway-chassisport chassis [priority] β sets gateway chassis for port. chassis is the name of the chassis. this creates a gateway chassis entry in theGateway_Chassistable. it won't check if chassis really exists in theOVN_Southbounddatabase, so like, it's trusting you on that one π. priority will be set to0if priority is not provided by the user. priority must be between0and32767, inclusive. π’lrp-del-gateway-chassisport chassis β deletes gateway chassis from port. it's an error if gateway chassis with chassis for port does not exist.lrp-get-gateway-chassisport β lists all the gateway chassis with priority within port on standard output, one per line, ordered based on priority. sorted and slaying π
π§ Logical Router Static Route Commands π§
[--may-exist] [--policy=POLICY] [--route-table=ROUTE_TABLE] [--ecmp] [--ecmp-symmetric-reply] [--override-connected] [--bfd[=UUID]] lr-route-addrouter prefix nexthop [port] β adds the specified route to router. prefix describes an IPv4 or IPv6 prefix for this route, such as192.168.100.0/24. nexthop specifies the gateway to use for this route, which should be the IP address of one of router's logical router ports or the IP address of a logical port. if port is specified, packets that match this route will be sent out that port. when port is omitted, OVN infers the output port based on nexthop. nexthop can be set todiscardfor dropping packets which match the given route. bye bye packets ππ
the --route-table option can be used to assign the given route to a separate routing table ROUTE_TABLE instead of the default <main> table. for a detailed explanation of the route lookup behavior, see the description of the field Logical_Router_Static_Route:route_table in the ovn-nb(5) manpage. π
--policy describes the policy used to make routing decisions. this should be one of "dst-ip" or "src-ip". if not specified, the default is "dst-ip".
the --ecmp option allows for multiple routes with the same prefix POLICY but different nexthop and port to be added. π₯
the --ecmp-symmetric-reply option makes it so that traffic that arrives over an ECMP route will have its reply traffic sent out over that same route. setting --ecmp-symmetric-reply implies --ecmp so it is not necessary to set both. girlboss symmetry π
the --override-connected option makes it so that route's priority is the highest among routes with the same prefix.
--bfd is used to link a BFD session to the OVN route. if the BFD session UUID is provided, it will be used for the OVN route β otherwise the next-hop will be used to perform a lookup in the OVN BFD table. if the lookup fails and port is specified, a new entry in the BFD table will be created using the nexthop as dst_ip and port as logical_port.
it's an error if a route with prefix and POLICY already exists, unless --may-exist, --ecmp, or --ecmp-symmetric-reply is specified. if --may-exist is specified but not --ecmp or --ecmp-symmetric-reply, the existing route will be updated with the new nexthop and port. if --ecmp or --ecmp-symmetric-reply is specified, a new route will be added, regardless of the existing route β which is useful when adding ECMP routes, i.e. routes with same POLICY and prefix but different nexthop and port. π£οΈ
[--if-exists] [--policy=POLICY] [--route-table=ROUTE_TABLE] lr-route-delrouter [prefix [nexthop [port]]] β deletes routes from router. if only router is supplied, all the routes from the logical router are deleted. if POLICY, prefix, nexthop and/or port are also specified, then all the routes that match the conditions will be deleted from the logical router. π₯
the --route-table option can be used to delete the given route from the route table ROUTE_TABLE instead of the default <main> table.
it's an error if there is no matching route entry, unless --if-exists is specified.
lr-route-listrouter β lists the routes on router. πΊοΈ
π Logical Router Policy Commands π
[--may-exist] [--bfd] [--chain=CHAIN] [--output-port=OUTPUT_PORT] lr-policy-addrouter priority match action [nexthop[,nexthop,...]] [options key=value]] β adds a Policy to router, which provides a way to configureallow,drop,jump, andreroutepolicies on the router.allowanddroppolicies are similar to OVN ACLs, but exist on the logical-router.reroutepolicies are needed for service-insertion and service-chaining. the action must be one ofallow,drop,jump, orreroute. nexthop is an optional parameter β it needs to be provided only when action isreroute. multiple nexthops can be specified for ECMP routing. a policy is uniquely identified by priority and match. multiple policies can have the same priority. options sets the router policy options as key-value pair. the supported option is :pkt_mark. π―
if --may-exist is specified, adding a duplicated routing policy with the same priority and match string is not really created. without --may-exist, adding a duplicated routing policy results in error. π
ββοΈ
the --chain option specifies the policy chain name. this is used when the action is jump.
the --output-port option specifies the output logical router port. this is only valid when the action is reroute.
--bfd is used to link a BFD session to the OVN reroute policy. OVN will look for an already running BFD session using next-hop as lookup key in the BFD table. if the lookup fails, a new entry in the BFD table will be created using the nexthop as dst_ip.
the following example shows a policy to lr1, which will drop packets from 192.168.100.0/24. π
lr-policy-add lr1 100 ip4.src == 192.168.100.0/24 drop.
lr-policy-add lr1 100 ip4.src == 192.168.100.0/24 allow
pkt_mark=100 .
[--if-exists] [--chain=CHAIN] lr-policy-del router [{priority | uuid} [match]]β deletes policies from router. π If you only give router, literally every policy on that logical router gets yeeted. If priority and/or match are also there, then all the policies matching those conditions get deleted from the logical router.
If router and uuid are supplied, then the policy with that uuid is deleted. It's an error if uuid doesn't exist, unless you pass --if-exists. π«Ά
If --chain is specified, only policies in the specified chain are considered for deletion.
lr-policy-list routerβ lists the policies on router. π
β¨ NAT Commands β¨
[--may-exist] [--stateless] [--gateway-port=GATEWAY_PORT] [-portrange] [--match=MATCH] [--priority=PRIORITY] lr-nat-add router type external_ip logical_ip [logical_port external_mac] [external_port_range]β adds the specified NAT to router. β¨ The type must be one ofsnat,dnat, ordnat_and_snat. The external_ip is an IPv4 address. The logical_ip is an IPv4 network (e.g.192.168.1.0/24) or an IPv4 address. The logical_port and external_mac are only accepted when router is a distributed router (rather than a gateway router) and type isdnat_and_snat. The logical_port is the name of an existing logical switch port where the logical_ip resides. The external_mac is an Ethernet address. π
When --stateless is specified then it implies that we will be not use connection tracker, i.e internal ip and external ip are 1:1 mapped. This implies that --stateless is applicable only to dnat_and_snat type NAT rules. An external ip with --stateless NAT cannot be shared with any other NAT rule. π«
The --gateway-port option allows specifying the distributed gateway port of router where the NAT rule needs to be applied. GATEWAY_PORT should reference a Logical_Router_Port row that is a distributed gateway port of router. When router has multiple distributed gateway ports and the gateway port for this NAT canβt be inferred from the external_ip, it is an error to not specify the GATEWAY_PORT. π
If the --portrange option is specified, then a range of ports may be specified in the external_port_range part of the lr-nat-add command. If this option is omitted, then an external port range may not be specified. The format of the port range is port_low-port_high, where port_low is a lower number than port_high. When the packet is NATted, a random port from the range will be selected as the source port. The range for the external_port_range is 1-65535. π―
The --match allows to specify the extra match condition. The extra match is for more fine-grained control over the NAT rule. π
The --priority option allows to specify order of NAT rule evaluation. Priority must be between 0 and 32767, inclusive and can be only specified together with --match. π
When type is dnat, the externally visible IP address external_ip is DNATted to the IP address logical_ip in the logical space. π
When type is snat, IP packets with their source IP address that either matches the IP address in logical_ip or is in the network provided by logical_ip is SNATed into the IP address in external_ip. π
When type is dnat_and_snat, the externally visible IP address external_ip is DNATted to the IP address logical_ip in the logical space. In addition, IP packets with the source IP address that matches logical_ip is SNATed into the IP address in external_ip. π¦
When the logical_port and external_mac are specified, the NAT rule will be programmed on the chassis where the logical_port resides. This includes ARP replies for the external_ip, which return the value of external_mac. All packets transmitted with source IP address equal to external_ip will be sent using the external_mac. π‘
It is an error if a NAT already exists with the same values of router, type, external_ip, logical_ip and GATEWAY_PORT (in case of multiple distributed gateway ports), unless --may-exist is specified. When --may-exist, logical_port, and external_mac are all specified, the existing values of logical_port and external_mac are overwritten. π
[--if-exists] lr-nat-del router [type [ip] [gateway_port]]β deletes NATs from router. If only router is supplied, all the NATs from the logical router are deleted. If type is also specified, then all the NATs that match the type will be deleted from the logical router. If ip is also specified without specifying gateway_port, then all the NATs that match the type and ip will be deleted from the logical router. If gateway_port is specified without specifying ip, then all the NATs that match the type and gateway_port will be deleted from the logical router. If all the fields are given, then a single NAT rule that matches all the fields will be deleted. When type issnat, the ip should be logical_ip. When type isdnatordnat_and_snat, the ip should be external_ip. π§Ή
It is an error if both ip and gateway_port are specified and there is no matching NAT entry, unless --if-exists is specified. β οΈ
lr-nat-list routerβ lists the NATs on router. π[--is-exempted] lr-nat-update-ext-ip router type ip address_setβ updates the external IP address set for an existing NAT rule on router. type must be one ofdnat,snat, ordnat_and_snat. The command finds the matching NAT rule by type and ip, then sets theallowed_ext_ipscolumn of the NAT rule to address_set. π
If --is-exempted is specified, sets exempted_ext_ips instead of allowed_ext_ips. π«
It is an error if no matching NAT rule is found. π
π Load Balancer Commands π
[--may-exist | --add-duplicate | --reject | --event | --template | --add-route] lb-add lb vip ips [protocol] [address_family]β creates a new load balancer named lb with the provided vip and ips or adds the vip to an existing lb. vip should be a virtual IP address (or an IP address and a port number with:as a separator). Examples for vip are192.168.1.4,fd0f::1, and192.168.1.5:8080. ips should be comma separated IP endpoints (or comma separated IP addresses and port numbers with:as a separator). ips must be the same address family as vip. Examples for ips are10.0.0.1,10.0.0.2or[fdef::1]:8800,[fdef::2]:8800. π
The optional argument protocol must be either tcp, udp or sctp. This argument is useful when a port number is provided as part of the vip. If the protocol is unspecified and a port number is provided as part of the vip, OVN assumes the protocol to be tcp. π§
It is an error if the vip already exists in the load balancer named lb, unless --may-exist is specified. With --add-duplicate, the command really creates a new load balancer with a duplicate name. π―
If the load balancer is created with --reject option and it has no active backends, a TCP reset segment (for tcp) or an ICMP port unreachable packet (for all other kind of traffic) will be sent whenever an incoming packet is received for this load-balancer. Please note using --reject option will disable empty_lb SB controller event for this load balancer. π
If the load balancer is created with --event option and it has no active backends, whenever the lb receives traffic, the event is reported in the Controller_Event table in the SB db. Please note --event option canβt be specified with --reject one. π’
If the load balancer is created with --template option, local template variables may be used as arguments. These variables are stored in Chassis_Template_Var. To see the supported variable formats, see ovn-nb(5). The following example adds a templated load balancer: ovn-nbctl --template lb-add lb1 ^vip:^vport ^backend udp ipv4. πͺ
If --add-route is specified, a route is automatically added for the load balancerβs VIP subnet. π£οΈ
The optional address_family argument specifies the address family (ipv4 or ipv6). This is primarily used with template load balancers. π
The following example adds a load balancer.
lb-add lb0 30.0.0.10:80
192.168.10.10:80,192.168.10.20:80,192.168.10.30:80 udp
[--if-exists] lb-del lb [vip]β deletes lb or the vip from lb. If vip is supplied, only the vip will be deleted from the lb. If only the lb is supplied, the lb will be deleted. It is an error if vip does not already exist in lb, unless--if-existsis specified. ποΈlb-list [lb]β lists the LBs. If lb is also specified, then only the specified lb will be listed. π[--may-exist] ls-lb-add switch lbβ adds the specified lb to switch. It is an error if a load balancer named lb already exists in the switch, unless--may-existis specified. β[--if-exists] ls-lb-del switch [lb]β removes lb from switch. If only switch is supplied, all the LBs from the logical switch are removed. If lb is also specified, then only the lb will be removed from the logical switch. It is an error if lb does not exist in the switch, unless--if-existsis specified. βls-lb-list switchβ lists the LBs for the given switch. π[--may-exist] lr-lb-add router lbβ adds the specified lb to router. It is an error if a load balancer named lb already exists in the router, unless--may-existis specified. β[--if-exists] lr-lb-del router [lb]β removes lb from router. If only router is supplied, all the LBs from the logical router are removed. If lb is also specified, then only the lb will be removed from the logical router. It is an error if lb does not exist in the router, unless--if-existsis specified. βlr-lb-list routerβ lists the LBs for the given router. π
π DHCP Options commands π
dhcp-options-create cidr [key=value]β creates a new DHCP Options entry in theDHCP_Optionstable with the specified cidr and optional external-ids. β¨dhcp-options-listβ lists the DHCP Options entries. πdhcp-options-del dhcp-optionβ deletes the DHCP Options entry referred by dhcp-option UUID. ποΈdhcp-options-set-options dhcp-option [key=value]...β sets the DHCP Options for the dhcp-option UUID. literally handing it its whole lil personality β¨dhcp-options-get-options dhcp-optionβ lists the DHCP Options for the dhcp-option UUID. just reading them back to you, no notes π
π Port Group commands π
pg-add group [port]...β creates a brand new port group in thePort_Grouptable named group, with any optional *port*s you hand it already added in. new group, who dis π«Άpg-set-ports group port...β sets the ports on the port group named group. and heads up bestie: it is an error if group does not exist. no group, no vibe πpg-get-ports groupβ gets the ports on the port group named group. again, it is an error if group does not exist. we do not make up groups around here πpg-del groupβ deletes port group group. and yes, it is an error if group does not exist. gone girl energy π
πΈ HA Chassis Group commands πΈ
ha-chassis-group-add groupβ creates a new HA chassis group in theHA_Chassis_Grouptable named group. fresh group, iconic β¨ha-chassis-group-del groupβ deletes the HA chassis group group. it is an error if group does not exist. rip boo you're gone π¦ha-chassis-group-list [ha-chassis-group]β lists all the HA chassis groups, plus the HA chassis associated with each one (if any are). and if you also pass ha-chassis-group, then only that one specific ha-chassis-group gets listed. filtered, we love a narrowed down moment πha-chassis-group-add-chassis group chassis priorityβ adds a new HA chassis chassis to the HA chassis group group with the specified priority. if the chassis is already in there, the priority just gets updated instead. note: chassis should be the name of the chassis in theOVN_Southbound. glow up, same chassis πha-chassis-group-remove-chassis group chassisβ removes the HA chassis chassis from the HA chassis group group. it is an error if chassis does not exist. not me removing you from the group chat πha-chassis-group-set-chassis-prio group chassis priorityβ sets the priority of an existing HA chassis chassis inside the HA chassis group group. priority must be between0and32767, inclusive. it is an error if chassis does not exist in group. know your range bestie, stay in your lane π
π₯ Control Plane Protection Policy commands π₯
okay so these commands manage the meters configured in the Copp table, linking them to logical datapaths through the copp column in the Logical_Switch or Logical_Router tables. the protocol packets for which CoPP is enforced when sending packets to ovn-controller (if configured) are, and I'm listing every single one no cap:
ARPND_NSND_NAND_RANDDNSIGMP- packets that require ARP resolution before forwarding
- packets that require ND_NS before forwarding
- packets that need to be replied to with ICMP Errors
- packets that need to be replied to with TCP RST
- packets that need to be replied to with DHCP_OPTS
- packets that trigger a reject action
- packets that trigger a SCTP abort action
controller_eventsBFDcopp-add name proto meterβ adds the control proto β meter mapping to the control plane protection policy name. if no policy exists yet, it just makes one, nbd. and if a mapping already existed for proto, this overwrites it. it's giving assertive πcopp-del name [proto]β removes the control proto mapping for the name control plane protection policy. if proto isn't specified, then the whole control plane protection policy gets destroyed. all of it. the entire thing π³copp-list nameβ displays the current control plane protection policy for name. show me what you got πls-copp-add name switchβ adds the control plane protection policy name to the logical switch switch.lr-copp-add name routerβ adds the control plane protection policy name to the logical router router.
π¦ Mirror commands π¦
mirror-add m type [index] filter destβ creates a new mirror in theMirrortable with the name m, using the mandatory arguments below. mandatory. no skipping πΈ- type specifies the mirror type β
gre,erspanorlocal. - index specifies the tunnel index value (which is an integer) if the type is
greorerspan. - filter specifies the mirror source selection. can be
from-lport,to-lportorboth. - dest specifies the mirror destination IP (v4 or v6) if the type is
greorerspan. for a type oflocal, this field defines a local interface on the OVS integration bridge to be used as the mirror destination. the interface must possessexternal-ids:mirror-idthat matches this string. iykyk π₯
- type specifies the mirror type β
mirror-del mβ deletes the mirror m. bye bye boo πmirror-listβ lists the mirrors. that's it, that's the whole thing πmirror-rule-add mirror_name priority match actionβ adds a mirror rule to the mirror named mirror_name. priority is an integer between0and32767, inclusive. match is a match expression for selecting traffic. action must bemirrororskip. it is an error if a duplicate rule already exists on the mirror. no duplicates bestie, we already talked about this π€mirror-rule-del mirror_name [priority match]β deletes mirror rules from the mirror named mirror_name. if only mirror_name is given, all mirror rules are deleted from that mirror. if priority and match are also given, only the rule matching both is deleted. specify or don't, but don't be vague π
π Health Check commands π
lsp-hc-add PORT PROTOCOL SOURCE_IP [DST_PORT] ADDRESSβ creates a new health check configuration for the logical switch port PORT, using the mandatory arguments below:- PROTOCOL specifies the health check protocol β
tcp,udp, oricmp. - SOURCE_IP specifies the source IP address used when sending health check probes.
- DST_PORT specifies the destination port number for
tcpandudphealth checks. this parameter is ignored for theicmpprotocol. read it again. ignored π - ADDRESS specifies the IP address to monitor.
- PROTOCOL specifies the health check protocol β
additional health check options such as interval, timeout, success count, and failure count can be configured separately. side quest options, we stan π
lsp-hc-del PORT [HC_UUID]β deletes health check configuration for the logical switch port PORT. clean slate energy β¨lsp-hc-list PORTβ lists all health check configurations for the logical switch port PORT, including protocol, source IP, destination port, monitored addresses, and current status. the full rundown, no details withheld π
β Synchronization Commands β
syncβ okay so normally,--wait=sbor--wait=hvonly waits for changes made by the currentovn-nbctlinvocation to take effect. which means if none of the commands you gave toovn-nbctlactually change the database, then the command doesn't wait at all. but with thesynccommand?ovn-nbctlwaits even for earlier changes to the database to propagate down to the southbound database or all of the OVN chassis, according to the argument to--wait. it's giving patient, it's giving thorough, it's giving main character π«Ά
π Remote Connectivity Commands π
these commands manipulate the connections column in the NB_Global table and rows in the Connection table. when ovsdb-server is configured to use the connections column for OVSDB connections, this lets the administrator use ovn-nbctl to configure database connections. admin privileges, activated π
get-connectionβ prints the configured connection(s).del-connectionβ deletes the configured connection(s).[--inactivity-probe=msecs] set-connection target...β sets the configured manager target or targets. use--inactivity-probe=msecsto override the default idle connection inactivity probe time. use0to disable inactivity probes entirely. no probe, no problem β¨
π SSL/TLS Configuration Commands π
get-sslβ prints the SSL/TLS configuration.del-sslβ deletes the current SSL/TLS configuration.[--bootstrap] set-ssl private-key certificate ca-cert [ssl-protocol-list [ssl-cipher-list [ssl-ciphersuites]]]β sets the SSL/TLS configuration. secure the bag π
π Database Commands π
these commands query and modify the contents of ovsdb tables. they're a slight abstraction of the ovsdb interface and as such they operate at a lower level than other ovn-nbctl commands. we're going under the hood bestie, buckle up π
Identifying Tables, Records, and Columns
each of these commands has a table parameter to identify a table within the database. many of them also take a record parameter that identifies a particular record within a table. the record parameter may be the UUID for a record, which may be abbreviated to its first 4 (or more) hex digits, as long as that is unique. many tables offer additional ways to identify records. some commands also take column parameters that identify a particular field within the records in a table.
for a list of tables and their columns, see ovn-nb(5) or see the table listing from the --help option.
record names must be specified in full and with correct capitalization, except that UUIDs may be abbreviated to their first 4 (or more) hex digits, as long as that is unique within the table. names of tables and columns are not case-sensitive, and - and _ are treated interchangeably. unique abbreviations of table and column names are acceptable, e.g. d or dhcp is sufficient to identify the DHCP_Options table. shortcuts, slay π¦
Database Values
each column in the database accepts a fixed type of data. the currently defined basic types, and their representations, are:
integerβ a decimal integer in the range-2**63to2**63-1, inclusive.realβ a floating-point number.Booleanβ true or false, writtentrueorfalse, respectively.stringβ an arbitrary Unicode string, except that null bytes are not allowed. quotes are optional for most strings that begin with an English letter or underscore and consist only of letters, underscores, hyphens, and periods. however,trueandfalseand strings that match the syntax of UUIDs (see below) must be enclosed in double quotes to distinguish them from other basic types. when double quotes are used, the syntax is that of strings in JSON, e.g. backslashes may be used to escape special characters. the empty string must be represented as a pair of double quotes ("").UUIDβ either a universally unique identifier in the style of RFC 4122, e.g.f81d4fae-7dec-11d0-a765-00a0c91e6bf6, or an@namedefined by agetorcreatecommand within the sameovs-vsctlinvocation.
Multiple values in a single column? Separate them with spaces or a single comma, bestie. β¨ When multiple values are actually present, duplicates are not allowed, and the order is literally not important. Flip side: some database columns can hold a totally empty set of values, written as [], and square brackets may optionally wrap other non-empty sets or even single values too. π
A few database columns are ``maps'' of key-value pairs, where the key and the value are each some fixed database type. π These are specified in the form key=value, where key and value follow the syntax for the column's key type and value type, respectively. When multiple pairs are present (separated by spaces or a comma), duplicate keys are not allowed, and again the order is not important. Duplicate values are allowed though. π An empty map is represented as {}. Curly braces may optionally enclose non-empty maps as well β but use quotes to prevent the shell from expanding other-config={0=x,1=y} into other-config=0=x other-config=1=y, which may not have the desired effect. π
π Real talk: that shell-expansion thing is a classic ambush. Quote it or the shell will eat your map for breakfast.
ποΈ Database Command Syntax ποΈ
π list
[--if-exists] [--columns=column[,column]...] list table
[record]...
Lists the data in each specified record. If no records are specified, it lists all the records in table. πΈ
If --columns is specified, only the requested columns get listed, in the specified order. Otherwise, all columns are listed, in alphabetical order by column name. π¦
Without --if-exists, it is an error if any specified record does not exist. With --if-exists, the command just ignores any record that does not exist, without producing any output. Periodt. π
π find
[--columns=column[,column]...] find table [column[:key]=value]...
Lists the data in each record in table whose column equals value or, if key is specified, whose column contains a key with the specified value. π₯ The following operators may be used where = is written in the syntax summary:
= != < > <= >=β Selects records in whichcolumn[:key]equals, does not equal, is less than, is greater than, is less than or equal to, or is greater than or equal to value, respectively. π- Consider
column[:key]and value as sets of elements. Identical sets are considered equal. Otherwise, if the sets have different numbers of elements, then the set with more elements is considered to be larger. Otherwise, consider an element from each set pairwise, in increasing order within each set. The first pair that differs determines the result. (For a column that contains key-value pairs, first all the keys are compared, and values are considered only if the two sets contain identical keys.) π§
- Consider
{=} {!=}β Test for set equality or inequality, respectively. β¨{<=}β Selects records in whichcolumn[:key]is a subset of value. For example,flood-vlans{<=}1,2selects records in which theflood-vlanscolumn is the empty set or contains1or2or both. π{<}β Selects records in whichcolumn[:key]is a proper subset of value. For example,flood-vlans{<}1,2selects records in which theflood-vlanscolumn is the empty set or contains1or2but not both. π{>=} {>}β Same as{<=}and{<}, respectively, except that the relationship is reversed. For example,flood-vlans{>=}1,2selects records in which theflood-vlanscolumn contains both1and2. π
The following operators are available only in Open vSwitch 2.16 and later:
{in}β Selects records in which every element incolumn[:key]is also in value. (This is the same as{<=}.) π{not-in}β Selects records in which every element incolumn[:key]is not in value. π
For arithmetic operators (= != < > <= >=), when key is specified but a particular record's column does not contain key, the record is always omitted from the results. So the condition other-config:mtu!=1500 matches records that have a mtu key whose value is not 1500, but not those that lack an mtu key. π
For the set operators, when key is specified but a particular record's column does not contain key, the comparison is done against an empty set. So the condition other-config:mtu{!=}1500 matches records that have a mtu key whose value is not 1500 and those that lack an mtu key. π«Ά
β οΈ Don't forget to escape<or>from interpretation by the shell.
If --columns is specified, only the requested columns are listed, in the specified order. Otherwise all columns are listed, in alphabetical order by column name. πΈ
π The UUIDs shown for rows created in the same ovs-vsctl invocation will be wrong.
π get
[--if-exists] [--id=@name] get table record [column[:key]]...
Prints the value of each specified column in the given record in table. For map columns, a key may optionally be specified, in which case the value associated with key in the column is printed, instead of the entire map. π
Without --if-exists, it is an error if record does not exist or key is specified, if key does not exist in record. With --if-exists, a missing record yields no output and a missing key prints a blank line. β¨
If @name is specified, then the UUID for record may be referred to by that name later in the same ovs-vsctl invocation in contexts where a UUID is expected. π¦
Both --id and the column arguments are optional, but usually at least one or the other should be specified. If both are omitted, then get has no effect except to verify that record exists in table. π
π--idand--if-existscannot be used together. Pick a lane.
βοΈ set
[--if-exists] set table record column[:key]=value...
Sets the value of each specified column in the given record in table to value. For map columns, a key may optionally be specified, in which case the value associated with key in that column is changed (or added, if none exists), instead of the entire map. π
Without --if-exists, it is an error if record does not exist. With --if-exists, this command does nothing if record does not exist. π«Ά
β add
[--if-exists] add table record column [key=]value...
Adds the specified value or key-value pair to column in record in table. If column is a map, then key is required, otherwise it is prohibited. π If key already exists in a map column, then the current value is not replaced (use the set command to replace an existing value). π
Without --if-exists, it is an error if record does not exist. With --if-exists, this command does nothing if record does not exist. πΈ
β remove
[--if-exists] remove table record column value...
[--if-exists] remove table record column key...
[--if-exists] remove table record column key=value...
Removes the specified values or key-value pairs from column in record in table. The first form applies to columns that are not maps: each specified value is removed from the column. The second and third forms apply to map columns: if only a key is specified, then any key-value pair with the given key is removed, regardless of its value; if a value is given then a pair is removed only if both key and value match. π₯
It is not an error if the column does not contain the specified key or value or pair. π
Without --if-exists, it is an error if record does not exist. With --if-exists, this command does nothing if record does not exist. π
π§Ή clear
[--if-exists] clear table record column...
Sets each column in record in table to the empty set or empty map, as appropriate. π«§ This command applies only to columns that are allowed to be empty. π
Without --if-exists, it is an error if record does not exist. With --if-exists, this command does nothing if record does not exist. β¨
π£ create
[--id=(@name|uuid)] create table column[:key]=value...
Creates a new record in table and sets the initial values of each column. Columns not explicitly set will receive their default values. Outputs the UUID of the new row. π
If @name is specified, then the UUID for the new row may be referred to by that name elsewhere in the same ovn-nbctl invocation in contexts where a UUID is expected. Such references may precede or follow the create command. π¦
If a valid uuid is specified, then it is used as the UUID of the new row. π
Caution (ovs-vsctl as example) Records in the Open vSwitch database are significant only when they can be reached directly or indirectly from theOpen_vSwitchtable. Except for records in theQoSorQueuetables, records that are not reachable from theOpen_vSwitchtable get automatically deleted from the database. This deletion happens immediately, like no waiting around for extraovs-vsctlcommands or other database activity. So basically, acreatecommand generally has to be accompanied by additional commands within the sameovs-vsctlinvocation to add a chain of references to the newly created record from the top-levelOpen_vSwitchrecord. The EXAMPLES section gives some examples that show how to do this. π«Ά
[--if-exists] destroy table record...β deletes each specified record from table. Unless--if-existsis specified, each record must exist, no cap. π--all destroy tableβ deletes all records from the table. everything must go β¨
Caution (ovs-vsctl as example) Thedestroycommand is only useful for records in theQoSorQueuetables. Records in other tables are automatically deleted from the database when they become unreachable from theOpen_vSwitchtable. What that means is: deleting the last reference to a record is already enough to delete the record itself. For records in these tables,destroyis silently ignored. See the EXAMPLES section below for more information. π
wait-until table record [column[:key]=value]...β waits until table contains a record named record whose column equals value or, if key is specified, whose column contains a key with the specified value. This command supports the same operators and semantics described for thefindcommand above. β³
If no column[:key]=value arguments are given, this command waits only until record exists. If more than one such argument is given, the command waits until all of them are satisfied.
Caution (ovs-vsctl as example) Usuallywait-untilshould be placed at the beginning of a set ofovs-vsctlcommands. For example,wait-until bridge br0 -- get bridge br0 datapath_idwaits until a bridge namedbr0is created, then prints itsdatapath_idcolumn, whereasget bridge br0 datapath_id -- wait-until bridge br0will abort if no bridge namedbr0exists whenovs-vsctlinitially connects to the database. π
Consider specifying --timeout=0 along with --wait-until, to prevent ovs-vsctl from terminating after waiting only at most 5 seconds. iykyk π§
comment [arg]...β this command has no effect on behavior, but any database log record created by the command will include the command and its arguments. It's giving β¨receiptsβ¨ but make it a paper trail. π
πΈ ENVIRONMENT πΈ
OVN_NB_DAEMONβ if set, this should name the Unix domain socket for anovn-nbctlserver process. See Daemon Mode, above, for more information. π¦OVN_NBCTL_OPTIONSβ if set, a set of options forovn-nbctlto apply automatically, in the same form as on the command line. bestie is setting your defaults for you πOVN_NB_DBβ if set, the default database to contact when the--dboption is not used. π
β EXIT STATUS β
0β Successful program execution. we ate. π1β Usage, syntax, or network error. not the vibe. π
π SEE ALSO π
and that's the whole page, bestie!! π«Άβ¨ This was OVN 26.09.1, the ovn-nbctl page, from the ovn-nbctl(8) manual section β go forth and slay your logical northbound database, you've got this ππ
π¦ where this page comes from
- fedora 44: ovn 26.09.0-33.fc44 Β· Apache-2.0 AND LGPL-2.1-only AND SISSL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms