Abstract

A LRE (logical routing element) that have LIFs that are active in all host machines spanned by the LRE as well as LIFs that are active in only a subset of those spanned host machines is provided. A host machine having an active LIF for a particular L2 segment would perform the L3 routing operations for network traffic related to that L2 segment. A host machine having an inactive LIF for the particular L2 segment would not perform. L3 routing operations for the network traffic of the L2 segment.

Description

INTERMEDIATE LOGICAL INTERFACES IN A

VIRTUAL DISTRIBUTED ROUTER ENVIRONMENT

Vivek Agarwal, Ganesan Chandrashekhar,

Rahul Korivi Subramaniyam, Howard Wang, Ram Dular Singh

BACKGROUND

[0001] In a network virtualization environment, one of the more common applications deployed on hypervisors are 3-tier apps, in which a web-tier, a database -tier, and app-tier are on different L3 subnets. This requires IP (internet protocol) packets traversing from one virtual machine (VM) in one subnet to another VM in another subnet to first arrive at a L3 router, then forwarded to the destination VM using L2 MAC (media access control) address. This is true even if the destination VM is hosted on the same host machine as the originating VM. This generates unnecessary network traffic and causes higher latency and lower throughput, which significantly degrades the performance of the application running on the hypervisors. Generally speaking, this performance degradation occurs whenever any two VMs in two different network segments (e.g., different IP subnet, different L2 segments, or different overlay logical networks) communicate with each other.

[0002] U.S. Patent Application 14/137,862, filed on December 20, 2013, describes a logical router element (LRE) that operates distributively across different host machines as a virtual distributed router (VDR). Each host machine operates its own local instance of the LRE as a managed physical routing element (MPRE) for performing L3 packet forwarding for the VMs running on that host. The LRE therefore makes it possible to forward data packets locally (i.e., at the originating hypervisor) without going through a shared L3 router.

SUMMARY

[0003] In some embodiments, a L E (logical routing element) can have LIFs that are active in ail host machines spanned by the LRE as well as LIFs that are active in only a subset of those spanned host machines, A LIF that is active in only a subset of host machines while remaining dormant in other host machines is referred to as an intermediate LIF, or iLIF in some embodiments. A host machine having an active LIF for a particular L2 segment would perform the L3 routing operations for network traffic related to that L2 segment. A host machine having an inactive LIF for the particular L2 segment would not perform L3 routing operations for the network traffic of the L2 segment.

[0004] A L2 segment can be an overlay network like VXLAN, or a VLAN IP subnet.

In some embodiments, a LSE that correspond to a VXLAN is configured to be active on all host machines, and the LIF that correspond to the VXLAN is active on all host machines to perform the corresponding L3 routing tasks. In some embodiments, a VLAN segment is physically confined to a host machine or a subset of the host machines. In some embodiments, the LIF that corresponds to such a VLAN is active only on the subset of edge host machines. In order to perform L3 routing into a particular VNI that is active only on a subset of the host machine (i.e., a L2 segment whose LIF is an iLIF), some embodiments use a backplane conduit to send traffic from a host machine with an inactive LIF for the particular VNI to a host machine with an active LIF for die particular VNI. In some embodiments, a host machine with an active LIF is assigned a MAC address so it is uniquely identifiable in the backplane conduit as a destination. Such a MAC address is referred to as a "rMAC" (or "routing" MAC, or "re-route" MAC) in some embodiments.

[0005] In some embodiments, different tenants of a same datacenter (or multi-site environment) would share common resources, such as common edge services to an external network, or a common VLAN IP subnet provided by a network service provider. In some embodiments, the same VNI of the common resource is used by the multiple tenants that share the common resource, and the different tenants' corresponding LREs would have active LIFs for the same VNI at the same host machine. In some embodiments, active LIFs for different tenants have different rMACs, even when the LIFs have the same VNI. In some other embodiments, each tenant has its own backplane conduit such that the traffic to different tenants active LIFs are segregated by their respective conduits. In some embodiments, each tenant or LRE has its own backplane conduit such that different tenants can safely use the same rMAC address without blending backplane traffic.
[0006] In some embodiments, an iLIF can be active in multiple host machines. For each of such host machines, some embodiments assign a unique MAC. In other words, for a given iLIF, each of its active LIFs (or each of the host machines that operate an active LIF of the iLIF) is uniquely identifiable by such MACs. In some embodiment, such MACs are referred as IMACs (LIF MACs) as each IMAC is for identifying an active LIF. For some embodiments, IMAC and rMAC are both used for redirecting traffic for an iLIF from a host machine on which the iLIF is dormant to a host machine on which the iLIF is active.

[0007] In some embodiments, an IMAC is used to identify active LIFs when using iLIFs for routing. In some embodiments, IMAC is used as the destination MAC for the backplane conduit. Some embodiments use IMACs to segregate traffic between different tenants, even traffic for the L2 segment with the same VNI. Some embodiments use IMAC to select an IP interface from among several available IP interfaces for ECMP (equal cost multi- path) purposes.

[0008] The preceding Summary is intended to serve as a brief introduction to some embodiments of the invention , it is not meant to be an introduction or overview of all inventive subject matter disclosed in this document. The Detailed Description that follows and the Drawings that are referred to in the Detailed Description will further describe the embodiments described in the Summary as well as other embodiments. Accordingly, to understand all the embodiments described by this document, a full review of the Summary, Detailed Description and the Drawings is needed. Moreover, the claimed subject matters are not to be limited by the illustrative details in the Summary, Detailed Description and the Drawings, but rather are to be defined by the appended claims, because the claimed subject matters can be embodied in other specific forms without departing from the spirit of the subject matters.

BRIEF DESCRIPTION OF THE DRAWINGS

[0009] The novel features of the invention are set forth in the appended claims.

However, for purpose of explanation, several embodiments of the invention are set forth in the following figures.

[0024] Figure 14 illustrates ECMP based on IMACs for selecting one of the edges of the network virtualization infrastructure.

[0025] Figure IS illustrates a logical network that is implemented over a network virtualization infrastructure that has multiple different physical resources.

[0026] Figure 16 conceptually illustrates a process performed by a host machine for identifying the correct MPRE for L3 routing.
[0027] Figure 17 conceptually illustrates a process for L3 routing by an MPRE of a host machine.

[0028] Figure 18 conceptually illustrates a process for configuring the host machines of a datacenter to implement logical networks with iLTFs that use rMAC to redirect traffic, [0029] Figure 19 conceptually illustrates a process for configuring host machines of a datacenter and assigning an 1MAC to each IP interface of each L1F.

[0030] Figure 20 conceptually illustrates an electronic system with which some embodiments of the invention are implemented.

DETAILED DESCRIPTION

[0031] In the following description, numerous details are set forth for the purpose of explanation. However, one of ordinary skill in the art will realize that the invention may be practiced without the use of these specific details. In other instances, well-known structures and devices are shown in block diagram form in order not to obscure the description of the invention with unnecessary detail.

[0032] A virtual distributed router environment is one in which a logical router element (LRE) operates distributive!}' across different host machines as a virtual distributed router (VDR). Each host machine operates its own local instance of the LRE as a managed physical routing element (MPRE) for performing L3 packet forwarding for the VMs running on that host. In addition to operating the distributed LRE, these different host machines also operate logical switching elements (LSEs) as distributed virtual switches (DVSs). Each host machine operates its own local instance of the LSE as a managed physical switching element (MPSE) for performing L2 packet switching for the VMs running on that host. The MPRE(s) and the MPSE of a host machine make it possible to forward data packets locally at the host machine without relying on physical L3 routers and/or physical L2 switches. Furthermore, the MPREs and MPSEs running on the different host machines operate according to the parameters / configurations that are set forth for their respective LREs and LSEs.

[0033] In some embodiments, each of these host machines is operating a virtualization software or a hypervisor that allows it to host one or more virtual machines (VMs) and to provide network access to those VMs. In some embodiments, the host machines running the LREs are in a network virtualization inf astructure over a physical network. Such a network virtualization infrastructure in some embodiments includes physical network nodes (such as external edge routers) that belong to a network segment that is served by one of the LREs and yet do not operate the LRE itself.

LREs and LSEs. In some embodiments, a network virtualization infrastructure is a datacenter in which many computing devices situate and serve as host machines. The datacenter also includes storage systems and communication systems for communicating with the external world, including other datacenters or user's own site. In some embodiments, the network virtualization infrastructure includes multiple datacenters (a multi-site environment), where at least some of the LREs and LSEs span multiple host machines in different datacenters.

[0035] As illustrated, the network virtualization infrastructure 100 includes host machines 110-119. Some of these host machines are operating virtualization software that
allow them to operate one or more virtual machines (VMs). Some of these host machines are configured as designated instances for providing routing/switching services of the network virtualization infrastructure to physical hosts or routers (PI Is)

[0036] These host machines are illustrated as implementing three different LREs:

LRE alpha (121), LRE- beta ( 122), and LRE gamma (123). All of these LREs span host machines 110-119, i.e., the LREs 121-123 operate in those host machine in a distributed fashion, where each host machine operates MPRE that are a local physical instance of the LREs 121-123.

[ΘΘ37] Each of these LREs is a L3 router that connects multiple L2 segments. Each

L2 segment is backed by a LSE, which performs L2 switching between network nodes in the segment (VMs and/or PHs). In some embodiments, each L2 segment has a network segment identifier, i.e., VNI (virtual network identifier, VLAN network identifier, or VXLAN network identifier) to distinguish it from other L2 segments. In some embodiments and in some places of this document, a L2 segment is referred to as a "VNI".

ΘΘ38] The LREs provide L3 routing between nodes that are in different L2 segments

(i.e., serve by different LSEs). As illustrated, the LRE alpha 121 provides L3 connectivity between LSEs A and B (131 and 132), the LRE beta 122 provides L3 connectivity between LSEs C and D (133 and 134), and the LRE gamma 123 provides L3 connectivity between LSEs E, F, and G (135-137). Each of these LSEs also spans the host machines 111-1 19. In some embodiments, each host machine operates a MPSE and a set of MPREs. The MPSE perform s L2 switching as required by each of the LSEs A , B, C, D, E, F, and G. The MPREs perform L3 routing between those L2 segments.

[0039] In some embodiments, each LRE and the L2 segments that it interconnects are collectively referred to as a logical network. As illustrated, the LRE alpha 121 interconnects the L2 segments of a logical network 101, the LRE beta 122 interconnects the L2 segments of a logical network 102, and the LRE gamma 123 interconnects the L2 segments of a logical network 103. In some embodiments, different logical networks of a datacenter can belong to different tenants of the datacenter, and the traffic of different logical networks are segregated from each other, even when packets of different logical networks are being handled by a same host machine.

[0040] Figure 2 illustrates a computing device 200 that serves as a host machine for some embodiments of the invention. The computing device 200 is running virtualization software that implements a physical switching element and a set of physical routing elements, (i.e., MPSE and MPREs).
[0041] As illustrated, the computing device 200 has access to a physical network 290 through a physical NIC (PN1C) 295. The host machine 200 also runs the virtualization software 205 and hosts VMs 21 -214. The virtualization software 205 serves as the interface between the hosted VMs and the physical NIC 295 (as well as other physical resources, such as processors and memory). Each of the VMs includes a virtual NIC (VNIC) for accessing the network through the virtualization software 205. Each VNIC in a VM is responsible for exchanging packets between the VM and the virtualization software 205. In some embodiments, the VNICs are software abstractions of physical NICs implemented by virtual NIC emulators.

[0042] The virtualization software 205 manages the operations of the VMs 211 -214, and includes several components for managing the access of the VMs to the physical network (by implementing the logical networks to which the VMs connect, in some embodiments). As illustrated, the virtualization software includes several components, including a MPSE 220, a set of MPREs 230, a controller agent 240, a VTEP 250, and a set of uplink pipelines 270.

[0043] The VTEP (VXLAN tunnel endpoint) 250 allows the host machine 200 to serve as a tunnel endpoint for logical network traffic (e.g., VXLAN traffic). VXLAN is an overlay network encapsulation protocol. An overlay network created by VXLAN encapsulation is sometimes referred to as a VXLAN network, or simply VXLAN. When a VM on the host 200 sends a data packet (e.g., an ethernet frame) to another VM in the same VXLAN network but on a different host, the VTEP will encapsulate the data packet using the VXLAN network's VNI and network addresses of the VTEP, before sending the packet to the physical network. The packet is tunneled through the physical network (i.e., the encapsulation renders the underlying packet transparent to the intervening network elements) to the destination host. The VTEP at the destination host decapsulates the packet and forwards only the original inner data packet to the destination VM. In some embodiments, the VTEP module serves only as a controller interface for VXLAN encapsulation, while the encapsulation and decapsulation of VXLAN packets is accomplished at the uplink module 270.

[0044] The controller agent 240 receives control plane messages from a controller or a cluster of controllers. In some embodiments, these control plane message includes configuration data for configuring the various components of the virtualization software (such as the MPSE 220 and the MPREs 230) and/or the virtual machines. In the example illustrated in Figure 2, the controller agent 240 receives control plane messages from the controller cluster 260 from the physical network 290 and in turn provides the received
configuration data to the MPREs 230 through a control channel without going through the MPSE 220. However, in some embodiments, the controller agent 240 receives control plane messages from a direct data conduit (not illustrated) independent of the physical network 290. in some other embodiments, the controller agent receives control plane messages from the MPSE 220 and forwards configuration data to the router 230 through the MPSE 220.

[0045] The MPSE 220 delivers network data to and from the physical NIC 295, which interfaces the physical network 290. The MPSE also includes a number of virtual ports ( Ports) that communicatively interconnects the physical NIC with the VMs 211 -214, the MPREs 230 and the controller agent 240. Each virtual port is associated with a unique L2 MAC address, in some embodiments. The MPSE performs L2 link layer packet forwarding between any two network elements that are connected to its virtual ports. The MPSE also performs L2 link layer packet forwarding between any network element connected to any one of its virtual ports and a reachable L2 network element on the physical network 290 (e.g., another VM nmning on another host). In some embodiments, a MPSE is a local instantiation of a logical switching element (LSE) that operates across the different host machines and can perform L2 packet switching between VMs on a same host machine or on different host machines. In some embodiments, the MPSE performs the switching function of several LSEs according to the configuration of those logical switches.

[0046] The MPREs 230 perform L3 routing on data packets received from a virtual port on the MPSE 220. In some embodiments, this routing operation entails resolving L3 IP address to a next-hop L2 MAC address and a next-hop VNI (i.e., the VNI of the next-hop's L2 segment). Each routed data packet is then sent back to the MPSE 220 to be forwarded to its destination according to the resolved L2 MAC address. This destination can be another VM connected to a virtual port on the MPSE 220, or a reachable L2 network element on the physical network 290 (e.g., another VM running on another host, a physical non-virtualized machine, etc.).

[0047] As mentioned, in some embodiments, a MPRE is a local instantiation of a logical routing element (LRE) that operates across the different host machines and can perform L3 packet forwarding between VMs on a same host machine or on different host machines. In some embodiments, a host machine may have multiple MPREs connected to a single MPSE, where each MPRE: in the host machine implements a different LRE:. MPREs and MPSEs are referred to as '"physical" routing/switching element in order to distinguish from "logical" routing/switching elements, even though MPREs and MPSE are implemented in software in some embodiments. In some embodiments, a MPRE is referred to as a
"software router" and a MPSE is referred to a "software switch". In some embodiments, LREs and LSEs are collectively referred to as logical forwarding elements (LFEs), while MPREs and MPSEs are collectively referred to as managed physical forwarding elements (MPFEs).

[0048] In some embodiments, the MPRE 230 includes one or more logical interfaces

(LIFs) that each serves as an interface to a particular segment (L2 segment or VXLAN) of the network. In some embodiments, each LIF is addressable by its own IP address and serve as a default gateway or ARP proxy for network nodes (e.g., VMs) of its particular segment of the network. In some embodiments, all of the MPREs in the different host machines are addressable by a same "virtual" MAC address (or vMAC), while each MPRE is also assigned a "physical" MAC address (or pMAC) in order indicate in which host machine does the MPRE operate.

[0049] The uplink module 270 relays data between the MPSE 220 and the physical

NIC 295. The uplink module 270 includes an egress chain and an ingress chain that each performs a number of operations. Some of these operations are pre-processing and/or postprocessing operations for the MPRE 230. The operations of LIFs, uplink module, MPSE, and MPRE are described in U.S. Patent Application 14/137,862 filed on December 20, 2013, titled "Logical Router", published as U.S. Patent Application Publication 2015/0106804.

[005Θ] As illustrated by Figure 2, the virtualization software 205 has multiple

MPREs for multiple different LREs. In a multi-tenancy environment, a host machine can operate virtual machines from multiple different users or tenants (i.e., connected to different logical networks). In some embodiments, each user or tenant has a corresponding MPRE instantiation of its LRE in the host for handling its L3 routing. In some embodiments, though the different MPREs belong to different tenants, they all share a same vPort on the MPSE 220, and hence a same L2 MAC address (vMAC or pMAC). In some other embodiments, each different MPRE belonging to a different tenant has its own port to the MPSE.

[0051] The MPSE 220 and the MPRE 230 make it possible for data packets to be forwarded amongst VMs 211 -214 without being sent through the external physical network 290 (so long as the VMs connect to the same logical network, as different tenants' VMs will be isolated from each other). Specifically, the MPSE performs the functions of the local logical switches by using the VNIs of the various L2 segments (i.e., their corresponding L2 logical switches) of the various logical networks. Likewise, the MPREs perform the function of the logical routers by using the VNIs of those various L2 segments. Since each L2 segment / L2 switch has its own a unique VNI, the host machine 200 (and its virtualization software
205) is able to direct packets of different logical networks to their correct destinations and effectively segregates traffic of different logical networks from each other.

[0052] Figure 3a illustrates operations of a physical switching element (MPSE) according to some embodiments of the invention. The figure illustrates several example packets from various sources that have arrived at the MPSE 220 of the host machine 200. The MPSE 220 in turn performs switching operations to send those packets to their corresponding destinations. These packets can come from. VMs that are being operates by the virtualization software 205 or traffic from outside of the host machine, including network traffic from PHs for which the host machine 200 is the designated instance.

[0053] Figure 3a illustrates example L2 switching operations for four example packets 31 1 -314 that have arrived at the MPSE 220. These packets arrived at the MPSE through various ports of the MPSE, including ports for the VM 211, the VM 212, the MPREs 230 (vPort 235), and the uplink 270 (to the physical network). Each of these ports is associated with a MAC address. Some of these ports are also associated with a VNI, which identifies the L2 segment associated with the port. In some embodiments, a packet is forwarded to a switch port to be sent out if the packet is tagged as having the same MAC address and VNI as that of the port (e.g., if the destination MAC address and the destination VNI of the packet matches that of the port).

[0054] As illustrated, the port for the VM 21 1 is associated with MAC address

"MAO" and VNI "Ά", and the packet 311 is forwarded there because it has the corresponding destination MAC address "MAC I" and VNI "A". Likewise, the port for the VM 212 is associated with MAC address "MAC4" and VNI "D", and the packet 312 is forwarded there because it has the corresponding destination MAC address "MAC4" and VNI "D". It is worth noting that VNI "A" and VNI "D" belong to different logical networks of different tenants (the logical networks 101 and 102 respectively), and yet they are segregated by the MPSE 220 according to their respective MAC addresses and VNIs.

[0055] The port for the MPREs 230 is associated with a "virtual" MAC address, or vMAC. In some embodiments, every host machine in the network virtualization infrastructure is configured to recognize packets having a destination MAC address "vMAC" as bound for routing by the MPREs of the host machine. In some embodiments, the uplink module of a host machine would override the destination MAC address field of incoming packets from the physical network with "vMAC" in order to ensure that the packet is sent to the MPREs for L3 routing. In the illustrated example, the packet 313 has destination MAC "vMAC", so it is forwarded to the MPREs 230 through the MPRE port 235.
[0056] The port for the uplink 270 is not associated with any particular MAC address or VNI. In some embodiments, packets with MAC addresses that do not match any of the ports of the MPSE would be forwarded to the uplink 270. The packet 314 has MAC address "MAC99", which do not match any of the ports of the MPSE. It is therefore forwarded out of the host machine through the uplink 270 (so perhaps to reach another host machine or physical host).

[0057] Figure 3b illustrates operations of the physical routing elements (MPREs) according to some embodiments of the invention. The figure illustrates several example packets that were forwarded to the MPREs 230 (by the MPSE 220) of the host machine 200. The MPREs 230 in turn performs L3 routing operations on those packets so that the MPSE 220 can forward them to the corresponding destinations.

321-323 that have arrived from the MPSE 220 through the MPRE port 235. These packets all have destination MAC address as "vMAC". The MPREs 230 in turn perform L3 routing operations on the packets 321-323 to produce routed packets 331 -333. The routed packets are return to the MPSE 220 to be forwarded to their destinations.

[0059] As mentioned, each host machine is configured to implement a MPRE for each of the LREs in some embodiments. For the example network virtualization infrastructure 100, each host machine is configured to have MPREs that correspond to LREs alpha, beta, and gamma (the LREs 121-122). Specifically, packets of the logical network 101 would be handled by a MPRE 301 of the LRE alpha (MPRE alpha), packets of the logical network 102 would be handled by a MPRE 302 of the LRE beta (MPRE beta), and packets of the logical network 103 would be handled by a MPRE 303 of the LRE gamma (MPRE gamma). This is unlike the case of MPSE, wherein one physical switching element handles L2 operations of all LSEs, regardless of which tenant / logical network the LSEs belong to.

[0060] In some embodiments, each MPRE has several logical interfaces (LIFs) that are local instantiations of the LIFs of the corresponding LRE:. Each LIF is for interfacing a L2 segment (i.e., LSE) and handling the network traffic to and from the L2 segment. Specifically, the MPRE 301 (alpha) has LIFs A and B for L2 segments 131 and 132 (LSEs A and B), the MPRE 302 (beta) has LIFs C and D for L2 segments 133 and 134 (LSEs C and D), and MPRE 303 (gamma) has LIFs E, F, and G for L2 segments 135-137 (LSEs E, F, and G).

[0061] In some embodiments, each LIF of a MPRE can function as an inbound LIF or an outbound LIF for the MPRE. An inbound LIF is a LIF that is receiving an incoming
packet from its corresponding L2 segment, while an outbound LIF is a LIF that is delivering the routed packet to its corresponding L2 segment. In the illustrated example, LIFs A, C, and G are operating as inbound LIFs, while LIFs B, D, and E are operating as outbound LIFs. In some embodiments, an inbound LIF processes the incoming packet by identifying an outbound LIF for the packet (by e.g., routing table lookup), while the outbound LIF completes the routing operation by identifying the next hop destination MAC address (by e.g., routing table lookup). In other words, the MPRE performs L3 routing by identifying the next hop's (or the destination) VNI as well as the next hop's MAC address by using its LIFs.

[0062] In the example illustrated in Figure 3b, for the packet 321, the MPRE 301 at its inbound LIF A uses the destination IP address "10.10.10.10" to look up its routing table and identifies LIF B as the outbound LIF. The MPRE 301 at its LIF B then identifies a "MAC 10" as the next hop MAC address. The MPRE 301 accordingly produces a routed packet 331 for the next hop, whose destination VNI is "B" and destination MAC address is "MAC 10". Likewise, for the packet 322, the MPRE 302 at its inbound LIF C uses the destination IP address "20.20.20,20" to identify LIF D as the outbound LIF. The MPRE 302 at its LIF D then identifies a "MAC20" as the next hop MAC address and produces the routed packet 332 with VNI "D" and destination MAC address "MAC20" For packet 323, the MPRE 303 at its inbound LIF G uses the destination IP address "30.30.30,30" of the packet 323 to identify its LIF E as the outbound LIF. The MPRE 303 at its LIF E then identifies "MAC30" as the next hop MAC address and produces the routed packet 333 with VNI "E" and destination MAC address "MAC30".

[0063] As mentioned, each LIF corresponds to a L2 segment, i.e., a particular VNI. In some embodiments, such a L2 segment can be an IP subnet, a VXLAN overlay network, or other types of network segments. In some embodiments, such a L2 segment can encompass multiple IP subnets, whether contiguous or disjointed. In some embodiments, each logical interface is assigned its own set of identifiers (e.g., IP addresses or overlay network identifier) that is unique within the network virtuaiization environment 100.

[0064] Figure 4 illustrates the correspondence of LIFs with L2 segments. The figure illustrates LIFs that interface network segments that include one or more IP subnets. As illustrated, some of the network segments (e.g., network segments A and E) include only one IP subnet. A LIF interfacing such a network segment have all of its LIF addresses in one IP subnet. For example, the network segment A only includes network nodes in IP subnet 1.1.1.x, and the LIF addresses for its corresponding LIF (LIF A) are also all in the IP subnet 1.1.1.x (i.e., 1.1.1.251, 1.1.1.252, 1.1.1.253). On the other hand, some of the network
segments include multiple IP subnets. For example, the network segment B includes IP subnets 1.1.2.x and 1.1.12.x, while the segment C includes IP subnets 1.1.3.x, 1.1.13.x, and 1.1 .23.x. In some embodiments, a LIF of a network segment also has LIF IP addresses in those multiple subnets of the network segments. For example, LIF B has IP addresses in IP subnet 1.1.2.x (1.1.2.251) as well as in IP subnet 1.1.12.x (1.1.12.252 and 1 .1.12.253). In some of these embodiments, network nodes in a particular IP subnet uses only LIF addresses in the same IP subnet when accessing the LIF. For example, in some embodiments, VMs in subnet 1.1.14.x of segment D uses only the addresses 1.1.14.252 or 1.1.14.253 to address LIF D but not 1.1.4.251, even though 1.1.4.251 is also an address ofthe same LIF.

[0065] In some embodiments, the IP addresses of a LIF need not correspond exactly with the IP subnets in the LIF's network segment. For example, a LIF may have an IP address that is not in any of the network segment's subnets (e.g., the network segment E does not have IP subnet that encompasses the LIF address 4.10.1.253 in LIF E), or a LIF may have a subnet that does not have at least one LIF address that is in that subnet (e.g., LIF H does not have a LIF address in the subnet 4.1 .14.x).

A of LRE alpha 121 is assigned IP addresses 1.1.1.251, 1.1.1.252, and 1 , 1.1.253, and LIF F of LRE gamma 123 is assigned IP addresses 4. 1.2.251 , 4.1 1 .2.252, and 4, 1 1.2.253. Each of these LIF identifiers can serve as a destination address for network traffic, in other words, the multiple IP addresses (or identifiers) of a LIF allows the LIF to appear as multiple different netw ork traffic destinations. For example, in some embodiments, each LIF IP address serves as an address of a default gateway or ARP proxy for network nodes of its particular network segment. Having multiple IP addresses per LIF provides the network nodes in the corresponding network segments a list of gateways or proxies to choose. IP interfaces of LIFs are described in U.S. Patent Application 14/227,959 filed on March 27, 2014, titled "Ingress ECMP in Network virtualization infrastructure".

[0067] In the examples illustrated in Figures 1-4, all of the LREs and LSEs span all of the host machines. In some embodiments, this means the LIFs ofthe LRE are active across all of the host machines. In some embodiments, a host machine that is spanned by a LSE means that the LSE is active on that host machine, and the MPRE (local instance of LRE) is actively performing routing operations to and from the L2 segment served by the LSE. Furthermore, in the examples illustrated in Figures 1 -4, no two tenants (i.e., no two LREs) share a LSE, have access to a same L2 segment, or use a common VNI. In other words, the
system is able to segregate packet traffic between different tenants/LREs by relying on VNIs, since every VNI uniquely belong to only one logical network / tenant.

[0068] Several more embodiments of the invention are described below?. Section I describes a virtual distributed routing environment in which some of the LSEs span only- some of the host machines. Section II describes a network virtualization infrastructure in which some of the LREs / tenants share one or more VNIs. Section III describes ECMP operations that are based on rewrite MAC or LIF MACs. Section IV describes some of the processes performed in the virtual distributed routing environment. Finally, section V describes an electronic system with which some embodiments of the invention are implemented.

[0069] I. SELECTIVELY ACTIVATED LOGICAL INTERFACES

[0070] As mentioned, a LRE has LIFs for interfacing various L2 segments. In some embodiments, these LIFs are responsible for performing the L3 routing operations by e.g., looking up forwarding tables for determining the next hop. In some embodiments, these L3 routing operations performed by the LIFs require significant computing and storage resources to configure, control, and monitor in order to ensure proper operations. For a L2 segment whose traffic necessarily go through only a subset of host machines of the virtual distributed routing environment, it is advantageous to configure only those host machines in the subset to perform the LIF operations for that L2 segment. However, it is also advantageous to maintain uniform configuration of logical entities (logical routers and logical switches) across ail host machines participating in the virtual distributed routing environment.

[0071] In some embodiments, a LRE can have LIFs that are active in all host machines spanned by the LRE as well as LIFs that are active in only a subset of those spanned host machines. In some embodiments, a LIF that is active in only a subset of host machines while remaining donnant in other host machines is referred to as an intermediate LIF, or iLIF. This is in contrast to ordinary distributed LIF (or dLIF) that is active in all host machines spanned by the LRE. A host machine having an active LIF for a particular L2 segment would perform the L3 routing operations for network traffic related to that L2 segment. A host machine having an inactive LIF for the particular L2 segment would not perform L3 routing operations for the network traffic of the L2 segment.

[0072] As mentioned, a L2 segment can be an overlay network like VXLAN, or a

VLAN IP subnet. In some embodiments, a VXLAN overlay network interconnects VMs that can be provisioned on any of the host machine. A LSE that correspond to a VXLAN is therefore configured to be active on all host machines, and the LIF that correspond to the
VXLAN is active on all host machines to perform the corresponding L3 routing tasks. A L2 segment can also be an IP subnet, i.e., a VLAN. In some embodiments, a VLAN segment is physically confined to a host machine or a subset of the host machines, such as when the VLAN segment is provided by a physically external network that the logical network accesses through an edge. This edge is in some embodiments provided by one host machine or a rack of host machines. The V I associated with the VLAN (i.e., the edge), need only be processed by those edge host machines. In some embodiments, the LIF that corresponds to such a VLAN is active only on those subset of edge host machines.

[0073] Figure 5 illustrates a network virtuaiization infrastructure implementing a virtual distributed routing environment 400 in which a LIF is active in only one of the host machines. The virtual distributed routing environment 400 is implementing a logical network

500 that has a VLAN L2 segment corresponding to an edge 595 to an external network. As illustrated, the logical network 500 includes a LRE 510 interconnecting L2 segments 521, 522, and 529 (served by LSEs for VNIs "J", " K". and "X", respectively). LSEs "J" and "K" serves VMs that can be provisioned on any host machines of the datacenter, while LSE "X" provides the access to the edge 595 to an external network 599.

[0074] The figure also illustrates the logical network 500 being implemented over host machines 501 -504 of the network virtuaiization infrastructure 400. The host machine

501- 504. The LRE has a corresponding LIF for each of the L2 segments (LIF "'J", LIF "K", and LIF "X"). L2 segments 521 and 522 are active in all host machines 501 -504, while the L2 segment 529 is active only on the host machine 501. Correspondingly, LIF J and LIF K are active in all host machines 501-504, while the LIF X is active only in the host machine 501.

[0075] Since the host machine 501 is the only host machine that is physically interfacing the external network 599 and is the only machine where L2 traffic of VNI "X" is conducted (because it is providing the edge 595), the system makes the host machine 501 to be the only host machine at which LIF X is active. In all other host machines, the LIF X is inactive (illustrated with dash lines). Specifically, the MPRE 551 running on the host machine 501 has an active LIF "X", while the MPREs 552-553 running on host machines

502- 504 have inactive LIF "X". In some embodiments, an inactive LIF does not participate in L3 routing operation, and the system therefore need not devote computing and storage resources in controlling and maintaining it.
[0076] As illustrated, the edge 595 serves as the gateway of the logical network 500 with the external network 599. In other words, the edge 595 is not only being accessed by network nodes of VNI "X", but also network nodes on other VNIs "J" and "K". For those VMs of other VNIs running on the host machine 501, the routing is trivial (i .e., similar to those described above by reference to Figure 3) since the LIF for VNI "X" is active on host machine 501 along with LIFs for "J" and "K". However, for VMs that are operating on other host machines 502-504 with inactive LIF X, the traffic destined for the external network 599 still has to go through the edge 595, which is on L2 segment with VNI "X". Some embodiment therefore provide methods or logical conduits that allow traffic from host machines with inactive LIF "X" to reach the L2 segment "X".

[0077] In order to perform L3 routing into a particular VNI that is active only on a subset of the host machine (i.e., a L2 segment whose LIF is an iLIF), some embodiments use a backplane conduit to send traffic from a host machine with an inactive LIF for the particular VNI to a host machine with an active LIF for the particular VNI. Within this backplane conduit, a special L2 MAC address is used to identify the host machine that has the active LIF for the particular VNI in some embodiments. In the example of Figure 5, where VNI "X" has an active LIF in the host machine 501 and inactive LIFs in host machines 502,-504, packets from host machine 502-504 destined for VNI "X" is delivered to the host machine 501 through the backplane conduit.

[0078] Figure 6 illustrates routing by iLIF for a particular VNI from a host machine with an inactive LIF to a host machine with an active LIF. Specifically, the figure illustrates a backplane conduit 690 that is used to deliver a packet from the host machine 502 (where the iLIF for VNI "X" is inactive) to the host machine 501 (where the iLIF for VNI '"X" is active).

[0079] The backplane conduit 690 is a special data conduit for delivering data between host machines. Such a backplane conduit is a software construct implemented by the virtualization software running on the host machines in some embodiments. In some embodiments, such backplane conduit is implemented by packet encapsulation schemes for segregating network traffic between regular data plane and the backplane. In some embodiment, a backplane conduit is implemented as a logical switch that is active only at the host machine with the active LIF.

[0080] In this case, the backplane conduit 690 is used to bring traffic from the MPRE

552 of the host machine 502 to the MPRE 551 of the host machine 501 . As illustrated, the backplane conduit works like a L2 logical switch, it has endpoints or ports that are identified by MAC addresses. In some embodiments, a host machine with an active LIF is assigned a
MAC address so it is uniquely identifiable in the backplane conduit as a destination. Such a MAC address is referred to as a "rMAC"' ("routing" MAC, "re-route" MAC, or "re-write" MAC) in some embodiments. In this case, the host machine 501 as the host machine having an active LIF for VNI "X" is assigned an rMAC, and packets entering the backplane conduit 690 having the rMAC as destination MAC would reach the host machine 501, particularly at its active LIF X.

LIFs. Specifically, the figure illustrates the routing of a packet 610 from VNI "J" to the VNI "X". The packet 610 is produced by the host machine 502 from a VM that is on L2 segment with VNI "J". Its destination IP address is "33.33.33.33". The packet 610 enters the MPRE 552 of the LRE delta at the host machine 502 through LIF "J". LIF "J" performs routing table look up on the IP address "33.33.33.33" and identifies LIF X as the next the next hop. Unfortunately, LIF X is inactive (622) at the host machine 502 / MPRE 552, so the MPRE 552 sends the packet 610 to a backplane LIF 632 for the backplane conduit 690. The backplane LIF 632 rewrite the destination MAC address of the packet 610 such that the rMAC of the active LIF X (621) at the host machine 501 becomes the destination MAC address. The packet then reaches the active LIF X 621 through the backplane based on the rMAC. The LIF X then performs routing table look up and determines that the next hop is MAC address "MAC6" with VNI "X". The routed packet 61 1 is then sent to its destination through the MPSE (not illustrated) of the host machine 501 on the way to its next hop.

[0082] II. DIFFERENT TENANTS SHARING COMMON L2 SEGMENT

[0083] The example of Figures 5-6 illustrates the use of rMAC by only one tenants.

In some embodiments, multiple different tenants (i.e., multiple different LREs) have LIFs that are active on only some of the host machines. When different tenants are each using different, non-overlappmg set of VNIs, the solutions discussed in Section I would extend trivially since a host machine can always distinguish the traffic of different tenants according to their different VNIs. However, in some embodiments, different tenants of a same virtual distributed routing environment (one datacenter or multi-site environment) would share common resources, such as common edge services to an external network, or a common VLAN IP subnet provided by a network service provider. In some embodiments, the same VNI of the common resource is used by the multiple tenants that share the common resource, and the different tenants' corresponding LREs would have active LIFs for the same VNI, even at the same host machine.
[0084] Figure 7 illustrates a network visualization infrastructure in which multiple different LREs have iLlFs for a same VNI. The figure illustrates the network virtualization infrastructure 400 having host machines 501-504 that is implementing the logical network 500 based on the LRE 510 for a first tenant (tenant delta), which has a L2 segment with VNI "X" for providing the edge 595. The same host machines 501-504 are also implementing a second logical network 700 based on a LRE 710 for a second tenant (tenant epsiion). The LRE 710 provides L3 routing between L2 segments 721 and 729. The L2 segment 721 having VNI "L" is for VMs that can be provisioned on any host machine. The L2 segment 729 on the other hand is for accessing the same edge 595 and has the same VNI "X" as the L2 segment 529. In other words, the tenant delta and the tenant epsiion are using a same VNI "X" for accessing a common resource in the edge 595.

[0085] As illustrated, the edge 595 is provided by the host machine 501, and both the tenant delta and the tenant epsiion have an active LIF for VNI '"X"' at the host machine 501. Other host machines 502-504 do not conduct traffic for VNI "X", and LIF X is inactive on those other host machines. Consequently, the MPRE 551 (for tenant delta or LRE 510) and the MPRE 751 (for tenant epsiion or LRE- 710) at the host machine 501 have active LIF X, while MPREs in other host machines (e.g., MPRE 554 and 754 at host machine 504) have inactive LIFs for "X".

[0086] As mentioned, the packets for a LIF that is active on some host machines while dormant on some host machines are delivered by a backplane conduit to a host machine where the LIF is active. However, since two tenants may each have an active LIF with the same VNI on the same host machine, the traffic of the two different tenants have to be segregated. In some embodiments, active LIFs for different tenants have different rMACs, even when the LIFs have the same VNI. In some other embodiments, each tenant has its own backplane conduit such that the traffic to active LIFs belonging to different tenants / LREs are segregated by their respective conduits.

[0087] Figure 8 illustrates a backplane conduit 810 that is shared by different tenants, where LIFs of different tenants, even if for a same VNI, have different rMACs. As illustrated, the network virtualization infrastructure 400 is implementing a backplane conduit 830. The conduit 810 allows control plane access to various host machines, including the MPREs of various LREs/tenants/logical networks. As illustrated, both the MPRE 554 of the tenant delta and the MPRE 754 of the tenant epsiion can inject packets into the backplane conduit, and both the MPRE 551 of the tenant delta and the MPRE 751 of the tenant epsiion (at the host machine 501 having the edge 595) can receive packets from the backplane conduit 810.
Specifically, the MPRE delta 551 is associated with rMAC "rMACl", while the MPRE epsilon is associated with rMAC "'rMAC2". In other words, the edge host machine 501 is able to distinguish packet traffic destined for LIF X of tenant delta from packet traffic destined for LIF X of tenant epsilon, even through they are both LIFs of a same L2 segment with the same VNI "X".

[0088] Figure 9 illustrates how the different rMACs are used to segregate traffic between different tenants in a common backplane conduit. Specifically, the figure shows the L3 routing of packet 910 and 920 through the network virtualization infrastructure 400, the packet 910 belonging to the tenant delta while the packet 920 belonging to the tenant epsilon. Both packets 910 and 920 are identified as packets to be routed by iLIFs with VNI "X" (according to forwarding table), as they are both destined for the edge 595. The packet 910 reaches its active LIF X in MPRE 551 of the edge host machine 501 through the backplane conduit 810 by using "rMACl". The packet 920 reaches its active LIF X in MPRE 751 of the edge host machine 501 through the backplane conduit 810 by using "rMAC2".

[0089] In some embodiments, it is advantageous to avoid assigning too many new

MAC addresses for forwarding packets to active LIFs from inactive LIFs. In some embodiments, each tenant or LRE has its own backplane conduit such that different tenants can safely use the same rMAC address without blending backplane traffic belonging to different tenants.

[0090] Figure 10 illustrates LREs that each has its own backplane conduit such that a same rMAC can be used by different LREs (specifically by their iLIFs). As illustrated, the network virtualization infrastructure 400 is implementing a backplane conduit 811 for the tenant delta and a separate backplane conduit 812 for the tenant epsilon. The backplane conduit 811 inter connects the MPREs (or their LIFs) of the different host machines for the LRE 5 10 (for tenant delta). The backplane 812 inter connects the MPREs (or their LIFs) of the different host machines for the LRE 710 (for tenant epsilon). MPRE 551 and the MPRE 751 are operated by the same host machine 501, which also operates the edge 595. The MPRE 551 uses a particular rMAC ("rMAC3") to receive packets from the backplane conduit 81 1, and the MPRE 751 uses the same particular rMAC ("rMAC3") to receive packets from the backplane conduit 812.

[0091] Figure 11 illustrates how the different backplane conduits are used to segregate traffic between different tenants while using the same rMAC. Specifically, the figure shows the L3 routing of packet 1110 and 1120 through the network virtualization infrastructure 400, the packet 1110 belonging to the tenant delta while the packet 1120

2.0
belonging to the tenant epsiion. Both packets 11 10 and 1120 are identified as packets to be routed by iLIF with VNI "X" (according to forwarding table), as they are both destined for the edge 595. The packet 1110 reaches its active LIF X in MPRE 551 of the edge host machine 50 ! through the backplane conduit 811 by using "rMAC3". The packet 1 120 reaches its active LIF X in MPRE 751 of the edge host machine 501 through the backplane conduit 812 by using same "rMAC3". Thus, though both the MPRE 551 and the MPRE 751 are operated by the same edge host machine 501 , and that both have active LIF with the same VNI (LIF X), the packets can still reach their respective LIF X because they are delivered by different backplane conduits.

[0092] III. ECMP USING REDIRECT ADDRESSES

[0093] The rMAC as described in Section Π above allows packets that need to be routed by a particular iLIF to be forwarded to a host machine where that particular iLIF is active. As described above, such rMACs serve to identify the host machine that operates the active LIF. In some embodiments, an iLIF can be active in multiple host machines. For each of such host machines, some embodiments assign a unique MAC. In other words, for a given iLIF, each of its active LIFs (or each of the host machines that operate an active LIF of the iLIF) is uniquely identifiable by such MACs. In some embodiment, such MACs are referred as IMACs (LIF MACs) as each 1MAC is for identifying an active LIF. For some embodiments, either lMAC or rMAC can be used for redirecting traffic for an iLIF from a host machine on which the iLIF is dormant to a host machine on which the iLIF is active according to some embodiments described in Section II above.

[0094] As mentioned earlier by reference to Figure 4, each LIF has a set of IP interfaces. In some embodiments, each IP interface of a LIF is associated with a host machine, which serve as a designated instance for handing traffic and ARP operations associated with the IP interface. In some embodiments, each IP interface of a LIF is assigned a unique lMAC. In other words, each host machine serving as a designated instance for an IP interface of a LIF has an assigned lMAC.

[0095] Figure 12 illustrates the assignment of lMAC for each IP interface of each

LIF. The figure illustrates the assignment of IMACs to various IP interfaces of various LIFs for both the LRE delta (510) and the LRE epsiion (710). As illustrated, LRE delta has LIFs for L2 segments "'J'1, "K", and "X", and LRE epsiion has LIFs for L2 segments "L" and "X". LIF J of LRE delta has three IP interfaces that are each assigned a lMAC ("lmacj l ", "lmacJ2", "lmacJ3"). LIF K of LRE delta has two IP interfaces that are each assigned a
1MAC ("lmac kl", "lmac k2"), and LIF L of LRE epsilon also ahs two IP interfaces that are each assigned a 1MAC ("imac__Ll", "lmac L2").

[0096] Both LRE delta 510 and LRE epsilon 710 has a LIF for the L2 segment "X" for accessing the edge. The LIF X for LRE delta 5 0 has two IP interfaces (1.1.3.251, 1.1.13.251) and the LIF X for LRE epsilon 710 has three IP interfaces (4.1.2.251, 4.11.2.252, and 4.11.2.253). Each of the two IP interfaces of LIF X of LRE delta has an AC ("lmac_xl_delta", "lmac_x2_delta"), and each of the three IP interfaces of LIF X of LRE epsilon has an 1MAC ("lmac xl epsilon", "lmac x2 epsilon", "lmac x3 epsilon").

[0097] Figure 12 also illustrates the implementation of the LREs 510 and 710 at a network virtualization infrastructure 1200 that includes host machines 1201-1205. As illustrated, the LRE 510 for the tenant delta spans all host machines 1201-1205, along with LSEs 521 and 522 (for L2 segments "J" and "K"). Similarly, the LRE 710 for the tenant epsilon spans all host machines 1201-1205, along with LSE 721 (for L2 segments "L"). LIFs J, K and L are ordinary distributed LIFs that are active in all host machines spanned by their corresponding LREs.

[0098] LIF X is an iLIF for both LRE delta and LRE epsilon. It is active on only some of host machines, specifically only on host machines that host edge services. Unlike the network virtualization infrastructure 400 that has only one edge host, the network virtualization infrastructure 1200 has three edge hosts 1201-1203 hosting edges 1291-1293. These three hosts all provide edge service to an external network over the same L2 segment with VNI "X". For each LRE / tenant, each edge host is associated with one of the IP interfaces of LIF X, and the active LIF of each edge host is associated with an 1MAC. Specifically, for LRE delta, the edge host 1201 provides IP interface for "1.1.3.251" and the edge host 1202 provides IP interface for "1.1.13.251". LIF X at edge host 1201 is associated with AC "lmac_xl_delta", and at edge host 1202 is associated with AC "lmac x2 delta". For LRE epsilon, the edge host 1201 provide IP interface for "4.1.2.251", the edge host 1202 provide IP interface for "4.11.2.252", and the edge host 1203 provide IP interface for 4.1 1.2.253". LIF X at edge host 1201 is associated with MAC "lmac_xl_epsilon", at edge host 1202 is associated with MAC "lmac_x2_epsilon", and at edge host 1203 is associated with MAC "lmac x3 epsilon".

[0099] As mentioned, in some embodiments, a rMAC is used to identify a host machine with the active LIF for an iLIF so that packets can be forwarded to the host machine with die active LIF to complete routing. Since MAC uniquely identifies each IP interface of each LIF, an MAC can also be used to identify active LIFs when using iLIFs for routing.
Specifically, in some embodiments, IMAC is used as the destination MAC for the backplane conduit. In addition, IMACs can be used to segregate traffic between different tenants, even traffic for the L2 segment with the same VNI. Furthermore, since different IP interfaces of a same LIF are assigned different IMACs, an IMAC can be used to select an IP interface from among several available IP interfaces for ECMP (equal cost multi-path) purposes.

[00101] Since each IMAC for each of the IP interfaces /' active LIFs is unique, the backplane conduit 1310 is able to deliver packet to their correct destination, even though these active LIFs belong to different tenants using the same VNI. Specifically, since "lmac_xl_delta" and "lmac_x2_delta" belong to the tenant delta and "lmac_xl_epsilon", ''lmac x2 epsilon", and "lmac x3 epsilon" belong to tenant epsilon, the backplane conduit would always be able to segregate the traffic of the two tenants.

[00102] As mentioned, in some embodiments, it is advantageous to conserve the number of MAC addresses used in the system. Some embodiments therefore assign iLIFs of different tenants to use the same IMAC addresses. For some these embodiments, each LRE / tenant has its own backplane conduit as described above by reference to Figures 10 and 11. When iLIF traffic of each tenant uses its own backplane conduit, different tenants may use the same IMAC addresses and still achieve traffic segregation.

[00103] As illustrated, the network virtualization infrastructure 1200 has three edges 1291-1293 to an external network. In some embodiments, this means the logical networks implemented on the environment 1200 have multiple available paths for accessing the external network. Each host machine (1204 or 1205) having inactive LIF X can perform ECMP and select one of the three active LIF X's in order to select one of three edges 1291- 1293. As each of these edges is uniquely accessible by an IMAC (associated with the active LIF operating on its host machine), the ECMP is conducted to select one of the IMACs that are associated an active LIF. In some embodiments, this ECMP process selects one of the
IMACs randomly. In some embodiments, the ECMP process makes its selection decision based on load balancing considerations, for example, to balance the load among the available next hops (in this case, among the three edges 1291-1293 or the three edge host machines 1201-1203),

[00104] Figure 14 illustrates ECMP based on IMACs for selecting one of the edges of the network virtiialization infrastructure 1200. Specifically, the figure shows a MPRE 1264 operating on the host machine 1204 for the LRE epsilon 710 performing ECMP when sending packets to host machines with active iLIF "X". This ECMP is based on the set of IMACs that are available for the tenant epsilon when selecting one of the edges 1291-1293 as mentioned above. For illustrative simplicity, this figure illustrates only tenant epsilon.

[00105] As illustrated, the MPRE 1264 receives a packet 1410 from the MPSE (not illustrated) of the host machine 1204. The packet has a source VNI "L", so it is initially- forwarded to the LIF "L" of the MPRE 1264. LIF "L" identifies the packet as requiring routing by LIF X based on the packet's destination IP address "66.66.66.66". Since LIF X is an iLIF that is inactive at the host machine 1204, the MPRE 1264 sends the packet to a host machine with an active LIF X to be routed. The MPRE 1264 is operating an ECMP module 1450 (which can be a software process running in the virtualization software) for LIF X. The LIF X ECMP has a table of available active LIFs for the LIF X that are each identified by its assigned 1MAC. In some embodiments, this table of IMACs is accumulated from ARP operations performed for each of the IP interfaces of LIF X for tenant epsilon. The ECMP process selects one of the IMACs for LIF X of tenant epsilon and use that as the destination address for the packet 1410. The packet is then sent off using the backplane conduit (e.g, 1310) to reach one of the edge host machines with active LIF X based on the selected lMAC. (In the example illustrated in Figure 14, "lMAC_X2_epsilon" is selected so the packet 1410 is sent to the host 1202).

[00106] In some embodiments, a network virtualization infrastructure can have multiple different sets of physical resources, such as multiple different VLAN segments. Each of these VLAN segment in some embodiments span only a subset of the host machine, and therefore each has a corresponding iLIF that is active only in its corresponding subset of host machines. In some embodiments, a MPRE performs ECMP for each iLIF (i.e., for each VLAN) when redirecting packets from a host machine with inactive LIF to a host machine with an active LIF.

[00107] Figure 15 illustrates a logical network 1510 that is implemented over a network virtualization infrastructure 1500 that has multiple different physical resources (e.g.
access to different VLANs). Each of these physical resources has own L2 segment. These physical resources are limited to only a subset host machines, so their corresponding L2 segments interface the LRE by iLIFs that are active on only a subset of host machines.

[00108] The host machines of the network virtualization infrastructure 1500 includes host machines 1501-1505. These host machines implementing a logical network 1590 for a tenant "omega". The logical network 1590 has an LRE 1510 (LRE omega), LSEs for L2 segments "M", "N", "X", and "Y" (LSEs 1521, 1522, 1528, and 1529, respectively). The LRE- 1510 spans host machines 1501-1505. LSEs for "M" and "N" are distributed and their corresponding LIFs on the LRE 1510 are active on all host machines 1501-1505. LSE "X" and LSE 'Ύ" are VLAN physical resources that are limited to a subset of the host machines, and their LIFs are iLIFs that are active in those host machines only. Specifically, the LSE '"X" spans only host machines 1501-1502, and its corresponding LIF X is only active on those two host machines. LSE "Y" spans only host machines 1502-1504, and its corresponding LIF Y is only active on those three host machines. (The host machine 1502 has physical resources for both L2 segment "X" and 'Ύ".) Each host machine with an active LIF for the L2 segment "X" has a IMAC associated with its LIF X ('1MAC_Xl_omega'' and "lMAC_X2_omega" for LIF X at host machines 1501 and 1502). Each host machine with an active LIF for the L2 segment 'Ύ" also has a IMAC associated with its LIF Y ("I MAC Y ! omega". ' IMAC Y2 omega ", and "lMAC_Y3_omega" for LIF Y at host machines 1502, 1503, and 1504).

[00109] The host machine 1505 therefore has an array of choices when redirecting packets for routing for either iLIF X or iLIF Y. As illustrated, the MPRE for the LRE 1510 at the host machine 1505 has two ECMP modules 1551 and 1552. The ECMP module 1551 has a table 1561 of available IMAC addresses for iLIF X, while the ECMP module 1552 has a table 1562 of available IMAC addresses for iLIF Y. It is worth noting that since IMAC address is assigned per IP interface per LIF, active LIFs for different L2 segments (VLANs) on a same host machine would therefore have different IMACs. In the example of Figure 15, the host machine 1502 has active LIFs for both iLIF X and iLIF Y . However, since the active LIF for iLIF X has a different IMAC than the IMAC for the active LIF for iLIF Y ("lMAC_X2_omega" versus "lMAC_Yl_omega"), the host machine 1502 would be able to correctly direct backplane conduit traffic to the correct active LIF.

[00110] IV. SYSTEM OPERATIONS

[00111] As mentioned, a host machine forwards packets that need to be L3 routed from a L2 switch (MPSE) to one of the host machine's MPREs. Since virtualization software
operates different MPREs for different tenants LREs, for each incoming packet, some embodiments identify the correct MPRE (i.e., of the correct LRE / tenant) to perform the L3 routing on the packet. Figure 16 conceptually illustrates a process 1600 performed by a host machine for identifying the correct MPRE for L3 routing. In some embodiments, this is performed a the vPort between the MPSE and the MPREs (e.g., the Port 235).

[00112] The process starts when it receives (at 1610) a packet from the MPSE. The process then identifies (1620) the packet's destination MAC address. As mentioned, in order for the MPSE to send a packet to the MPREs for L3 routing, the packet's DA (destination MAC address field) must be vMAC. However, some embodiments preserve the original destination MAC address in a metadata tag that travels with the packet to the MPREs (i.e., the process 1600). This original MAC address can be rMAC, 3MAC, or some other special purpose MAC address.

[00113] Next, the process identifies (at 1630) a destination VNI and a source VNI of the packet. In some embodiments, these information can either be found in the metadata tag of the packet or determined from the packet header itself. In some embodiments, the packets that come from the backplane conduit would have a special VNI identifying the packets as being from the backplane conduit.

[00114] The process then identifies (at 1640) the LRE or tenant based on the identified VNIs and the (original) destination MAC. For packets that come from a LRE-specific backplane conduit (as described by reference to Figure 10 above), the process identifies the correct MPRE based on the identity of the backplane conduit. For packets that come from a backplane conduit that is shared by all tenants, the process identifies the correct MPRE by the destination MAC address, which identifies a specific LIF belonging to a specific LRE/tenant on the host machine. For packets that do not come from, backplane conduit, the process identifies the LRE/tenant based on the source and destination VNIs. In some embodiments, tliis LRE/tenant identification operation is performed according to a hash of the VNIs and MAC addresses.

[00115] Next, the process directs (at 1650) the packet to the correct MPRE to be routed. This MPRE is the local instance of the identified LRE, The process 1600 then ends.

[00116] Once the packet reaches the correct MPRE (of the correct tenant / LRE), the MPRE proceeds to perform L3 routing. Figure 17 conceptually illustrates a process 1700 for L3 routing by an MPRE of a host machine. The process starts when it receives (at 1710) a packet from the MPSE. In some embodiments, the MPRE receiving this packet is identified to be the correct MPRE according to the process 1600.
[00117] The process 1700 identifies (at 1710) an inbound LIF based on the source VNI of the packet. The process then identifies (at 1720) an outbound LIF based on the destination VNI or the destination IP address. By identifying the outbound LIF, the process determines the L2 segment that the packet is destined for after the L3 routing. In some embodiments, the process (i.e., the MPRE) identifies the outbound LIF by looking up a routing table that informs the MPRE which outbound LIF should be used to complete the L3 routing process.

[00118] Next, the process determines (at 1740) whether the identified outbound LIF is active on this host machine. If so, the process proceeds to 1770. If the identified outbound LIF is inactive at this host machine, the process proceeds to 1750 to redirect the packet to the active LIF (for the iLIF).

[00119] At 3750, the process identifies a host machine at which the identified outbound LIF is active. In some embodiments when there are multiple host machines with active LIFs, this operation involves performing an ECMP process to select one of several available IMACs or rMACs as the destination MAC address for the packet. The process then sends (at 1760) the packet with either 1MAC or rMAC by using the backplane conduit of the LRE as described above. After sending the packet through backplane, the process 1700 ends.

[00120] At 1770, the process forwards the packet to the identified outbound LIF (which is active). The process then identifies (at 3780) the L2 destination address based on the destination IP address. In some embodiments, the process performs this operation at the outbound LIF by using a routing table. The process then returns ( 1790) the routed packet to the MPSE to be forwarded based on the destination MAC. The process 1700 then ends.

[00121] In some embodiments, in order to implement a network virtualization mfrastracture, a network manager of a datacenter would configure the host machines to implement the LREs and LSEs of various logical networks for various tenants. In some embodiments, the network manager also assigns rMACs to host machines at which iLIF is active. Figure 18 conceptually illustrates a process 1800 for configuring the host machines of a datacenter to implement logical networks with iLIFs that use rMAC to redirect traffic from host machine with inactive LIF to host machine with active LIF. The process generates a set configuration data for the host machines in the virtual distributed routing environment,

[00122] Tlie process 1800 starts when the network manager receives specifications for provisioning logical networks for tenants on the host machines of the datacenter. The process identifies (at 1810) a logical network for a tenant of the datacenter. The process then identifies (at 1820) a logical router (LRE) for the tenant or logical network.
[00123] Next, the process identifies (at 1830) a logical switch for the tenant / logical network. The process then determines (at 1840) whether the identified logical switch (i.e., L2 segment) should be active in only a subset of the host machines. As mentioned, some embodiments include L2 segments that are physical VLANs. Some physical VLANs do not need to span all host machines of the logical network, since these physical VLANs are physically confined to certain dedicated host machines such as edge hosts. If the identified L2 segment should be active in all host machines, the process proceeds to 1845. If the identified L2 segment should be limited to only a subset of the host machines, the process proceeds to 1850.

[00124] At 1845, the process makes the corresponding LIF of the L2 segment active in all host machines (i.e., as a dLIF). The process then proceeds to 1880.

[00125] At 1850, the process identifies host machines at which the logical switch should be active (e.g., to identify the host machines in the edge rack). The process then makes (at 1860) the logical switch active in those identified subset of host machines while leaving others inactive. In some embodiments, the LRE (and its LIFs and LSEs) are provisioned by- one uniform set of configuration data that is provided to all host machines implementing the logical network. In some of these embodiments, for each LIF of the LRE, the configuration data identifies the host machines for which the LIF is to be active (or inactive).

[00126] The process also assigns (at 1870) a unique rMAC for each identified hos machine. In some embodiments, such rMAC assignment is embedded in the configuration data that is provided to all host machines. In some embodiments, the process configures each identified host machine with the assigned rMAC. The process then proceeds to 1880.

[00127] At 1880, the process generates configuration data for the logical switch that will be used to configure the host machines in subsequent operations. The process then determines (at 1885) whether there is another logical switch for the identified tenant. If so, the process returns to 1830 to provision another logical switch. If there is no other logical switch that is yet to be provisioned, the process proceeds to 1890.

[00128] At 1890, the process configures the host machines of datacenter to implement the logical router /' logical network for the tenant. In some embodiments, the configuration data for logical switches and their corresponding LIFs is also delivered to the host machines as part of the configuration data for the logical router. The process then determines (at 1895) if there is another logical network for a tenant to be provisioned. If so, the process returns to 1810 to provision the other tenant. Otherwise, the process 1800 ends.
[00129] In addition to or instead of assigning rMACs to host machines where iLIFs are active, a network manager in some embodiments assigns IMACs to IP interfaces of LIFs. Figure 19 conceptually illustrates a process 1900 for configuring host machines of a datacenter and assigning an MAC to each IP interface of each LIF. The process starts when the network manager receives specifications for provisioning logical networks on the host machines of the datacenter. The process then identifies (at 1910) a logical network for a tenant of the datacenter. The process then identifies (at 1920) a logical router (LRE) for the logical network.

[00131 ] The process then identifies (at 3940) a logical interface (LIF) of the logical switch. In some embodiments, only iLIFs are assigned IMACs, and so the process 1900 identifies only iLIFs, i.e., only L2 segments that are active in some host machine but not others. In some embodiments, all LIFs are assigned IMACs, so the process would identify all LIFs regardless of its type.

[00132] The process then identifies (at 1950) the IP interfaces of the identified LIF. For each identified interface of the LIF, the process selects a host machine to be the designated instance for handling the traffic (such as ARP request) targeting the IP interface. The process then assigns (at 1970) a unique MAC address to each IP interface's of the LIF (i.e., assigning an 1MAC address to each designated instance host machine for the IP interface). In some embodiments, the process assigns 1MAC addresses that are not used by- other tenants / logical networks. In some embodiments, the process reuse/recycle MAC addresses that are already in use by other tenants / logical networks in order to avoid MAC address proliferation.

[00133] The process then determines (at 1975) if there is another LIF for the logical switch for which IMACs have not been assigned. In some embodiments, only iLIFs are assigned IMACs, so the process only identifies iLIFs. If there is another LIF that should be assigned AC but has yet to be, the process returns to 1940. Otherwise, the process proceeds to 1980.

[00134] At 1980, the process generates configuration data for the logical switch that will be used to configure the host machines in subsequent operations. The process then determines (at 1985) whether there is another logical switch for the identified tenant. If so, the process returns to 1830 to provision another logical switch. If there is no other logical switch that is yet to be provisioned, the process proceeds to 1990.
[00135] At 1990, the process configures the host machines of the datacenter to implement the logical router / logical network for the tenant. In some embodiments, the configuration data for logical switches and their corresponding LIFs is also delivered to the host machines as part of the configuration data for the logical router. The process then determines (at 1995) if there is another tenant / logical network to be provisioned. If so, the process returns to 1910 to provision the otlier logical network. Ottierwise, the process 1900 ends.

[00136] V. ELECTRONIC SYSTEM

[00137] Many of the above-described features and applications are implemented as software processes that are specified as a set of instructions recorded on a computer readable storage medium (also referred to as computer readable medium). When these instructions are executed by one or more processing unit(s) (e.g., one or more processors, cores of processors, or other processing units), they cause the processing unit(s) to perform the actions indicated in the instractions. Examples of computer readable media include, but are not limited to, CD- ROMs, flash drives, RAM chips, hard drives, EPROMs, etc. The computer readable media does not include carrier waves and electronic signals passing wirelessly or over wired connections.

[00138] In this specification, the term "software" is meant to include firmware residing in read-only memory or applications stored in magnetic storage, which can be read into memory for processing by a processor. Also, in some embodiments, multiple software inventions can be implemented as sub-parts of a larger program while remaining distinct software inventions. In some embodiments, multiple software inventions can also be implemented as separate programs. Finally, any combination of separate programs that together implement a software invention described here is within the scope of the invention. In some embodiments, the software programs, when installed to operate on one or more electronic systems, define one or more specific machine implementations that execute and perform the operations of the software programs.

[00139] Figure 20 conceptually illustrates an electronic system 2.000 with which some embodiments of the invention are implemented. The electronic system 2000 can be used to execute any of the control, virtualization, or operating system applications described above. The electronic system 2000 may be a computer (e.g., a desktop computer, personal computer, tablet computer, server computer, mainframe, a blade computer etc.), phone, PDA, or any oilier sort of electronic device. Such an electronic system includes various types of computer readable media and interfaces for various other types of computer readable media. Electronic
system 2000 includes a bus 2005, processing unit(s) 2010, a system memory 2025, a readonly memory 2030, a permanent storage device 2035, input devices 2040, and output devices 2045.

[00140] The bus 2005 collectively represents all system, peripheral, and chipset buses that communicatively connect the numerous internal devices of the electronic system 2000. For instance, the bus 2005 communicatively connects the processing unit(s) 2010 with the read-only memory 2030, the system, memory 2025, and the permanent storage device 2035.

[00141] From these various memory units, the processing unit(s) 2010 retrieves instructions to execute and data to process in order to execute the processes of the invention. The processing unit(s) may be a single processor or a multi-core processor in different embodiments.

[00142] The read-only-memory (ROM) 2030 stores static data and instructions that are needed by the processing unit(s) 2010 and oilier modules of the electronic system. The permanent storage device 2035, on the other hand, is a read -and- write memory device. This device is a non-volatile memory unit that stores instructions and data even when the electronic system 2000 is off. Some embodiments of the invention use a mass-storage device (such as a magnetic or optical disk and its corresponding disk drive) as the permanent storage device 2035.

[00143] Other embodiments use a removable storage device (such as a floppy disk, flash drive, etc.) as the permanent storage device. Like the permanent storage device 2035, the system, memory 2025 is a read-and-write memory device. However, unlike storage device 2035, the system memory is a volatile read-and-write memory, such a random access memory. The system memory stores some of the instructions and data that the processor needs at rantime. In some embodiments, the invention's processes are stored in the system memory 2025, the permanent storage device 2035, and/or the read-only memory 2030, From these various memory units, the processing unit(s) 2010 retrieves instructions to execute and data to process in order to execute the processes of some embodiments.

[00144] The bus 2005 also connects to the input and output devices 2040 and 2045.

The input devices enable the user to communicate information and select commands to the electronic system. The input devices 2040 include alphanumeric keyboards and pointing devices (also called "cursor control devices'1). The output devices 2045 display images generated by the electronic system. The output devices include printers and display devices, such as cathode ray tubes (CRT) or liquid crystal displays (LCD). Some embodiments include devices such as a touchscreen that function as both input and output devices.
[00145] Finally, as shown in Figure 20, bus 2005 also couples electronic system 2000 to a network 2065 through a network adapter (not shown). In tins manner, the computer can be a part of a network of computers (such as a local area network ("LAN"), a wide area network ("WAN"), or an Intranet, or a network of networks, such as the Internet. Any or all components of electronic system 2000 may be used in conjunction with the invention.

[00146] Some embodiments include electronic components, such as microprocessors, storage and memory that store computer program instructions in a machine-readable or computer-readable medium (alternatively referred to as computer-readable storage media, machine -readable media, or machine-readable storage media). Some examples of such computer-readable media include RAM, ROM, read-only compact discs (CD-ROM), recordable compact discs (CD-R), rewritable compact discs (CD-RW), read-only digital versatile discs (e.g., DVD-ROM, dual-layer DVD-ROM), a variety of recordable/rewritable DVDs (e.g., DVD-RAM, DVD-RW, DVD+RW, etc.), flash memory (e.g., SD cards, mini- SD cards, micro-SD cards, etc.), magnetic and/or solid state hard drives, read-only and recordable Blu-Ray® discs, ultra density optical discs, any other optical or magnetic media, and floppy disks. The computer-readable media may store a computer program that is executable by at least one processing unit and includes sets of instructions for performing various operations. Examples of computer programs or computer code include machine code, such as is produced by a compiler, and files including higher-level code that are executed by a computer, an electronic component, or a microprocessor using an interpreter.

[00147] While the above discussion primarily refers to microprocessor or multi-core processors that execute software, some embodiments are performed by one or more integrated circuits, such as application specific integrated circuits (ASICs) or field programmable gate arrays (FPGAs). In some embodiments, such integrated circuits execute instructions that are stored on the circuit itself.

[00148] As used in this specification, the terms "computer", "server", "processor", and

"memory" all refer to electronic or other technological devices. These terms exclude people or groups of people. For the purposes of the specification, the terms display or displaying means displaying on an electronic device. As used in this specification, the terms "computer readable medium," "computer readable media," and "machine readable medium" are entirely restricted to tangible, physical objects that store information in a form that is readable by a computer. These terms exclude any wireless signals, wired download signals, and any other ephemeral signals.
[00149] In this document, the term "packet" refers to a collection of bits in a particular format sent across a network. One of ordinar - skill in the art will recognize that the term packet may be used herein to refer to various formatted collections of bits that may be sent across a network, such as Ethernet frames, TCP segments, UDP datagrams, IP packets, etc.

[00150] This specification refers throughout to computational and network environments that include virtual machines (VMs). However, virtual machines are merely one example of data compute nodes (DCNs) or data compute end nodes, also referred to as addressable nodes. DCNs may include non-virtualized physical hosts, virtual machines, containers that run on top of a host operating system without the need for a hypervisor or separate operating system, and hypervisor kernel network interface modules.

[00151 ] VMs, in some embodiments, operate with their own guest operating systems on a host using resources of the host virtualized by virtualization software (e.g., a hypervisor, virtual machine monitor, etc.). The tenant (i.e., the owner of the VM) can choose which applications to operate on top of the guest operating system. Some containers, on the other hand, are constructs that run on top of a host operating system without the need for a hypervisor or separate guest operating system. In some embodiments, the host operating system, uses name spaces to isolate the containers from each other and therefore provides operating-system level segregation of the different groups of applications that operate within different containers. This segregation is akin to the VM segregation that is offered in hypervisor-virtnalized environments that virtuaiize system hardware, and thus can be viewed as a form of virtualization that isolates different groups of applications that operate in different containers. Such containers are more lightweight than VMs.

[00152] Hype isor kernel network interface modules, in some embodiments, is a non-

VM DCN that includes a network stack with a hypervisor kernel network interface and receive/transmit threads. One example of a hypervisor kernel network interface module is the vmknic module that is part of the ESXi™ hypervisor of VMware, Inc.

[00153] One of ordinary skill in the art will recognize that while the specification refers to VMs, the examples given could be any type of DCNs, including physical hosts, VMs, non-VM containers, and hypervisor kernel network interface modules. In fact, the example networks could include combinations of different types of DCNs in some embodiments.

[00154] While the invention has been described with reference to numerous specific details, one of ordinary skill in the art will recognize that the invention can be embodied in oilier specific forms without departing from the spirit of the invention. In addition, a number
of the figures (including Figures 16, 17, 18, and 19) conceptually illustrate processes. The specific operations of these processes may not be performed in the exact order shown and described. The specific operations may not be performed in one continuous series of operations, and different specific operations may be performed in different embodiments. Furthermore, the process could be implemented using several sub-processes, or as part of a larger macro process. Thus, one of ordinary skill in the art would understand that the invention is not to be limited by the foregoing illustrative details, but rather is to be defined by the appended claims.

Claims

CLAIMS What is claimed is

1. A method of operating a logical network over a plurality of host machines, the method comprising:

at a first host machine of the plurality of host machines, operating a set of VMs and a managed physical routing element (MPRE) for routing packets for the set of VMs, wherein the MPRE is a local instance of a logical routing element (LRE) for routing packets between different segments of the logical network, the LRE comprising a plurality of logical interfaces (LIFs), each LIF for interfacing with a different segment of the logical network;

receiving, at the first host machine, a packet that is destined for a particular segment of the network;

identify a LIF associated with the particular segment of the network;

using the MPRE of the first host machine to perform L3 routing on the received packet when the identified LIF is active at the first host machine; and

forwarding the packet to be routed by a second host machine when the identified LIF is dormant at the first host machine but active at the second host machine.

2. The method of claim 1, wherein forwarding the packet to be routed by the second host machine comprises overwriting a destination MAC address of the packet with a rMAC address associated with the second host machine.

3. The method of claim 1, wherein the second segment is confined to a subset of the host machines, wherein the host machines in the subset of host machines are for providing edge services to an external network.

4. The method of claim 3, wherein host machines not in the subset of host machines do not provide edge services to the external network.

5. The method of claim 3, wherein the second segment is a VLAN IP subnet.

6. The method of claim 1, wherein the first segment is an overlay logical network.

7. A method of operating a logical network over a network virtualization infrastructure that comprises a plurality of host machines operating a set of virtual machines (VMs), the method comprising:

defining a logical routing element (LRE:) for routing packets between different segments of the logical network, wherein each host machine operates a local instance of the LRE as a managed physical routing element (MPRE) for routing packets for the set of VMs,
the LRE comprising a plurality of logical interfaces (LIFs), each LIF for interfacing with a different segment of the logical network, wherein a first LIF is defined to be dormant in a first host machine and active in a second host machine while a second LIF is defined to be active in each of the plurality of host machines,

wherein, for a packet originating from the first host machine, the first host machine is for (i) forwarding the packet to be routed by the second host machine's MPRE when the packet is destined for a first segment interfacing the first LIF and (ii) routing the packet locally at the first host machine's MPRE when the packet is destined for a second segment interfacing the second LIF;

generating configuration data based on the defined LRE and configuring the plurality of host machines by using the generated configuration data,,

8. The method of claim 7, wherein the second segment is confined to a subset of the host machines.

9. The method of claim 8, wherein the host machines in the subset of host machines are for providing edge sendees to an external network.

10. The method of claim 9, wherein host machines not in the subset of host machines do not provide edge services to the external network.

1 1. The method of claim 8, wherein the second segment is a VLAN IP subnet.

12. The method of claim 7, wherein the first segment is an overlay logical network.

13. The method of claim 7, wherein forwarding the packet to be routed by the second host machine comprises overwriting a destination MAC address of the packet with a rewrite MAC address associated with the second host machine.

14. A method of operating a logical network over a plurality of host machines, the method comprising:

at a particular host machine of the plurality of host machines, operating a first MPRE (managed physical routing element) and a second MPRE, wherein the first MPRE is a local instance of a first LRE (logical routing element) for routing packets between different segments of a first logical network and the second MPRE is a local instance of a second LRE for routing packets between different segments of a second logical network;

wherein the first LRE comprises a first set of LIFs (logical interfaces) for interfacing with a first set of network segments and the second LRE comprises a second set of LIFs for interfacing with a second set of network segments, wherein each LIF is identified by a network segment identifier of its corresponding network segment,
wherein a particular network segment having a particular network segment identifier interfaces both the first LRE at a first L1F and the second LRE at a second LIF,

wherein the first LRE comprises a fi rst backplane conduit and the second LRE comprises a second backplane conduit; and

receiving, at the particular host machine, packets to be routed by the first LIF through the first backplane conduit at the first MPRE and packets to be routed by the second LIF through the second backplane conduit at the second MPRE.

15. The method of claim 14, wherein the particular host machine operates a MPSE (managed physical routing element) for handling L2 switching for both the first logical network and the second logical network, wherein the MPSE performs switching of a packet between a plurality of ports based on a MAC address and a network segment identifier.

16. The method of claim 15, wherein the first MPRE and the second MPRE share a same port at the MPSE, wherein the particular host machine determines which MPRE receives a particular packet based on at least one of (1) a network segment identifier associated with the packet and (2) an identity of the backplane conduit used to transport the packet.

17. The method of claim 16, wherein the particular packet is destined for the particular network segment having a particular network segment identifier, wherein first MPRE receives the particular packet at the first LIF when the identity of the backplane conduit belongs to the first backplane conduit, wherein second MPRE receives the particular packet at the second LIF when the identity of the backplane conduit belongs to the second backplane conduit.

18. The method of claim 14, wherein the particular network segment is an IP subnet that is accessible by both the first logical network and the second logical network.

19. The method of claim 14, wherein the network identifier is the VNI (virtual network identifier) of a VLAN network that is accessible by both the first logical network and the second logical network.

20. The method of claim 14, wherein the first LIF receives a first packets at the particular host machine from the first backplane conduit based on a first MAC address associated with a IP interface of the first LIF, wherein the second LIF receives a second packets at the particular host machine from the second backplane conduit based on a second MAC address associated with a IP interface of the second LIF.

21. The method of claim 20, wherein the first MAC address is identical to the second MAC address.

22. A method of operating a plurality of logical networks over a network virtualization infrastructure that comprises a plurality of host machines operating a set of virtual machines (VMs), the method comprising:

defining a first LRE (logical routing element) for routing packets between different network segments in a first logical network and a second LRE for routing packets between different network segments in a second logical network, wherein each host machine operates a local instance of the first LRE as a fi rst MPRE (managed physical routing element) and a local instance of the second LRE as a second MPRE,

wherein the first LRE comprises a first set of LIFs (logical interfaces) for interfacing with a first set of network segments and the second LRE comprises a second set of LIFs for interfacing with a second set of network segments, wherein each LIF is identified by a network segment identifier of its corresponding network segment,

wherein a particular network segment having a particular network segment identifier interfaces both the fi rst LRE at a first LIF and the second LRE at a second LIF:

defining a first backplane conduit for the first LRE and a second backplane conduit for the second LRE, wherein a particular host machine receives packets to be routed by the first LIF through the first backplane conduit at its first MPRE and packets to be routed by the second LIF through the second backplane conduit at its second MPRE; and

generating configuration data based on the defined LREs and the defined backplane conduits and configuring the plurality of host machines by using the generated configuration data.

23. The method of claim 22, wherein each host machine operates a MPSE (managed physical routing element) for handling L2 switching for both the first logical network and the second logical network, wherein the MPSE performs switching of a packet between a plurality of ports based on a MAC address and a network segment identifier.

24. The method of claim 23, wherein the first MPRE and the second MPRE share a same port at the MPSE, wherein the particular host machine determines which MPRE receives a particular packet based on at least one of (1) a network segment identifier associated with the packet and (2) an identity of the backplane conduit used to transport the packet.

25. The method of claim 24, wherein the particular packet is destined for the particular network segment having a particular network segment identifier, wherein first MPRE receives the particular packet at the first LIF when the identity of the backplane conduit belongs to the first backplane conduit, wherein second MPRE receives the particular
packet at the second LIF when the identity of the backplane conduit belongs to the second backplane conduit.

26. The method of claim 22, wherein the particular network segment is an IP subnet that is accessible by both the first logical network and the second logical network.

27. The method of claim 22, wherein the network identifier is the VNI (virtual network identifier) of a VLAN network that is accessible by both the first logical network and the second logical network.

28. The method of claim 22, wherein the first LIF receives a first packets at the particular host machine from the first backplane conduit based on a first MAC address associated with the particular host machine, wherein the second LIF receives a second packets at the particular host machine from the second backplane conduit based on a second MAC address associated with the particular host machine.

29. The method of claim 28, wherein the first MAC address is identical to the second MAC address.

30. A method of operating a logical network over a plurality of host machines, the method comprising:

at a first host machine of the plurality of host machines, operating a set of VMs and a managed physical routing element (MPRE) for routing packets for the set of VMs, wherein the MPRE is a local instance of a logical routing element (LRE) for routing packets between different segments of the logical network, the LRE comprising a plurality of logical interfaces (LIFs), each LIF for interfacing with a different segment of the logical network, wherein a particular network segment interfacing a particular LIF is associated with a plurality of identifiers, each identifier for identifying a different host machine in the plurality of host machines;

receiving a packet that is destined for a particular segment of the network; identifying an inbound LIF and an outbound LIF at the MPRE operated by the first host machine for the received packet;

selecting one of the plurality of identifiers and forwarding the packet to a second host machine identified by the selected address when the identified outbound LIF is the particular LIF, wherein the MPRE of the second host machine identifies a destination address of the packet in the particular network segment.

31. The method of claim 30, wherein selecting one of the plurality of identifiers comprises performing an ECMP (equal cost multi-path) operation.

32. The method of claim 30, wherein each address is the plurality of addresses is an 1MAC that is associated with an IP interface of the particular LIF.

33. The method of claim 30, wherein the particular network segment is a VLAN network,

34. The method of claim 30, wherein the particular LIF is active on only a subset of the plurality of host machines.

35. The method of claim. 34, wherein the second segment is confined to the subset of die host machines, wherein the host machines in the subset of host machines are for providing edge se dees to an external network.

36. The method of claim 30, wherein forwarding the packet to the second host machine comprises overwriting a destination MAC address of the packet with the selected identifier.

37. A method of operating a logical network over a network virtualization infrastructure that compri ses a plurality of host machines, the method compri sing:

defining a logical routing element (LRE) spanning the plurality of host machines for routing packets between different segments of the logical network, wherein each host machine operates a local instance of the LRE as a managed physical routing element (MPRE), the LRE comprising a plurality of logical interfaces (LIFs), each LIF for interfacing with a different segment of the logical network;

defining a plurality of identifiers for a particular network segment interfaced by a particular LIF, each identifier for identifying a different host machine in the plurality of host machines,

wherein routing a packet into the particular network segment comprises (i) identifying an inbound LIF and an outbound LIF at a MPRE operated by a first host machine and (ii) selecting one of the plurality of identifiers and forwarding the packet to a second host machine identified by the selected identifiers when the identified outbound LIF is the particular LIF, wherein the MPRE of the second host machine identifies a destination address of the packet in the particular network segment; and

generating configuration data based on the defined LRE and the defined plurality of identifiers and configuring the plurality of host machines by using the generated configuration data.

38. The method of claim 37, wherein selecting one of the plurality of identifiers comprises performing an ECMP (equal cost multi-path) operation.

39. The method of claim 37, wherein each address is the plurality of addresses is an 1MAC that is associated with an IP interface of the particular LIF.

40. The method of claim 37, wherein the particular network segment is a VLAN network,

41. The method of claim 37, wherein the particular LIF is active on only a subset of the plurality of host machines.

42. The method of claim. 41, wherein the second segment is confined to the subset of die host machines, wherein the host machines in the subset of host machines are for providing edge se dees to an external network.

43. The method of claim 37, wherein forwarding the packet to the second host machine comprises overwriting a destination MAC address of the packet with the selected identifier.