BACKGROUND

Several context-based service and forward architectures have been proposed in recent years. One of these architectures uses logical port identifiers associated with the machines as the contextual attributes used for performing match classification operations on service and/or forwarding rules. This architecture uses control plane (e.g., a cluster of controllers) to distribute the logical port identifiers. However, control plane distribution of logical port identifiers can be slow in some embodiments as it requires data to be first provided to the control plane, and then to be distributed from the control plane to host computers.

SUMMARY

Some embodiments of the invention provide a method for implementing a logical network with one or more logical forwarding elements (LFEs), each with multiple logical ports. Each LFE in some embodiments is implemented by several physical forwarding elements (PFEs) operating on several devices. On a host computer executing a particular machine connected to a PFE implementing a particular LFE, the method identifies an address discovery message associating a particular network address (e.g., a layer 2 (L2) address or media access control (MAC) address) of the particular machine with a another network address (e.g., a layer 3 (L3) or an Internet Protocol (IP) address) of the particular machine. The network addresses (e.g., L2 and L3 addresses) in some embodiments are defined in a logical address space of the logical network.

In some embodiments, the method identifies the address discovery message by identifying this message as the message traverses along the egress datapath of the particular machine. The address discovery message is different in different embodiments. For instance, in some embodiments, the address discovery message is an address resolution protocol (ARP) message (e.g., an ARP reply or gratuitous ARP message), while in other embodiments it is neighbor discovery (ND) message.

The method identifies an LFE logical port associated with the particular machine, and stores in an encapsulation header an identifier that identifies this port. The method encapsulates the address discovery data message with this encapsulation header. Different embodiments use different encapsulating headers. For instance, in some embodiments, the method uses a Generic Network Virtualization Encapsulation (GENEVE) header, and stores the logical port identifier in a Type-Length-Value (TLV) field of this header.

After encapsulating the data message, the method forwards the message to a set of one or more devices implementing the LFE. Each device in the set of devices extracts the logical port identifier from the encapsulation header and stores this logical port identifier for use in processing data messages associated with the particular machine. In some embodiments, the set of devices uses the logical port identifier to identify service or forwarding rules for performing service or forwarding operations on data messages to or from the particular machine. For instance, in some embodiments, the set of devices uses the logical port identifier to apply a security policy associated with the particular logical port to data messages to or from the particular machine.

In some embodiments, the set of devices includes a device that sends an address resolution request to identify one network address (e.g., an L2 or L3 address) of the particular machine based on another network address (e.g., an L3 or L2 address) of the particular machine. For instance, the device in some embodiments sends an address resolution protocol (ARP) request in order to identify a MAC address of the particular machine based on an IP address of the particular machine. In these embodiments, the message identified by the method is an ARP reply message that provides the MAC address for an IP address provided in the ARP request.

In other embodiments, the set of devices includes several devices that execute several machines connected to the LFE. The address discovery message in some of these embodiments is a gratuitous address discovery message that is sent when the particular machine connects to the LFE or receives an updated network address for the LFE. For instance, the gratuitous address discovery message in some embodiments is a gratuitous ARP message sent in response to a change of the particular machine's L3 network address from a previous IP address to an updated IP address. In some embodiments, the new or updated IP address is assigned by a dynamic host configuration protocol (DHCP) process or server to the particular machine.

When a device in some embodiments receives the encapsulated message with the logical port identifier stored in the encapsulating header, the device removes the encapsulating header, extracts the identifier from the header, and passes the address discovery message to its intended destination (e.g., a machine or module executing on the device). The device in some embodiments also identifies the IP address of the particular machine from the received message, and stores an association of the particular IP address with the logical-port identifier. When the received data message provides an updated address for the particular machine, the device replaces the previous IP address in the previously created association with the new IP address in order to associate the new IP address with the logical port identifier.

After creating or updating the association between the IP address and the logical port identifier, the device receives a data message with the particular IP address as a source or destination address. For such a message, the device uses the stored association to identify the logical-port identifier associated with the data message, uses the logical port-identifier to identify a service or forwarding rule associated with the particular logical port, and then performs a service or forwarding operation on the data message based on the identified service rule.

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, the Detailed Description, the Drawings and the Claims is needed. Moreover, the claimed subject matters are not to be limited by the illustrative details in the Summary, the Detailed Description and the Drawing.

