ovn-architecture(7) | OVN Manual | ovn-architecture(7) |
ovn-architecture - Open Virtual Network architecture
OVN, the Open Virtual Network, is a system to support logical network abstraction in virtual machine and container environments. OVN complements the existing capabilities of OVS to add native support for logical network abstractions, such as logical L2 and L3 overlays and security groups. Services such as DHCP are also desirable features. Just like OVS, OVN’s design goal is to have a production-quality implementation that can operate at significant scale.
A physical network comprises physical wires, switches, and routers. A virtual network extends a physical network into a hypervisor or container platform, bridging VMs or containers into the physical network. An OVN logical network is a network implemented in software that is insulated from physical (and thus virtual) networks by tunnels or other encapsulations. This allows IP and other address spaces used in logical networks to overlap with those used on physical networks without causing conflicts. Logical network topologies can be arranged without regard for the topologies of the physical networks on which they run. Thus, VMs that are part of a logical network can migrate from one physical machine to another without network disruption. See Logical Networks, below, for more information.
The encapsulation layer prevents VMs and containers connected to a logical network from communicating with nodes on physical networks. For clustering VMs and containers, this can be acceptable or even desirable, but in many cases VMs and containers do need connectivity to physical networks. OVN provides multiple forms of gateways for this purpose. See Gateways, below, for more information.
An OVN deployment consists of several components:
The diagram below shows how the major components of OVN and related software interact. Starting at the top of the diagram, we have:
The remaining components are replicated onto each hypervisor:
CMS
|
|
+-----------|-----------+
| | |
| OVN/CMS Plugin |
| | |
| | |
| OVN Northbound DB |
| | |
| | |
| ovn-northd |
| | |
+-----------|-----------+
|
|
+-------------------+
| OVN Southbound DB |
+-------------------+
|
|
+------------------+------------------+
| | |
HV 1 | | HV n |
+---------------|---------------+ . +---------------|---------------+
| | | . | | |
| ovn-controller | . | ovn-controller |
| | | | . | | | |
| | | | | | | |
| ovs-vswitchd ovsdb-server | | ovs-vswitchd ovsdb-server |
| | | |
+-------------------------------+ +-------------------------------+
Configuration data in OVN flows from north to south. The CMS, through its OVN/CMS plugin, passes the logical network configuration to ovn-northd via the northbound database. In turn, ovn-northd compiles the configuration into a lower-level form and passes it to all of the chassis via the southbound database.
Status information in OVN flows from south to north. OVN currently provides only a few forms of status information. First, ovn-northd populates the up column in the northbound Logical_Switch_Port table: if a logical port’s chassis column in the southbound Port_Binding table is nonempty, it sets up to true, otherwise to false. This allows the CMS to detect when a VM’s networking has come up.
Second, OVN provides feedback to the CMS on the realization of its configuration, that is, whether the configuration provided by the CMS has taken effect. This feature requires the CMS to participate in a sequence number protocol, which works the following way:
Each chassis in an OVN deployment must be configured with an Open vSwitch bridge dedicated for OVN’s use, called the integration bridge. System startup scripts may create this bridge prior to starting ovn-controller if desired. If this bridge does not exist when ovn-controller starts, it will be created automatically with the default configuration suggested below. The ports on the integration bridge include:
Other ports should not be attached to the integration bridge. In particular, physical ports attached to the underlay network (as opposed to gateway ports, which are physical ports attached to logical networks) must not be attached to the integration bridge. Underlay physical ports should instead be attached to a separate Open vSwitch bridge (they need not be attached to any bridge at all, in fact).
The integration bridge should be configured as described below. The effect of each of these settings is documented in ovs-vswitchd.conf.db(5):
The customary name for the integration bridge is br-int, but another name may be used.
Logical network concepts in OVN include logical switches and logical routers, the logical version of Ethernet switches and IP routers, respectively. Like their physical cousins, logical switches and routers can be connected into sophisticated topologies. Logical switches and routers are ordinarily purely logical entities, that is, they are not associated or bound to any physical location, and they are implemented in a distributed manner at each hypervisor that participates in OVN.
Logical switch ports (LSPs) are points of connectivity into and out of logical switches. There are many kinds of logical switch ports. The most ordinary kind represent VIFs, that is, attachment points for VMs or containers. A VIF logical port is associated with the physical location of its VM, which might change as the VM migrates. (A VIF logical port can be associated with a VM that is powered down or suspended. Such a logical port has no location and no connectivity.)
Logical router ports (LRPs) are points of connectivity into and out of logical routers. A LRP connects a logical router either to a logical switch or to another logical router. Logical routers only connect to VMs, containers, and other network nodes indirectly, through logical switches.
Logical switches and logical routers have distinct kinds of logical ports, so properly speaking one should usually talk about logical switch ports or logical router ports. However, an unqualified ``logical port’’ usually refers to a logical switch port.
When a VM sends a packet to a VIF logical switch port, the Open vSwitch flow tables simulate the packet’s journey through that logical switch and any other logical routers and logical switches that it might encounter. This happens without transmitting the packet across any physical medium: the flow tables implement all of the switching and routing decisions and behavior. If the flow tables ultimately decide to output the packet at a logical port attached to another hypervisor (or another kind of transport node), then that is the time at which the packet is encapsulated for physical network transmission and sent.
OVN supports a number of kinds of logical switch ports. VIF ports that connect to VMs or containers, described above, are the most ordinary kind of LSP. In the OVN northbound database, VIF ports have an empty string for their type. This section describes some of the additional port types.
A router logical switch port connects a logical switch to a logical router, designating a particular LRP as its peer.
A localnet logical switch port bridges a logical switch to a physical VLAN. A logical switch may have one or more localnet ports. Such a logical switch is used in two scenarios:
When a logical switch contains multiple localnet ports, the following is assumed.
Note: nothing said above implies that a chassis cannot be plugged to multiple physical networks as long as they belong to different switches.
A localport logical switch port is a special kind of VIF logical switch port. These ports are present in every chassis, not bound to any particular one. Traffic to such a port will never be forwarded through a tunnel, and traffic from such a port is expected to be destined only to the same chassis, typically in response to a request it received. OpenStack Neutron uses a localport port to serve metadata to VMs. A metadata proxy process is attached to this port on every host and all VMs within the same network will reach it at the same IP/MAC address without any traffic being sent over a tunnel. For further details, see the OpenStack documentation for networking-ovn.
LSP types vtep and l2gateway are used for gateways. See Gateways, below, for more information.
These concepts are details of how OVN is implemented internally. They might still be of interest to users and administrators.
Logical datapaths are an implementation detail of logical networks in the OVN southbound database. ovn-northd translates each logical switch or router in the northbound database into a logical datapath in the southbound database Datapath_Binding table.
For the most part, ovn-northd also translates each logical switch port in the OVN northbound database into a record in the southbound database Port_Binding table. The latter table corresponds roughly to the northbound Logical_Switch_Port table. It has multiple types of logical port bindings, of which many types correspond directly to northbound LSP types. LSP types handled this way include VIF (empty string), localnet, localport, vtep, and l2gateway.
The Port_Binding table has some types of port binding that do not correspond directly to logical switch port types. The common is patch port bindings, known as logical patch ports. These port bindings always occur in pairs, and a packet that enters on either side comes out on the other. ovn-northd connects logical switches and logical routers together using logical patch ports.
Port bindings with types vtep, l2gateway, l3gateway, and chassisredirect are used for gateways. These are explained in Gateways, below.
Gateways provide limited connectivity between logical networks and physical ones. They can also provide connectivity between different OVN deployments. This section will focus on the former, and the latter will be described in details in section OVN Deployments Interconnection.
OVN support multiple kinds of gateways.
A ``VTEP gateway’’ connects an OVN logical network to a physical (or virtual) switch that implements the OVSDB VTEP schema that accompanies Open vSwitch. (The ``VTEP gateway’’ term is a misnomer, since a VTEP is just a VXLAN Tunnel Endpoint, but it is a well established name.) See Life Cycle of a VTEP gateway, below, for more information.
The main intended use case for VTEP gateways is to attach physical servers to an OVN logical network using a physical top-of-rack switch that supports the OVSDB VTEP schema.
A L2 gateway simply attaches a designated physical L2 segment available on some chassis to a logical network. The physical network effectively becomes part of the logical network.
To set up a L2 gateway, the CMS adds an l2gateway LSP to an appropriate logical switch, setting LSP options to name the chassis on which it should be bound. ovn-northd copies this configuration into a southbound Port_Binding record. On the designated chassis, ovn-controller forwards packets appropriately to and from the physical segment.
L2 gateway ports have features in common with localnet ports. However, with a localnet port, the physical network becomes the transport between hypervisors. With an L2 gateway, packets are still transported between hypervisors over tunnels and the l2gateway port is only used for the packets that are on the physical network. The application for L2 gateways is similar to that for VTEP gateways, e.g. to add non-virtualized machines to a logical network, but L2 gateways do not require special support from top-of-rack hardware switches.
As described above under Logical Networks, ordinary OVN logical routers are distributed: they are not implemented in a single place but rather in every hypervisor chassis. This is a problem for stateful services such as SNAT and DNAT, which need to be implemented in a centralized manner.
To allow for this kind of functionality, OVN supports L3 gateway routers, which are OVN logical routers that are implemented in a designated chassis. Gateway routers are typically used between distributed logical routers and physical networks. The distributed logical router and the logical switches behind it, to which VMs and containers attach, effectively reside on each hypervisor. The distributed router and the gateway router are connected by another logical switch, sometimes referred to as a ``join’’ logical switch. (OVN logical routers may be connected to one another directly, without an intervening switch, but the OVN implementation only supports gateway logical routers that are connected to logical switches. Using a join logical switch also reduces the number of IP addresses needed on the distributed router.) On the other side, the gateway router connects to another logical switch that has a localnet port connecting to the physical network.
The following diagram shows a typical situation. One or more logical switches LS1, ..., LSn connect to distributed logical router LR1, which in turn connects through LSjoin to gateway logical router GLR, which also connects to logical switch LSlocal, which includes a localnet port to attach to the physical network.
LSlocal
|
GLR
|
LSjoin
|
LR1
|
+----+----+
| | |
LS1 ... LSn
To configure an L3 gateway router, the CMS sets options:chassis in the router’s northbound Logical_Router to the chassis’s name. In response, ovn-northd uses a special l3gateway port binding (instead of a patch binding) in the southbound database to connect the logical router to its neighbors. In turn, ovn-controller tunnels packets to this port binding to the designated L3 gateway chassis, instead of processing them locally.
DNAT and SNAT rules may be associated with a gateway router, which provides a central location that can handle one-to-many SNAT (aka IP masquerading). Distributed gateway ports, described below, also support NAT.
A distributed gateway port is a logical router port that is specially configured to designate one distinguished chassis, called the gateway chassis, for centralized processing. A distributed gateway port should connect to a logical switch that has an LSP that connects externally, that is, either a localnet LSP or a connection to another OVN deployment (see OVN Deployments Interconnection). Packets that traverse the distributed gateway port are processed without involving the gateway chassis when they can be, but when needed they do take an extra hop through it.
The following diagram illustrates the use of a distributed gateway port. A number of logical switches LS1, ..., LSn connect to distributed logical router LR1, which in turn connects through the distributed gateway port to logical switch LSlocal that includes a localnet port to attach to the physical network.
LSlocal
|
LR1
|
+----+----+
| | |
LS1 ... LSn
ovn-northd creates two southbound Port_Binding records to represent a distributed gateway port, instead of the usual one. One of these is a patch port binding named for the LRP, which is used for as much traffic as it can. The other one is a port binding with type chassisredirect, named cr-port. The chassisredirect port binding has one specialized job: when a packet is output to it, the flow table causes it to be tunneled to the gateway chassis, at which point it is automatically output to the patch port binding. Thus, the flow table can output to this port binding in cases where a particular task has to happen on the gateway chassis. The chassisredirect port binding is not otherwise used (for example, it never receives packets).
The CMS may configure distributed gateway ports three different ways. See Distributed Gateway Ports in the documentation for Logical_Router_Port in ovn-nb(5) for details.
Distributed gateway ports support high availability. When more than one chassis is specified, OVN only uses one at a time as the gateway chassis. OVN uses BFD to monitor gateway connectivity, preferring the highest-priority gateway that is online.
A logical router can have multiple distributed gateway ports, each connecting different external networks. Load balancing is not yet supported for logical routers with more than one distributed gateway port configured.
Physical VLAN MTU Issues
Consider the preceding diagram again:
LSlocal
|
LR1
|
+----+----+
| | |
LS1 ... LSn
Suppose that each logical switch LS1, ..., LSn is bridged to a physical VLAN-tagged network attached to a localnet port on LSlocal, over a distributed gateway port on LR1. If a packet originating on LSi is destined to the external network, OVN sends it to the gateway chassis over a tunnel. There, the packet traverses LR1’s logical router pipeline, possibly undergoes NAT, and eventually ends up at LSlocal’s localnet port. If all of the physical links in the network have the same MTU, then the packet’s transit across a tunnel causes an MTU problem: tunnel overhead prevents a packet that uses the full physical MTU from crossing the tunnel to the gateway chassis (without fragmentation).
OVN offers two solutions to this problem, the reside-on-redirect-chassis and redirect-type options. Both solutions require each logical switch LS1, ..., LSn to include a localnet logical switch port LN1, ..., LNn respectively, that is present on each chassis. Both cause packets to be sent over the localnet ports instead of tunnels. They differ in which packets-some or all-are sent this way. The most prominent tradeoff between these options is that reside-on-redirect-chassis is easier to configure and that redirect-type performs better for east-west traffic.
The first solution is the reside-on-redirect-chassis option for logical router ports. Setting this option on a LRP from (e.g.) LS1 to LR1 disables forwarding from LS1 to LR1 except on the gateway chassis. On chassis other than the gateway chassis, this single change means that packets that would otherwise have been forwarded to LR1 are instead forwarded to LN1. The instance of LN1 on the gateway chassis then receives the packet and forwards it to LR1. The packet traverses the LR1 logical router pipeline, possibly undergoes NAT, and eventually ends up at LSlocal’s localnet port. The packet never traverses a tunnel, avoiding the MTU issue.
This option has the further consequence of centralizing ``distributed’’ logical router LR1, since no packets are forwarded from LS1 to LR1 on any chassis other than the gateway chassis. Therefore, east-west traffic passes through the gateway chassis, not just north-south. (The naive ``fix’’ of allowing east-west traffic to flow directly between chassis over LN1 does not work because routing sets the Ethernet source address to LR1’s source address. Seeing this single Ethernet source address originate from all of the chassis will confuse the physical switch.)
Do not set the reside-on-redirect-chassis option on a distributed gateway port. In the diagram above, it would be set on the LRPs connecting LS1, ..., LSn to LR1.
The second solution is the redirect-type option for distributed gateway ports. Setting this option to bridged causes packets that are redirected to the gateway chassis to go over the localnet ports instead of being tunneled. This option does not change how OVN treats packets not redirected to the gateway chassis.
The redirect-type option requires the administrator or the CMS to configure each participating chassis with a unique Ethernet address for the logical router by setting ovn-chassis-mac-mappings in the Open vSwitch database, for use by ovn-controller. This makes it more difficult to configure than reside-on-redirect-chassis.
Set the redirect-type option on a distributed gateway port.
Using Distributed Gateway Ports For Scalability
Although the primary goal of distributed gateway ports is to provide connectivity to external networks, there is a special use case for scalability.
In some deployments, such as the ones using ovn-kubernetes, logical switches are bound to individual chassises, and are connected by a distributed logical router. In such deployments, the chassis level logical switches are centralized on the chassis instead of distributed, which means the ovn-controller on each chassis doesn’t need to process flows and ports of logical switches on other chassises. However, without any specific hint, ovn-controller would still process all the logical switches as if they are fully distributed. In this case, distributed gateway port can be very useful. The chassis level logical switches can be connected to the distributed router using distributed gateway ports, by setting the gateway chassis (or HA chassis groups with only a single chassis in it) to the chassis that each logical switch is bound to. ovn-controller would then skip processing the logical switches on all the other chassises, largely improving the scalability, especially when there are a big number of chassises.
Tables and their schemas presented in isolation are difficult to understand. Here’s an example.
A VIF on a hypervisor is a virtual network interface attached either to a VM or a container running directly on that hypervisor (This is different from the interface of a container running inside a VM).
The steps in this example refer often to details of the OVN and OVN Northbound database schemas. Please see ovn-sb(5) and ovn-nb(5), respectively, for the full story on these databases.
OVN provides virtual network abstractions by converting information written in OVN_NB database to OpenFlow flows in each hypervisor. Secure virtual networking for multi-tenants can only be provided if OVN controller is the only entity that can modify flows in Open vSwitch. When the Open vSwitch integration bridge resides in the hypervisor, it is a fair assumption to make that tenant workloads running inside VMs cannot make any changes to Open vSwitch flows.
If the infrastructure provider trusts the applications inside the containers not to break out and modify the Open vSwitch flows, then containers can be run in hypervisors. This is also the case when containers are run inside the VMs and Open vSwitch integration bridge with flows added by OVN controller resides in the same VM. For both the above cases, the workflow is the same as explained with an example in the previous section ("Life Cycle of a VIF").
This section talks about the life cycle of a container interface (CIF) when containers are created in the VMs and the Open vSwitch integration bridge resides inside the hypervisor. In this case, even if a container application breaks out, other tenants are not affected because the containers running inside the VMs cannot modify the flows in the Open vSwitch integration bridge.
When multiple containers are created inside a VM, there are multiple CIFs associated with them. The network traffic associated with these CIFs need to reach the Open vSwitch integration bridge running in the hypervisor for OVN to support virtual network abstractions. OVN should also be able to distinguish network traffic coming from different CIFs. There are two ways to distinguish network traffic of CIFs.
One way is to provide one VIF for every CIF (1:1 model). This means that there could be a lot of network devices in the hypervisor. This would slow down OVS because of all the additional CPU cycles needed for the management of all the VIFs. It would also mean that the entity creating the containers in a VM should also be able to create the corresponding VIFs in the hypervisor.
The second way is to provide a single VIF for all the CIFs (1:many model). OVN could then distinguish network traffic coming from different CIFs via a tag written in every packet. OVN uses this mechanism and uses VLAN as the tagging mechanism.
This section describes how a packet travels from one virtual machine or container to another through OVN. This description focuses on the physical treatment of a packet; for a description of the logical life cycle of a packet, please refer to the Logical_Flow table in ovn-sb(5).
This section mentions several data and metadata fields, for clarity summarized here:
Initially, a VM or container on the ingress hypervisor sends a packet on a port attached to the OVN integration bridge. Then:
Typically logical routers and logical patch ports do not have a physical location and effectively reside on every hypervisor. This is the case for logical patch ports between logical routers and logical switches behind those logical routers, to which VMs (and VIFs) attach.
Consider a packet sent from one virtual machine or container to another VM or container that resides on a different subnet. The packet will traverse tables 0 to 65 as described in the previous section Architectural Physical Life Cycle of a Packet, using the logical datapath representing the logical switch that the sender is attached to. At table 37, the packet will use the fallback flow that resubmits locally to table 38 on the same hypervisor. In this case, all of the processing from table 0 to table 65 occurs on the hypervisor where the sender resides.
When the packet reaches table 65, the logical egress port is a logical patch port. ovn-controller implements output to the logical patch is packet by cloning and resubmitting directly to the first OpenFlow flow table in the ingress pipeline, setting the logical ingress port to the peer logical patch port, and using the peer logical patch port’s logical datapath (that represents the logical router).
The packet re-enters the ingress pipeline in order to traverse tables 8 to 65 again, this time using the logical datapath representing the logical router. The processing continues as described in the previous section Architectural Physical Life Cycle of a Packet. When the packet reaches table 65, the logical egress port will once again be a logical patch port. In the same manner as described above, this logical patch port will cause the packet to be resubmitted to OpenFlow tables 8 to 65, this time using the logical datapath representing the logical switch that the destination VM or container is attached to.
The packet traverses tables 8 to 65 a third and final time. If the destination VM or container resides on a remote hypervisor, then table 37 will send the packet on a tunnel port from the sender’s hypervisor to the remote hypervisor. Finally table 65 will output the packet directly to the destination VM or container.
The following sections describe two exceptions, where logical routers and/or logical patch ports are associated with a physical location.
A gateway router is a logical router that is bound to a physical location. This includes all of the logical patch ports of the logical router, as well as all of the peer logical patch ports on logical switches. In the OVN Southbound database, the Port_Binding entries for these logical patch ports use the type l3gateway rather than patch, in order to distinguish that these logical patch ports are bound to a chassis.
When a hypervisor processes a packet on a logical datapath representing a logical switch, and the logical egress port is a l3gateway port representing connectivity to a gateway router, the packet will match a flow in table 37 that sends the packet on a tunnel port to the chassis where the gateway router resides. This processing in table 37 is done in the same manner as for VIFs.
This section provides additional details on distributed gateway ports, outlined earlier.
The primary design goal of distributed gateway ports is to allow as much traffic as possible to be handled locally on the hypervisor where a VM or container resides. Whenever possible, packets from the VM or container to the outside world should be processed completely on that VM’s or container’s hypervisor, eventually traversing a localnet port instance or a tunnel to the physical network or a different OVN deployment. Whenever possible, packets from the outside world to a VM or container should be directed through the physical network directly to the VM’s or container’s hypervisor.
In order to allow for the distributed processing of packets described in the paragraph above, distributed gateway ports need to be logical patch ports that effectively reside on every hypervisor, rather than l3gateway ports that are bound to a particular chassis. However, the flows associated with distributed gateway ports often need to be associated with physical locations, for the following reasons:
The details of flow restrictions to specific chassis are described in the ovn-northd documentation.
While most of the physical location dependent aspects of distributed gateway ports can be handled by restricting some flows to specific chassis, one additional mechanism is required. When a packet leaves the ingress pipeline and the logical egress port is the distributed gateway port, one of two different sets of actions is required at table 37:
In order to trigger the second set of actions, the chassisredirect type of southbound Port_Binding has been added. Setting the logical egress port to the type chassisredirect logical port is simply a way to indicate that although the packet is destined for the distributed gateway port, it needs to be redirected to a different chassis. At table 37, packets with this logical egress port are sent to a specific chassis, in the same way that table 37 directs packets whose logical egress port is a VIF or a type l3gateway port to different chassis. Once the packet arrives at that chassis, table 38 resets the logical egress port to the value representing the distributed gateway port. For each distributed gateway port, there is one type chassisredirect port, in addition to the distributed logical patch port representing the distributed gateway port.
OVN allows you to specify a prioritized list of chassis for a distributed gateway port. This is done by associating multiple Gateway_Chassis rows with a Logical_Router_Port in the OVN_Northbound database.
When multiple chassis have been specified for a gateway, all chassis that may send packets to that gateway will enable BFD on tunnels to all configured gateway chassis. The current master chassis for the gateway is the highest priority gateway chassis that is currently viewed as active based on BFD status.
For more information on L3 gateway high availability, please refer to http://docs.ovn.org/en/latest/topics/high-availability.
Distributed gateway ports are used to connect to an external network, which can be a physical network modeled by a logical switch with a localnet port, and can also be a logical switch that interconnects different OVN deployments (see OVN Deployments Interconnection). Usually there can be many logical routers connected to the same external logical switch, as shown in below diagram.
+--LS-EXT-+
| | |
| | |
LR1 ... LRn
In this diagram, there are n logical routers connected to a logical switch LS-EXT, each with a distributed gateway port, so that traffic sent to external world is redirected to the gateway chassis that is assigned to the distributed gateway port of respective logical router.
In the logical topology, nothing can prevent an user to add a route between the logical routers via the connected distributed gateway ports on LS-EXT. However, the route works only if the LS-EXT is a physical network (modeled by a logical switch with a localnet port). In that case the packet will be delivered between the gateway chassises through the localnet port via physical network. If the LS-EXT is a regular logical switch (backed by tunneling only, as in the use case of OVN interconnection), then the packet will be dropped on the source gateway chassis. The limitation is due the fact that distributed gateway ports are tied to physical location, and without physical network connection, we will end up with either dropping the packet or transferring it over the tunnels which could cause bigger problems such as broadcast packets being redirect repeatedly by different gateway chassises.
With the limitation in mind, if a user do want the direct connectivity between the logical routers, it is better to create an internal logical switch connected to the logical routers with regular logical router ports, which are completely distributed and the packets don’t have to leave a chassis unless necessary, which is more optimal than routing via the distributed gateway ports.
Due to the fact that ARP requests and ND NA packets are usually broadcast packets, for performance reasons, OVN deals with requests that target OVN owned IP addresses (i.e., IP addresses configured on the router ports, VIPs, NAT IPs) in a specific way and only forwards them to the logical router that owns the target IP address. This behavior is different than that of traditional switches and implies that other routers/hosts connected to the logical switch will not learn the MAC/IP binding from the request packet.
All other ARP and ND packets are flooded in the L2 broadcast domain and to all attached logical patch ports.
Typically the logical switch connected by a distributed gateway port is for external connectivity, usually to a physical network through a localnet port on the logical switch, or to a remote OVN deployment through OVN Interconnection. In these cases there is no VIF ports required on the logical switch.
While not very common, it is still possible to create VIF ports on the logical switch connected by a distributed gateway port, but there is a limitation that the logical ports need to reside on the gateway chassis where the distributed gateway port resides to get connectivity to other logical switches through the distributed gateway port. There is no limitation for the VIFs to connect within the logical switch, or beyond the logical switch through other regular distributed logical router ports.
A special case is when using distributed gateway ports for scalability purpose, as mentioned earlier in this document. The logical switches connected by distributed gateway ports are not for connectivity but just for regular VIFs. However, the above limitation usually does not matter because in this use case all the VIFs on the logical switch are located on the same chassis with the distributed gateway port that connects the logical switch.
It is possible to have multiple logical switches each with a localnet port (representing physical networks) connected to a logical router, in which one localnet logical switch may provide the external connectivity via a distributed gateway port and rest of the localnet logical switches use VLAN tagging in the physical network. It is expected that ovn-bridge-mappings is configured appropriately on the chassis for all these localnet networks.
East-West routing between these localnet VLAN tagged logical switches work almost the same way as normal logical switches. When the VM sends such a packet, then:
The following happens when a VM sends an external traffic (which requires NATting) and the chassis hosting the VM doesn’t have a distributed gateway port.
Although this works, the VM traffic is tunnelled when sent from the compute chassis to the gateway chassis. In order for it to work properly, the MTU of the localnet logical switches must be lowered to account for the tunnel encapsulation.
To overcome the tunnel encapsulation problem described in the previous section, OVN supports the option of enabling centralized routing for localnet VLAN tagged logical switches. CMS can configure the option options:reside-on-redirect-chassis to true for each Logical_Router_Port which connects to the localnet VLAN tagged logical switches. This causes the gateway chassis (hosting the distributed gateway port) to handle all the routing for these networks, making it centralized. It will reply to the ARP requests for the logical router port IPs.
If the logical router doesn’t have a distributed gateway port connecting to the localnet logical switch which provides external connectivity, or if it has more than one distributed gateway ports, then this option is ignored by OVN.
The following happens when a VM sends an east-west traffic which needs to be routed:
The following happens when a VM sends an external traffic which requires NATting:
The following happens for the reverse external traffic.
As an alternative to reside-on-redirect-chassis, OVN supports VLAN-based redirection. Whereas reside-on-redirect-chassis centralizes all router functionality, VLAN-based redirection only changes how OVN redirects packets to the gateway chassis. By setting options:redirect-type to bridged on a distributed gateway port, OVN redirects packets to the gateway chassis using the localnet port of the router’s peer logical switch, instead of a tunnel.
If the logical router doesn’t have a distributed gateway port connecting to the localnet logical switch which provides external connectivity, or if it has more than one distributed gateway ports, then this option is ignored by OVN.
Following happens for bridged redirection:
Some guidelines and expections with bridged redirection:
A gateway is a chassis that forwards traffic between the OVN-managed part of a logical network and a physical VLAN, extending a tunnel-based logical network into a physical network.
The steps below refer often to details of the OVN and VTEP database schemas. Please see ovn-sb(5), ovn-nb(5) and vtep(5), respectively, for the full story on these databases.
It is not uncommon for an operator to deploy multiple OVN clusters, for two main reasons. Firstly, an operator may prefer to deploy one OVN cluster for each availability zone, e.g. in different physical regions, to avoid single point of failure. Secondly, there is always an upper limit for a single OVN control plane to scale.
Although the control planes of the different availability zone (AZ)s are independent from each other, the workloads from different AZs may need to communicate across the zones. The OVN interconnection feature provides a native way to interconnect different AZs by L3 routing through transit overlay networks between logical routers of different AZs.
A global OVN Interconnection Northbound database is introduced for the operator (probably through CMS systems) to configure transit logical switches that connect logical routers from different AZs. A transit switch is similar to a regular logical switch, but it is used for interconnection purpose only. Typically, each transit switch can be used to connect all logical routers that belong to same tenant across all AZs.
A dedicated daemon process ovn-ic, OVN interconnection controller, in each AZ will consume this data and populate corresponding logical switches to their own northbound databases for each AZ, so that logical routers can be connected to the transit switch by creating patch port pairs in their northbound databases. Any router ports connected to the transit switches are considered interconnection ports, which will be exchanged between AZs.
Physically, when workloads from different AZs communicate, packets need to go through multiple hops: source chassis, source gateway, destination gateway and destination chassis. All these hops are connected through tunnels so that the packets never leave overlay networks. A distributed gateway port is required to connect the logical router to a transit switch, with a gateway chassis specified, so that the traffic can be forwarded through the gateway chassis.
A global OVN Interconnection Southbound database is introduced for exchanging control plane information between the AZs. The data in this database is populated and consumed by the ovn-ic, of each AZ. The main information in this database includes:
The tunnel keys for transit switch datapaths and related port bindings must be agreed across all AZs. This is ensured by generating and storing the keys in the global interconnection southbound database. Any ovn-ic from any AZ can allocate the key, but race conditions are solved by enforcing unique index for the column in the database.
Once each AZ’s NB and SB databases are populated with interconnection switches and ports, and agreed upon the tunnel keys, data plane communication between the AZs are established.
When VXLAN tunneling is enabled in an OVN cluster, due to the limited range available for VNIs, Interconnection feature is not supported.
To support OVN native services (like DHCP/IPv6 RA/DNS lookup) to the cloud resources which are external, OVN supports external logical ports.
Below are some of the use cases where external ports can be used.
OVN will provide the native services if CMS has done the below configuration in the OVN Northbound Database.
It is recommended to use the same HA chassis group for all the external ports of a logical switch. Otherwise, the physical switch might see MAC flap issue when different chassis provide the native services. For example when supporting native DHCPv4 service, DHCPv4 server mac (configured in options:server_mac column in table DHCP_Options) originating from different ports can cause MAC flap issue. The MAC of the logical router IP(s) can also flap if the same HA chassis group is not set for all the external ports of a logical switch.
In order to provide additional security against the possibility of an OVN chassis becoming compromised in such a way as to allow rogue software to make arbitrary modifications to the southbound database state and thus disrupt the OVN network, role-based access controls (see ovsdb-server(1) for additional details) are provided for the southbound database.
The implementation of role-based access controls (RBAC) requires the addition of two tables to an OVSDB schema: the RBAC_Role table, which is indexed by role name and maps the the names of the various tables that may be modifiable for a given role to individual rows in a permissions table containing detailed permission information for that role, and the permission table itself which consists of rows containing the following information:
RBAC configuration for the OVN southbound database is maintained by ovn-northd. With RBAC enabled, modifications are only permitted for the Chassis, Encap, Port_Binding, and MAC_Binding tables, and are restricted as follows:
Enabling RBAC for ovn-controller connections to the southbound database requires the following steps:
OVN tunnel traffic goes through physical routers and switches. These physical devices could be untrusted (devices in public network) or might be compromised. Enabling encryption to the tunnel traffic can prevent the traffic data from being monitored and manipulated.
The tunnel traffic is encrypted with IPsec. The CMS sets the ipsec column in the northbound NB_Global table to enable or disable IPsec encrytion. If ipsec is true, all OVN tunnels will be encrypted. If ipsec is false, no OVN tunnels will be encrypted.
When CMS updates the ipsec column in the northbound NB_Global table, ovn-northd copies the value to the ipsec column in the southbound SB_Global table. ovn-controller in each chassis monitors the southbound database and sets the options of the OVS tunnel interface accordingly. OVS tunnel interface options are monitored by the ovs-monitor-ipsec daemon which configures IKE daemon to set up IPsec connections.
Chassis authenticates each other by using certificate. The authentication succeeds if the other end in tunnel presents a certificate signed by a trusted CA and the common name (CN) matches the expected chassis name. The SSL certificates used in role-based access controls (RBAC) can be used in IPsec. Or use ovs-pki to create different certificates. The certificate is required to be x.509 version 3, and with CN field and subjectAltName field being set to the chassis name.
The CA certificate, chassis certificate and private key are required to be installed in each chassis before enabling IPsec. Please see ovs-vswitchd.conf.db(5) for setting up CA based IPsec authentication.
In general, OVN annotates logical network packets that it sends from one hypervisor to another with the following three pieces of metadata, which are encoded in an encapsulation-specific fashion:
When VXLAN is enabled on any hypervisor in a cluster, datapath and egress port identifier ranges are reduced to 12-bits. This is done because only STT and Geneve provide the large space for metadata (over 32 bits per packet). To accommodate for VXLAN, 24 bits available are split as follows:
The limited space available for metadata when VXLAN tunnels are enabled in a cluster put the following functional limitations onto features available to users:
In addition to functional limitations described above, the following should be considered before enabling it in your cluster:
Due to its flexibility, the preferred encapsulation between hypervisors is Geneve. For Geneve encapsulation, OVN transmits the logical datapath identifier in the Geneve VNI. OVN transmits the logical ingress and logical egress ports in a TLV with class 0x0102, type 0x80, and a 32-bit value encoded as follows, from MSB to LSB:
1 15 16
+---+------------+-----------+
|rsv|ingress port|egress port|
+---+------------+-----------+
0
Environments whose NICs lack Geneve offload may prefer STT encapsulation for performance reasons. For STT encapsulation, OVN encodes all three pieces of logical metadata in the STT 64-bit tunnel ID as follows, from MSB to LSB:
9 15 16 24
+--------+------------+-----------+--------+
|reserved|ingress port|egress port|datapath|
+--------+------------+-----------+--------+
0
For connecting to gateways, in addition to Geneve and STT, OVN supports VXLAN, because only VXLAN support is common on top-of-rack (ToR) switches. Currently, gateways have a feature set that matches the capabilities as defined by the VTEP schema, so fewer bits of metadata are necessary. In the future, gateways that do not support encapsulations with large amounts of metadata may continue to have a reduced feature set.
OVN Architecture | OVN 23.03.0 |