US20230262020A1 - Connection tracking records for a very large scale nat engine - Google Patents

Connection tracking records for a very large scale nat engine Download PDF

Info

Publication number
US20230262020A1
US20230262020A1 US18/137,647 US202318137647A US2023262020A1 US 20230262020 A1 US20230262020 A1 US 20230262020A1 US 202318137647 A US202318137647 A US 202318137647A US 2023262020 A1 US2023262020 A1 US 2023262020A1
Authority
US
United States
Prior art keywords
allocated
port
groups
address
addresses
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
US18/137,647
Inventor
Maruthi Ram Namburu
Srinivasa Srikanth Podila
Shaik Nazeer
Varun Lakkur Ambaji Rao
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
VMware LLC
Original Assignee
VMware LLC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by VMware LLC filed Critical VMware LLC
Priority to US18/137,647 priority Critical patent/US20230262020A1/en
Publication of US20230262020A1 publication Critical patent/US20230262020A1/en
Assigned to VMware LLC reassignment VMware LLC CHANGE OF NAME (SEE DOCUMENT FOR DETAILS). Assignors: VMWARE, INC.
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/72Routing based on the source address
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/24Traffic characterised by specific attributes, e.g. priority or QoS
    • H04L47/2441Traffic characterised by specific attributes, e.g. priority or QoS relying on flow classification, e.g. using integrated services [IntServ]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/70Admission control; Resource allocation
    • H04L47/80Actions related to the user profile or the type of traffic
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • H04L61/2514Translation of Internet protocol [IP] addresses between local and global IP addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • H04L61/2517Translation of Internet protocol [IP] addresses using port numbers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • H04L61/2557Translation policies or rules
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers

Definitions

  • IP4 addresses Internet address translation
  • Some embodiments provide a novel method for performing network address translation to share a limited number of external source network addresses among a large number of connections.
  • This method is implemented in some embodiments by a first network (e.g., a private or public datacenter network) that uses the limited number of external source network addresses to communicate with one or more other networks.
  • a gateway of the first network performs the operations of this method.
  • the method of some embodiments allocates the external source network address based on the egressing packet's source network address and destination network address. This allows a limited number of external source network addresses to be re-used for different destination network addresses. For instance, in some embodiments, the method's network address allocation scheme allows the same 64K (e.g., 2 ⁇ circumflex over ( ) ⁇ 16) external source ports to be used for 64K connections for each destination network address.
  • 64K e.g., 2 ⁇ circumflex over ( ) ⁇ 16
  • connection-tracking records that map allocated external source network addresses to internal source network addresses and external destination network addresses.
  • the method of some embodiments creates a connection-tracking record for an egressing packet flow when it receives the first packet of the flow.
  • the packet includes a header with an internal source address (e.g., an address of a machine or device in the datacenter), and an external destination address (e.g., an address of a machine or device outside of the datacenter).
  • the method allocates an external source network address for the packet flow, replaces the internal source address of the first packet with the allocated external source network address, and forwards the first packet to its destination.
  • the method also creates a connection-tracking record (1) for subsequent packets of the first flow, and (2) for a second packet flow that is received in response to the first packet flow.
  • this connection-tracking record includes two sub-records: a first sub-record for the forward direction (i.e., for the subsequent packets of the first flow) and a second sub-record for the reverse direction (i.e., for the packets of the second packet flow that is in response to the first packet flow).
  • the first sub-record maps the combination of the internal source network address and external destination address to the allocated external source network address, in order to translate the source network address of packets in the first flow to the allocated external source network address.
  • the second sub-record maps the combination of the external destination address and the external source network address to the internal source network address, in order to translate the destination addresses of packets in the second flow to the internal source network address.
  • the connection-tracking record uses both the external destination address and external source network address for mapping to the internal network address because the external source network address is also used as an external source network address for different packet flows to different destination addresses.
  • the method of some embodiments uses the same external source IP address along with the same 64K source port range for multiple different destination IP addresses.
  • the method of some embodiments further extends the sharing of the 64K source ports by using this port range not only for different destination IP addresses, but also for different destination port addresses to the same destination IP address. This allows the method to support up to 4,294,967,296 (64K multiplied by 64K) connections for each destination IP address.
  • the method of some embodiments stores the connection-tracking records in a connection-tracking storage.
  • the method creates a connection-tracking record by generating, from a set of header values in the packet header of a packet flow, a hash value that identifies a location in the connection-tracking storage.
  • the method then stores the connection-tracking record at the location in the storage identified by the hash value.
  • Each hash-addressable location in the storage may store a linked list of zero or more connection-tracking records (e.g., may store a pointer to such a list or be a location of an entry of such a list).
  • Each connection-tracking record is associated with a different packet flow to the same destination IP address, and in some embodiments to the same destination port address.
  • the method of some embodiments creates different connection-tracking data stores for each different destination IP address, and in some embodiments for each different combination of destination IP and port addresses.
  • the method stores the connection-tracking record for a flow in the connection-tracking data store that is defined for the flow's destination IP address, or destination IP/port address pair.
  • the method in some embodiments first has to identify the connection-tracking data store that is associated with the flow, before identifying the connection-tracking record for the flow.
  • Some embodiments provide an efficient method of allocating external source port addresses for the multiple connections that share the limited set of external source IP addresses for a destination IP address, or destination IP/port address pair, outside of a network.
  • the method specifies multiple pre-allocated port groups, each with multiple external port addresses.
  • the port addresses are each port addresses corresponding to the same external source network IP address.
  • the method allocates external port addresses from the pre-allocated port groups for new connections to the destination IP address.
  • the method also dynamically modifies the number of pre-allocated port groups as the number of connections to destinations outside of the network increases or decreases.
  • Each pre-allocated group may include several source port addresses and these source port addresses may be contiguous in a particular group.
  • the method performs these operations in order to provide a fast and efficient mechanism for (i) tracking source port addresses assigned to connections to the destination IP address, and (ii) allocating new source port addresses when no previously pre-allocated source port addresses are available.
  • the pre-allocated port groups may assign all of their available ports.
  • the method dynamically modifies the number of pre-allocated port groups by identifying a new connection for which an external source port has to be assigned, determining that the existing set of pre-allocated port groups does not have an external source port address available to assign to the new connection, and specifying a new set of pre-allocated port groups. The method then allocates an external port address from the new set of pre-allocated port groups.
  • dynamically modifying the number of groups may include reducing the number of groups.
  • the method may reduce the number of groups by identifying a pre-allocated group that was (i) previously used to assign source port addresses to connections and (ii) has had all of its pre-allocated source ports unassigned for at least some threshold period.
  • the method then removes the identified pre-allocated group from the pre-allocated port groups. Removing the identified pre-allocated group may mean deleting the group, setting the group into an idle state, or otherwise eliminating it from use, at least temporarily.
  • each particular pre-allocated group includes a set of metadata.
  • the metadata includes an indicator of a number of ports available in the group for allocating to packet flows and a next port available for allocating to a packet flow.
  • the method modifies the number of available ports and the next-available port in the metadata set of the particular pre-allocated group as ports from the particular group are allocated to packet flows and as ports from the particular group are de-allocated from packet flows that have been terminated.
  • the method may also determine whether a pre-allocated group has an available port for allocation to a new packet flow by examining the number of available ports in the metadata set of the group. When the number of available ports is zero for a group, the method selects another pre-allocated group from which a port should be selected for the new packet flow. The method of some embodiments also determines whether the set of pre-allocated ports indicates any available ports at all by iteratively examining metadata for each pre-allocated port group. If a metadata for a particular pre-allocated port group indicates an available port, the method identifies that the port is available.
  • the method determines that no port tracked by the present pre-allocated port group is available. In some embodiments, determining from the metadata that no port is available in the present pre-allocated groups of ports causes the method to dynamically increase the number of pre-allocated port groups.
  • the method of some embodiments defines different sets of pre-allocated port groups, with each set associated with a different external destination IP address.
  • the method identifies, for a new packet flow, the port-group set associated with an external destination IP address stored in a header field of the new flow.
  • the method then allocates, for the new packet flow, an external port address from a particular pre-allocated port group in the identified port-group set.
  • the method may also define, for each external destination IP address, a connection-tracking data store for storing connection-tracking records that map allocated external source port addresses to internal source IP and port addresses within the network.
  • the connection-tracking records are used in performing network address translation on packets of flows exiting or entering the network.
  • the method of some embodiments allocates a bitmap of available source ports and allocates contiguous blocks of source ports in the bitmap to different pre-allocated groups of ports.
  • the method uses the bitmap to identify the pre-allocated port groups and adjust the number of pre-allocated port groups.
  • FIG. 1 conceptually illustrates a process of some embodiments that creates a connection-tracking record for a packet flow.
  • FIG. 2 illustrates a network address translation (NAT) system with a connection tracker.
  • NAT network address translation
  • FIG. 3 illustrates a network address translation system with a connection tracker that includes external destination ports in its attributes.
  • FIG. 4 conceptually illustrates a source-port allocation process of some embodiments.
  • FIG. 5 illustrates pre-allocation of groups of source port addresses.
  • FIG. 6 conceptually illustrates a process of some embodiments to identify and allocate available ports using metadata of pre-allocated port groups.
  • FIG. 7 illustrates iteratively searching metadata of pre-allocated port groups.
  • FIG. 8 conceptually illustrates a process of some embodiments for de-allocating ports.
  • FIG. 9 illustrates modifications of pre-allocated port groups and associated metadata upon the de-allocation of ports.
  • FIG. 10 illustrates the use of a hash function to locate tracking records.
  • FIG. 11 conceptually illustrates an electronic system with which some embodiments of the invention are implemented.
  • Some embodiments provide a novel method for performing network address translation to share a limited number of external source network addresses among a large number of connections.
  • This method is implemented in some embodiments by a first network (e.g., a private or public datacenter network) that uses the limited number of external source network addresses to communicate with one or more other networks.
  • a gateway of the first network performs the operations of this method.
  • the method of some embodiments allocates the external source network address based on the egressing packet's source network address and destination network address. This allows a limited number of external source network addresses to be re-used for different destination network address. For instance, in some embodiments, the method's network address allocation scheme allows the same 64K external source ports to be used for 64K connections for each destination network address.
  • FIG. 1 conceptually illustrates a process 100 of some embodiments that creates such a connection-tracking record for a packet flow.
  • the process 100 creates the connection-tracking record for an egressing packet flow when it receives the first packet of the flow.
  • the packet includes a header with an internal source address (e.g., an address of a machine or device in the datacenter) and an external destination address (e.g., an address of a machine or device outside of the datacenter).
  • the process 100 receives (at 105 ) a packet of a packet flow.
  • the packet includes a header with an internal source address and an external destination address.
  • the internal source address is an address of a machine or device in the datacenter.
  • the external destination address is an address of a machine or device outside of the datacenter such as an external website IP address.
  • the process 100 allocates (at 110 ) an external source network address for the packet flow.
  • the allocated external source network address will serve as an address on the Internet (or other outside network) to which the destination machine can send reply packets.
  • the process 100 then uses (at 115 ) the allocated address to perform network address translation on the packet before forwarding the packet to its destination.
  • the network address translation replaces the internal source address with the allocated external source network address.
  • the replaced source address provides the destination machine with a location to which to send reply packets over the Internet or other external network.
  • connection-tracking record maps the external destination address and the external source network address to the internal source address, in order to translate the destination addresses of packets in the second flow to the internal network address. This mapping allows packets sent in response to the first flow to be routed to the correct machine of the datacenter.
  • the mapping is used in the method of some embodiments by a network address translator (NAT) to implement an addressing system that determines the internal machine to which an incoming packet is addressed based on both the external source network address that the network uses to communicate with an external machine and the external destination address.
  • NAT network address translator
  • the NAT uses the connection-tracking records to identify the internal machine for each incoming packet flow.
  • FIG. 2 illustrates a network address translation (NAT) system with a connection tracker.
  • FIG. 2 includes connection tracker 210 , network address translator (NAT) 220 , and connection tracker storage 230 .
  • NAT network address translator
  • connection tracker storage 230 includes connection-tracking records used by the NAT 220 to determine which internal addresses to apply to incoming packets and which external source addresses to apply to outgoing packets.
  • the method creates a single connection-tracking record (1) for packets of a first, outgoing packet flow, and (2) for packets of a second, incoming packet flow that is received in response to the first packet flow.
  • each connection-tracking record in the connection tracker storage 230 includes multiple attributes.
  • the NAT 220 uses these attributes as a set of match attributes and a set of action attributes.
  • which attributes are used as the match attributes and which are used as action attributes depends on whether the packet to be matched is an incoming or an outgoing packet.
  • the match attribute set for each connection-tracking record are external destination IP (E.Dest. IP) and external source network addresses (E.Src.IP and E.Src.port), while the action attributes are internal source addresses (I.Src.IP and I.Src.port).
  • the network address translator 220 identifies the source and destination addresses for a header of an incoming packet received at the network and uses the connection tracker 210 to determine whether the source and destination addresses in the header match the (incoming) match attributes of a connection-tracking record in the connection tracker storage 230 .
  • the network address translator 220 then uses the (incoming) action attributes, I.Src.IP and I.Src.port, to replace the destination network address of the reply packet with the internal network address stored by the connection-tracking record.
  • the reply packet is then forwarded to the machine at the internal network IP address and internal network port.
  • the match attributes are (E.Dest.IP) and internal source addresses (I.Src.IP and I.Src.port) while the action attributes are the external source network addresses (E.Src.IP and E.Src.port).
  • the NAT 220 identifies the source and destination addresses for a header of an outgoing packet to be sent from the network. The NAT 220 then uses the connection tracker 210 to determine whether the source and destination addresses in the header match the (outgoing) match attributes of a connection-tracking record in the connection tracker storage 230 .
  • the network address translator 220 then uses the (outgoing) action attributes, E.Src.IP and E.Src.port, to replace the destination network address of the outgoing packet with the internal network address stored by the connection-tracking record.
  • the outgoing packet is then forwarded to the external destination.
  • Some embodiments use hash functions to quickly locate connection-tracking records in connection-tracking storages. The use of such hash functions is further described with respect to FIG. 10 , below.
  • the connection-tracking record includes two sub-records, a first sub-record for the forward direction (i.e., for the subsequent packets of the outgoing flow), and a second sub-record for the reverse direction (i.e., for the packets of the incoming packet flow that is in response to the outgoing packet flow).
  • the first sub-record maps the combination of the internal source network address and external destination address to the allocated external source network address while the second sub-record maps the combination of the external destination address and the external source network address to the internal source network address.
  • two separate connection-tracking records similar to such sub-records are created, one record for outgoing packets of a flow and one for incoming packets of a response flow.
  • the match attributes in addition to the connection-tracking record including the external destination IP, also include an external destination port.
  • the match attributes also include an external destination port.
  • FIG. 3 illustrates a network address translation system with a connection tracker 310 that includes external destination ports in its attributes.
  • connection tracker 310 uses a connection tracker 310 to access connection tracker storage 330 in which each connection-tracking record includes, for incoming packets, (1) match attributes: external destination IP (E.Dest.IP), external destination port (E.Dest.port), and external source network addresses (E.Src.IP and E.Src.port), and (2) action attributes: internal source addresses (I.Src.IP and I.Src.port).
  • match attributes are: external destination IP (E.Dest.IP), external destination port (E.Dest.port), and internal source addresses (I.Src.IP and I.Src.port)
  • action attributes are: external source network addresses (E.Src.IP and E.Src.port).
  • Some embodiments that include destination port addresses in the connection-tracking records also create two sub-records or two separate connection-tracking records, rather than using a single connection-tracking record and determining which attributes are match or action attributes based on the direction of the packet flow.
  • the connection-tracking record uses both the external destination address and external source network address for mapping to the internal network address because the external source network address is used as an external source network address for different packet flows to different destination addresses.
  • the method of some embodiments uses the same external source IP address along with the same 64K source port range for multiple different destination IP addresses.
  • the method of some embodiments further extends the sharing of the 64K source ports by using this port range not only for different destination IP addresses but also for different destination port addresses to the same destination IP address. This allows the method to support up to 4,294,967,296 (64K multiplied by 64K) connections for each destination IP address.
  • some embodiments use a source-port allocation process that pre-allocates groups of source port addresses, assigns source port addresses to new connections from these pre-allocated port groups, and adds new and removes old pre-allocated port groups as the number of connections increases and decreases.
  • FIG. 4 conceptually illustrates such a source-port allocation process 400 .
  • the process 400 will be described by reference to an example shown in FIG. 5 , which illustrates pre-allocation of groups of source port addresses and dynamic growth and reduction of these groups as the number of connections increases and decreases.
  • the available ports 500 include 65,536 (64K) ports numbered from 0 to 65,535.
  • the process 400 specifies (at 405 ) multiple pre-allocated port groups of external port addresses.
  • the port addresses in the pre-allocated port groups are each port addresses of the same external source network address (e.g., of an external source IP address) and are all assigned with respect to the same external destination IP address. In some embodiments, a particular port value is not available to be allocated to a connection unless that port is in a pre-allocated port group.
  • the pre-allocated port groups include two groups 512 and 514 . Each of these groups contains 512 pre-allocated ports from the set of possible port addresses 500 . Within each pre-allocated port group, the source port addresses are contiguous. Group 512 includes ports 0-511 and group 514 includes ports 512-1023.
  • the process 400 (of FIG. 4 ) allocates/de-allocates (at 410 ) external source port addresses from the pre-allocated port groups. Ports are allocated (as needed) between machines of the datacenter and machines at external destination addresses. As FIG. 4 shows, operation 410 is applied repeatedly as new connections are needed.
  • the process 400 determines (at 425 ) whether new connections that need a new port are to be allocated or an existing connection has terminated and the port for that connection needs to be de-allocated.
  • the process 400 will eventually determine (at 415 ) that all available ports of the pre-allocated groups are in use (e.g., assigned to connections between machines of the datacenter and the external destination address). In that case, the process 400 pre-allocates (at 420 ) additional port groups, then returns to operation 425 .
  • the pre-allocated group 512 is shown completely shaded to indicate that all 512 ports in group 512 are allocated to various connections between the external source IP address and the particular destination IP address associated with the pre-allocated port groups.
  • Group 514 is partially shaded, with the port number 600 shown as the lowest available port, indicating that group 514 still has available ports 600-1023 to be assigned to new connections.
  • the process 400 (of FIG. 4 ) allocates (at 410 ) additional external source port addresses from the pre-allocated port group 514 (of FIG. 5 ) for new connections between the external source IP address and the destination IP address associated with the port groups.
  • each new allocated port address will be one of the available ports in the range 600 - 1023 from group 514 .
  • the process 400 (of FIG. 4 ) eventually allocates all the available ports in the pre-allocated port group 514 .
  • the process 400 determines (at 415 ) that all pre-allocated ports in the existing port groups are in use.
  • the process 400 then pre-allocates (at 420 ) an additional port group, group 522 of FIG. 5 .
  • Group 522 also has 512 ports, specifically ports 1024-1535.
  • the process 400 (of FIG. 4 ) then continues to allocate ports (at 410 ) until all ports of group 522 (of FIG. 5 ) are used, then pre-allocates (at 420 ) additional port group 524 , which also has 512 ports, specifically ports 1536-2047.
  • the process 400 when no connection is being allocated/de-allocated determines (at 430 ) whether it is time to re-examine port group allocation. In some embodiments, this determination is made periodically (e.g., every 5 seconds, every 10 seconds, etc.). In other embodiments, a state of the system may trigger the re-examination (e.g., the process may re-examine group allocation when the existing pre-allocated ports are nearly all used and/or when all ports of a pre-allocated group have become available either at all or for a threshold amount of time). When the process 400 determines (at 430 ) that it is not time to re-examine port group allocation, the process 400 returns to operation 425 .
  • the process 400 will dynamically modify (at 435 ) the number of pre-allocated groups, by either increasing or reducing the number of pre-allocated groups. For example, the process 400 (of FIG. 4 ) reduces (at 435 ) the number of groups by identifying a pre-allocated port group that is no longer active and removing it after de-allocating (at 410 ) all of the ports of that pre-allocated port group. Removing the group may mean deleting the group, setting the group into an idle state, or otherwise eliminating it from use. After modifying the number of groups, the process 400 then returns to operation 425 to determine whether connections need to be allocated/de-allocated.
  • connections using ports in group 522 began to terminate. When those connections terminated, the ports became available again and the process 400 de-allocated (at 410 ) the ports. The newly available ports are shown as the unshaded portion of group 522 .
  • the process 400 can allocate and de-allocate ports as necessary. For example, the process 400 can allocate a particular port for a new connection after an old connection (to which that port was allocated) terminates. In some embodiments, the method preferentially assigns the lowest available ports to new connections, resulting in a tendency for higher pre-allocated port groups to empty out sooner than lower pre-allocated port groups as overall demand for connections to the destination IP address decreases.
  • a new port group is created once the last port of the groups are allocated, but in other embodiments, the new port group may be created when the number of available ports in the pre-allocated groups drops below a threshold, in anticipation of a need for more capacity. In still other embodiments, a new port group may be created only when a new connection needs a port and all available ports are already allocated.
  • the illustrated groups track port availability only for connections between one particular external source IP and one particular destination IP. Although packets may come in to or be forwarded from the ports of the external source IP from other destination IP addresses, those connections are not tracked by the illustrated pre-allocated port groups of FIG. 5 , but rather by separate pre-allocated port groups (not shown). That is, in some embodiments, there is a separate set of pre-allocated port groups for the external source address associated with each destination IP address. Furthermore, in some embodiments, there is a separate set of pre-allocated port groups for the external source address associated with each destination IP address/destination port pair. Although the illustrated pre-allocated port groups are each the same size (contain the same number of ports), in other embodiments, some pre-allocated port groups may be different sizes than others.
  • each pre-allocated port group is associated with a set of metadata.
  • the set of metadata for each group may include an indicator of how many of the ports tracked by that group are available and may also identify a specific available port tracked by that group (e.g., the lowest available port number tracked by the group).
  • FIG. 6 conceptually illustrates a process 600 of some embodiments to identify and allocate available ports using metadata of pre-allocated port groups.
  • the process 600 uses the metadata to determine whether the existing pre-allocated port groups contain any available ports by iteratively examining metadata for each pre-allocated port group.
  • FIG. 7 conceptually illustrates iteratively searching metadata of pre-allocated port groups.
  • FIG. 7 includes 3 pre-allocated port groups, specifically two pre-allocated port groups 705 and 715 with four ports each and a pre-allocated port group 725 with eight ports.
  • the groups 705 , 715 , and 725 each have accompanying metadata 710 , 720 , and 730 , respectively.
  • the process 600 begins when a new connection requires a port allocation.
  • the process 600 identifies (at 605 ) a new connection that requires an external source port.
  • the new connection will be a connection between a particular external source IP address and a particular external destination IP address.
  • the pre-allocated port groups to be examined are groups of ports for connections to that particular external destination address.
  • the process 600 examines (at 610 ) the metadata for an unexamined (so far in the port allocation process 600 ) pre-allocated port group. If the process 600 determines (at 615 ) that the metadata of the first group indicates that no ports are available, the process 600 determines (at 620 ) whether any other groups have not had their metadata examined and then cycles through operations 610 , 615 , and 620 until it identifies (at 615 ) an available port and proceeds to operation 630 (as described in the next paragraph) or determines (at 620 ) that the metadata of the last group indicates no available ports. If the metadata of every group indicates no available ports, the process 625 creates a new pre-allocated port group and identifies a first port of the new pre-allocated port group as available before proceeding to operation 630 .
  • the process 600 starts with the first pre-allocated port group and proceeds sequentially until it finds an available port.
  • the pre-allocated port group 705 has no available ports, as indicated by all four ports of the first pre-allocated port group being shaded. Accordingly, the metadata 710 for group 705 shows no ports available. Therefore, the process 600 (of FIG. 6 ) determines, at 615 , that the metadata identifies no port available in the first group. The process 600 then determines (at 620 ) that the group was not the last pre-allocated port group, because groups 715 and 725 have not been examined.
  • the process 600 then examines (at 610 ) the metadata for the next pre-allocated port group and returns to operation 615 to determine the results.
  • the next group is pre-allocated port group 715 .
  • Pre-allocated port group 715 has two ports available, as indicated in the figure by two unshaded ports.
  • the metadata 720 indicates that two ports are available in the group and that the next assignable port number is 5. Therefore the process 600 (of FIG. 6 ) determines (at 615 ) that port 5 is available.
  • the process 600 (of FIG. 6 ) then proceeds to operation 630 and allocates port 5 to the new connection.
  • the process 600 then updates (at 635 ) the pre-allocated port group to indicate that the port is now allocated and updates the metadata to indicate the remaining number of available ports in the group and the number of the next available port.
  • the process 600 then ends.
  • the metadata in the illustrated example includes the available port with the lowest numerical value as the next port for allocation. However, in other embodiments some other port of the port group may be designated as the next available port (e.g., the longest unused port, the highest numbered available port, etc.).
  • the connection using an allocated port may terminate.
  • the port is de-allocated.
  • the method of some embodiments updates (1) the pre-allocated port group to which the de-allocated port belongs and (2) the metadata for that group to indicate that the port is available to be allocated to a new connection for a new outgoing flow (and its reply flow).
  • the method of some embodiments removes the pre-allocated port group as well.
  • FIG. 8 illustrates a process 800 for de-allocating ports.
  • the process 800 will be described with reference to FIG. 9 .
  • FIG. 9 illustrates modifications of pre-allocated port groups upon the de-allocation of ports.
  • the figure includes pre-allocated groups 905 , 915 , and 925 with metadata sets 910 , 920 , and 930 respectively.
  • the process 800 determines (at 805 ) that a connection using an external source IP and port to connect to a particular external destination IP address has terminated.
  • the termination of a connection may be determined by a process that calculates how much time has passed since a packet of an outgoing and/or incoming flow of that connection has been received and identifies the connection as terminated after a threshold time has passed.
  • a connection may be explicitly terminated by a termination code received from one or both of the machines at the original internal source address and the external destination address.
  • the process 800 then updates (at 810 ) the pre-allocated port group for that port in the set of pre-allocated port groups associated with that external destination to indicate that the port is available.
  • Two examples of port-group updating are conceptually illustrated in FIG. 9 .
  • the first port of pre-allocated port group 905 is shown by its shading as being allocated to a connection.
  • the process 800 updates (at 815 ) the metadata for the pre-allocated port group.
  • the metadata includes the first (lowest port numbered) available port as the next available port for allocation.
  • the process 800 (of FIG. 8 ) then ends.
  • a separate clean-up process removes pre-allocated port groups with no allocated ports.
  • the process 800 updates the metadata 910 for the empty pre-allocated port group 905 before a separate clean-up process removes the group (e.g., using the metadata to identify the group as empty), while other embodiments may simply remove the group when it becomes empty, without updating the metadata first.
  • the metadata in the illustrated example includes the available port with the lowest numerical value as the next port for allocation, in other embodiments some other port of the port group may be designated as the next available port (e.g., the longest unused port, the highest numbered available port, etc.).
  • the pre-allocated port groups are stored as bitmap chunks.
  • each bit of a bitmap chunk represents a single port, with (i) the port number based on the position of the bit within the bitmap and (ii) the state of the port (allocated or not-allocated) determined by the value of the bit.
  • larger pre-allocated port groups are allocated (i.e., as larger bitmap chunks).
  • the first two pre-allocated chunks are implemented as two 512-bit chunks
  • the next four pre-allocated chunks are implemented as four 1024-bit chunks
  • the next eight pre-allocated chunks are implemented as eight 2048-bit chunks
  • the next eleven pre-allocated chunks are implemented as eleven 4096-bit chunks.
  • the maximum total number of bits in all the bitmap chunks for a given destination IP address (or destination IP address and port) is 64K.
  • Other embodiments that implement pre-allocated port groups as bitmaps may use different sizes of bitmap chunks to reach 64K bits or may have other maximum numbers of bits (e.g., in order to limit the number of ports available for connections to a particular destination address).
  • FIG. 10 illustrates the use of a hash function to locate tracking-records.
  • the figure includes a set of packet header data 1005 , a hash function 1010 , and hash buckets 1015 (e.g., rows of a hash table) with tracking record entries 1017 . Some of the entries are stored in linked lists 1020 and 1025 .
  • hash buckets 1015 e.g., rows of a hash table
  • Some of the entries are stored in linked lists 1020 and 1025 .
  • One of ordinary skill in the art will understand that although both the data to which the hash function is applied in this figure, and the match and action attributes described with respect to FIGS. 2 and 3 , are packet header data, some or all of the packet header data on which the hash is performed may not be the same as any of the match or action attributes.
  • the method when a packet comes into the network, the method identifies the external destination IP (EDI) and external destination port (EDP) values from the packet header data 1005 .
  • a hash function 1010 is then applied to the EDI/EDP pairs to identify a particular bucket 1015 of a hash table in which the connection-tracking records 1017 are stored.
  • hash collisions occur for some flows, such as when multiple connection-tracking records 1017 have the same EDI/EDP pair or when connection-tracking records 1017 of flows with different EDI/EDP pairs hash to the same location.
  • the connection-tracking record entries 1017 are stored in linked lists, such as linked list 1020 , which includes three connection-tracking records 1017 from EDI2/EDP3 and linked list 1025 which contains one connection-tracking record 1017 for flows with the EDI1/EDP2 pair and two connection-tracking records 1017 for flows with the EDI2/EDP4 pair.
  • the methods of some embodiments may use other packet header values as inputs for hash functions.
  • the methods of some embodiments may use the entire connection tuple of a packet or any chosen subset of its values as inputs for a hash function.
  • Some embodiments may use multiple instances of one or more hash functions to populate multiple hash tables with the same general purpose. For example, some embodiments may provide a separate hash table for connection-tracking records for each external source IP address. Similarly, in some embodiments, the methods may use multiple hash functions for different purposes.
  • some embodiments use a hash function to sort entries of a hash table containing connection-tracking records and another hash function to identify where pre-allocation port groups are stored for each ESI/EDI pair or EST/EDI/EDP combination.
  • the hash function identifies the location in the hash table of a pointer that in turn identifies a first entry in a linked list of connection-tracking records, the location of another hash table, the location of a binary tree, etc.
  • FIG. 11 conceptually illustrates an electronic system 1100 with which some embodiments of the invention are implemented.
  • the electronic system 1100 can be used to execute any of the control, virtualization, or operating system applications described above.
  • the electronic system 1100 may be a computer (e.g., a desktop computer, personal computer, tablet computer, server computer, mainframe, a blade computer etc.), or any other 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 1100 includes a bus 1105 , processing unit(s) 1110 , a system memory 1125 , a read-only memory 1130 , a permanent storage device 1135 , input devices 1140 , and output devices 1145 .
  • the bus 1105 collectively represents all system, peripheral, and chipset buses that communicatively connect the numerous internal devices of the electronic system 1100 .
  • the bus 1105 communicatively connects the processing unit(s) 1110 with the read-only memory 1130 , the system memory 1125 , and the permanent storage device 1135 .
  • the processing unit(s) 1110 retrieve 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.
  • the read-only-memory (ROM) 1130 stores static data and instructions that are needed by the processing unit(s) 1110 and other modules of the electronic system.
  • the permanent storage device 1135 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 1100 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 1135 .
  • the system memory 1125 is a read-and-write memory device. However, unlike storage device 1135 , the system memory is a volatile read-and-write memory, such a random access memory.
  • the system memory 1125 stores some of the instructions and data that the processor needs at runtime.
  • the invention's processes are stored in the system memory 1125 , the permanent storage device 1135 , and/or the read-only memory 1130 . From these various memory units, the processing unit(s) 1110 retrieve instructions to execute and data to process in order to execute the processes of some embodiments.
  • the bus 1105 also connects to the input and output devices 1140 and 1145 .
  • the input devices 1140 enable the user to communicate information and select commands to the electronic system.
  • the input devices 1140 include alphanumeric keyboards and pointing devices (also called “cursor control devices”).
  • the output devices 1145 display images generated by the electronic system 1100 .
  • the output devices 1145 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.
  • CTR cathode ray tubes
  • LCD liquid crystal displays
  • bus 1105 also couples electronic system 1100 to a network 1165 through a network adapter (not shown).
  • 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 1100 may be used in conjunction with the invention.
  • 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).
  • 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.
  • CD-ROM compact discs
  • CD-R recordable compact
  • 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.
  • ASICs application-specific integrated circuits
  • FPGAs field-programmable gate arrays
  • integrated circuits execute instructions that are stored on the circuit itself.
  • the terms “computer”, “server”, “processor”, and “memory” all refer to electronic or other technological devices. These terms exclude people or groups of people.
  • display or displaying means displaying on an electronic device.
  • 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.
  • DCNs data compute nodes
  • addressable nodes 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.
  • 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
  • Some containers are constructs that run on top of a host operating system without the need for a hypervisor or separate guest operating system.
  • 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-virtualized environments that virtualize 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.
  • Hypervisor kernel network interface modules are non-VM DCNs that include a network stack with a hypervisor kernel network interface and receive/transmit threads.
  • a hypervisor kernel network interface module is the vmknic module that is part of the ESXiTM hypervisor of VMware, Inc.
  • VMs virtual machines
  • examples given could be any type of DCNs, including physical hosts, VMs, non-VM containers, and hypervisor kernel network interface modules.
  • the example networks could include combinations of different types of DCNs in some embodiments.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

Some embodiments provide a novel method for performing network address translation to share a limited number of external source network addresses among a large number of connections. Instead of allocating an external source network address for an egressing packet just based on its internal source network address, the method of some embodiments allocates the external source network address based on the egressing packet's source network address and destination network address. This allows a limited number of external source network addresses to be re-used for different destination network address. For instance, in some embodiments, the method's network address allocation scheme allows the same 64K (e.g., 2{circumflex over ( )}16) external source ports to be used for 64K connections for each destination network address.

Description

    BACKGROUND
  • Datacenters and other private or public networks with internal addressing schemes often have large numbers of machines and processes on those machines that require connections to the Internet or other outside networks. Communications on the Internet often take the form of packets with source addresses and destination addresses that each include an IP address (often an IP4 address) and a port number. There are a limited number of available IP4 addresses (external source IP addresses), so a datacenter will often have more machines that need connections than IP4 addresses assigned to the datacenter. This problem is partially addressed by network address translation (NAT) systems which assign each outgoing flow of packets, from a machine of the datacenter, a single port of one of the limited number of IP addresses of the datacenter. However, as each IP address only has 64K available ports, a datacenter with a large number of machines, or a large number of processes running on those machines that require outside connections, can exhaust all available ports on the datacenter's external source IP addresses. Therefore, there is a need in the art for a NAT system that provides external source IP addresses and port for a very large number of connections between machines of the datacenter and machines external to the datacenter.
  • BRIEF SUMMARY
  • Some embodiments provide a novel method for performing network address translation to share a limited number of external source network addresses among a large number of connections. This method is implemented in some embodiments by a first network (e.g., a private or public datacenter network) that uses the limited number of external source network addresses to communicate with one or more other networks. In some embodiments, a gateway of the first network performs the operations of this method.
  • Instead of allocating an external source network address for an egressing packet just based on its internal source network address, the method of some embodiments allocates the external source network address based on the egressing packet's source network address and destination network address. This allows a limited number of external source network addresses to be re-used for different destination network addresses. For instance, in some embodiments, the method's network address allocation scheme allows the same 64K (e.g., 2{circumflex over ( )}16) external source ports to be used for 64K connections for each destination network address.
  • To keep track of the allocated external source network addresses, the method of some embodiments creates connection-tracking records that map allocated external source network addresses to internal source network addresses and external destination network addresses. The method of some embodiments creates a connection-tracking record for an egressing packet flow when it receives the first packet of the flow. The packet includes a header with an internal source address (e.g., an address of a machine or device in the datacenter), and an external destination address (e.g., an address of a machine or device outside of the datacenter).
  • From a pool of a limited number of external source network addresses, the method allocates an external source network address for the packet flow, replaces the internal source address of the first packet with the allocated external source network address, and forwards the first packet to its destination. The method also creates a connection-tracking record (1) for subsequent packets of the first flow, and (2) for a second packet flow that is received in response to the first packet flow. In some embodiments, this connection-tracking record includes two sub-records: a first sub-record for the forward direction (i.e., for the subsequent packets of the first flow) and a second sub-record for the reverse direction (i.e., for the packets of the second packet flow that is in response to the first packet flow).
  • The first sub-record maps the combination of the internal source network address and external destination address to the allocated external source network address, in order to translate the source network address of packets in the first flow to the allocated external source network address. The second sub-record maps the combination of the external destination address and the external source network address to the internal source network address, in order to translate the destination addresses of packets in the second flow to the internal source network address. Instead of creating two sub-records for the forward and reverse directions, the method of some embodiments creates only one mapping connection-tracking record, and then uses different portions of this record for the match and action attributes in the forward and reverse directions.
  • In some embodiments, the connection-tracking record uses both the external destination address and external source network address for mapping to the internal network address because the external source network address is also used as an external source network address for different packet flows to different destination addresses. For instance, as mentioned above, the method of some embodiments uses the same external source IP address along with the same 64K source port range for multiple different destination IP addresses. The method of some embodiments further extends the sharing of the 64K source ports by using this port range not only for different destination IP addresses, but also for different destination port addresses to the same destination IP address. This allows the method to support up to 4,294,967,296 (64K multiplied by 64K) connections for each destination IP address.
  • The method of some embodiments stores the connection-tracking records in a connection-tracking storage. The method creates a connection-tracking record by generating, from a set of header values in the packet header of a packet flow, a hash value that identifies a location in the connection-tracking storage. The method then stores the connection-tracking record at the location in the storage identified by the hash value. Each hash-addressable location in the storage may store a linked list of zero or more connection-tracking records (e.g., may store a pointer to such a list or be a location of an entry of such a list). Each connection-tracking record is associated with a different packet flow to the same destination IP address, and in some embodiments to the same destination port address.
  • The method of some embodiments creates different connection-tracking data stores for each different destination IP address, and in some embodiments for each different combination of destination IP and port addresses. In such embodiments, the method stores the connection-tracking record for a flow in the connection-tracking data store that is defined for the flow's destination IP address, or destination IP/port address pair. For subsequent packets in the same flow or reverse flow, the method in some embodiments first has to identify the connection-tracking data store that is associated with the flow, before identifying the connection-tracking record for the flow.
  • Some embodiments provide an efficient method of allocating external source port addresses for the multiple connections that share the limited set of external source IP addresses for a destination IP address, or destination IP/port address pair, outside of a network. For instance, in some embodiments, the method specifies multiple pre-allocated port groups, each with multiple external port addresses. The port addresses are each port addresses corresponding to the same external source network IP address. When external port addresses are available in the pre-allocated port groups, the method allocates external port addresses from the pre-allocated port groups for new connections to the destination IP address. The method also dynamically modifies the number of pre-allocated port groups as the number of connections to destinations outside of the network increases or decreases. Each pre-allocated group may include several source port addresses and these source port addresses may be contiguous in a particular group. In some embodiments, the method performs these operations in order to provide a fast and efficient mechanism for (i) tracking source port addresses assigned to connections to the destination IP address, and (ii) allocating new source port addresses when no previously pre-allocated source port addresses are available.
  • As the number of connections to a particular destination address rises, the pre-allocated port groups may assign all of their available ports. In order to assign new ports, the method dynamically modifies the number of pre-allocated port groups by identifying a new connection for which an external source port has to be assigned, determining that the existing set of pre-allocated port groups does not have an external source port address available to assign to the new connection, and specifying a new set of pre-allocated port groups. The method then allocates an external port address from the new set of pre-allocated port groups.
  • In some embodiments, dynamically modifying the number of groups may include reducing the number of groups. The method may reduce the number of groups by identifying a pre-allocated group that was (i) previously used to assign source port addresses to connections and (ii) has had all of its pre-allocated source ports unassigned for at least some threshold period. The method then removes the identified pre-allocated group from the pre-allocated port groups. Removing the identified pre-allocated group may mean deleting the group, setting the group into an idle state, or otherwise eliminating it from use, at least temporarily.
  • The method of some embodiments provides an efficient way to search the multiple pre-allocated port groups. In some such methods, each particular pre-allocated group includes a set of metadata. The metadata includes an indicator of a number of ports available in the group for allocating to packet flows and a next port available for allocating to a packet flow. The method modifies the number of available ports and the next-available port in the metadata set of the particular pre-allocated group as ports from the particular group are allocated to packet flows and as ports from the particular group are de-allocated from packet flows that have been terminated.
  • The method may also determine whether a pre-allocated group has an available port for allocation to a new packet flow by examining the number of available ports in the metadata set of the group. When the number of available ports is zero for a group, the method selects another pre-allocated group from which a port should be selected for the new packet flow. The method of some embodiments also determines whether the set of pre-allocated ports indicates any available ports at all by iteratively examining metadata for each pre-allocated port group. If a metadata for a particular pre-allocated port group indicates an available port, the method identifies that the port is available. However, if the metadata for each pre-allocated port group indicates no ports are available in that pre-allocated port group, the method determines that no port tracked by the present pre-allocated port group is available. In some embodiments, determining from the metadata that no port is available in the present pre-allocated groups of ports causes the method to dynamically increase the number of pre-allocated port groups.
  • The method of some embodiments defines different sets of pre-allocated port groups, with each set associated with a different external destination IP address. The method identifies, for a new packet flow, the port-group set associated with an external destination IP address stored in a header field of the new flow. The method then allocates, for the new packet flow, an external port address from a particular pre-allocated port group in the identified port-group set. The method may also define, for each external destination IP address, a connection-tracking data store for storing connection-tracking records that map allocated external source port addresses to internal source IP and port addresses within the network. The connection-tracking records are used in performing network address translation on packets of flows exiting or entering the network.
  • The method of some embodiments allocates a bitmap of available source ports and allocates contiguous blocks of source ports in the bitmap to different pre-allocated groups of ports. The method uses the bitmap to identify the pre-allocated port groups and adjust the number of pre-allocated port groups.
  • 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, the Drawings and the Claims is needed. Moreover, the claimed subject matters are not to be limited by the illustrative details in the Summary, Detailed Description and the Drawing.
  • BRIEF DESCRIPTION OF THE DRAWINGS
  • 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.
  • FIG. 1 conceptually illustrates a process of some embodiments that creates a connection-tracking record for a packet flow.
  • FIG. 2 illustrates a network address translation (NAT) system with a connection tracker.
  • FIG. 3 illustrates a network address translation system with a connection tracker that includes external destination ports in its attributes.
  • FIG. 4 conceptually illustrates a source-port allocation process of some embodiments.
  • FIG. 5 illustrates pre-allocation of groups of source port addresses.
  • FIG. 6 conceptually illustrates a process of some embodiments to identify and allocate available ports using metadata of pre-allocated port groups.
  • FIG. 7 illustrates iteratively searching metadata of pre-allocated port groups.
  • FIG. 8 conceptually illustrates a process of some embodiments for de-allocating ports.
  • FIG. 9 illustrates modifications of pre-allocated port groups and associated metadata upon the de-allocation of ports.
  • FIG. 10 illustrates the use of a hash function to locate tracking records.
  • FIG. 11 conceptually illustrates an electronic system with which some embodiments of the invention are implemented.
  • DETAILED DESCRIPTION
  • In the following detailed description of the invention, numerous details, examples, and embodiments of the invention are set forth and described. However, it will be clear and apparent to one skilled in the art that the invention is not limited to the embodiments set forth and that the invention may be practiced without some of the specific details and examples discussed.
  • Some embodiments provide a novel method for performing network address translation to share a limited number of external source network addresses among a large number of connections. This method is implemented in some embodiments by a first network (e.g., a private or public datacenter network) that uses the limited number of external source network addresses to communicate with one or more other networks. In some embodiments, a gateway of the first network performs the operations of this method.
  • Instead of allocating an external source network address for an egressing packet just based on its internal source network address, the method of some embodiments allocates the external source network address based on the egressing packet's source network address and destination network address. This allows a limited number of external source network addresses to be re-used for different destination network address. For instance, in some embodiments, the method's network address allocation scheme allows the same 64K external source ports to be used for 64K connections for each destination network address.
  • To keep track of the allocated external source network addresses, some embodiments create connection-tracking records that map allocated external source network addresses to internal source network addresses and external destination network addresses. FIG. 1 conceptually illustrates a process 100 of some embodiments that creates such a connection-tracking record for a packet flow. The process 100 creates the connection-tracking record for an egressing packet flow when it receives the first packet of the flow. The packet includes a header with an internal source address (e.g., an address of a machine or device in the datacenter) and an external destination address (e.g., an address of a machine or device outside of the datacenter).
  • The process 100 receives (at 105) a packet of a packet flow. The packet includes a header with an internal source address and an external destination address. The internal source address is an address of a machine or device in the datacenter. The external destination address is an address of a machine or device outside of the datacenter such as an external website IP address.
  • From a pool of external source network addresses, the process 100 allocates (at 110) an external source network address for the packet flow. The allocated external source network address will serve as an address on the Internet (or other outside network) to which the destination machine can send reply packets.
  • The process 100 then uses (at 115) the allocated address to perform network address translation on the packet before forwarding the packet to its destination. The network address translation replaces the internal source address with the allocated external source network address. When the packet reaches its destination, the replaced source address provides the destination machine with a location to which to send reply packets over the Internet or other external network.
  • For a second packet flow that is received in response to the first packet flow, the process 100 creates (at 120) a connection-tracking record. The connection-tracking record maps the external destination address and the external source network address to the internal source address, in order to translate the destination addresses of packets in the second flow to the internal network address. This mapping allows packets sent in response to the first flow to be routed to the correct machine of the datacenter.
  • The mapping is used in the method of some embodiments by a network address translator (NAT) to implement an addressing system that determines the internal machine to which an incoming packet is addressed based on both the external source network address that the network uses to communicate with an external machine and the external destination address. This allows the NAT to route packets to the correct internal machine when the external source network address and port are receiving packets from an arbitrarily large number of external machines. That is, the same external source IP and source port address could receive packets from thousands or more different external machines and correctly route the packets to the machines at the appropriate internal network addresses. The NAT uses the connection-tracking records to identify the internal machine for each incoming packet flow.
  • FIG. 2 illustrates a network address translation (NAT) system with a connection tracker. FIG. 2 includes connection tracker 210, network address translator (NAT) 220, and connection tracker storage 230.
  • The connection tracker storage 230 includes connection-tracking records used by the NAT 220 to determine which internal addresses to apply to incoming packets and which external source addresses to apply to outgoing packets. In some embodiments, the method creates a single connection-tracking record (1) for packets of a first, outgoing packet flow, and (2) for packets of a second, incoming packet flow that is received in response to the first packet flow.
  • In FIG. 2 , each connection-tracking record in the connection tracker storage 230 includes multiple attributes. The NAT 220 uses these attributes as a set of match attributes and a set of action attributes. In the method of some embodiments, which attributes are used as the match attributes and which are used as action attributes depends on whether the packet to be matched is an incoming or an outgoing packet. For example, for an incoming packet, the match attribute set for each connection-tracking record are external destination IP (E.Dest. IP) and external source network addresses (E.Src.IP and E.Src.port), while the action attributes are internal source addresses (I.Src.IP and I.Src.port).
  • The network address translator 220 identifies the source and destination addresses for a header of an incoming packet received at the network and uses the connection tracker 210 to determine whether the source and destination addresses in the header match the (incoming) match attributes of a connection-tracking record in the connection tracker storage 230. The network address translator 220 then uses the (incoming) action attributes, I.Src.IP and I.Src.port, to replace the destination network address of the reply packet with the internal network address stored by the connection-tracking record. The reply packet is then forwarded to the machine at the internal network IP address and internal network port.
  • For outgoing packets, the match attributes are (E.Dest.IP) and internal source addresses (I.Src.IP and I.Src.port) while the action attributes are the external source network addresses (E.Src.IP and E.Src.port). The NAT 220 identifies the source and destination addresses for a header of an outgoing packet to be sent from the network. The NAT 220 then uses the connection tracker 210 to determine whether the source and destination addresses in the header match the (outgoing) match attributes of a connection-tracking record in the connection tracker storage 230. The network address translator 220 then uses the (outgoing) action attributes, E.Src.IP and E.Src.port, to replace the destination network address of the outgoing packet with the internal network address stored by the connection-tracking record. The outgoing packet is then forwarded to the external destination. Some embodiments use hash functions to quickly locate connection-tracking records in connection-tracking storages. The use of such hash functions is further described with respect to FIG. 10 , below.
  • The above described method creates only one mapping connection-tracking record, and then uses different portions of this record for the match and action attributes for flows in the forward and reverse directions. However, in some embodiments, the connection-tracking record includes two sub-records, a first sub-record for the forward direction (i.e., for the subsequent packets of the outgoing flow), and a second sub-record for the reverse direction (i.e., for the packets of the incoming packet flow that is in response to the outgoing packet flow). In such embodiments, the first sub-record maps the combination of the internal source network address and external destination address to the allocated external source network address while the second sub-record maps the combination of the external destination address and the external source network address to the internal source network address. In other embodiments two separate connection-tracking records similar to such sub-records are created, one record for outgoing packets of a flow and one for incoming packets of a response flow.
  • In some embodiments, in addition to the connection-tracking record including the external destination IP, the match attributes also include an external destination port. Such a system allows up to 64K connections for each external destination IP/external destination port pair rather than 64K connections for each external destination IP. FIG. 3 illustrates a network address translation system with a connection tracker 310 that includes external destination ports in its attributes. The network address translator 320 uses a connection tracker 310 to access connection tracker storage 330 in which each connection-tracking record includes, for incoming packets, (1) match attributes: external destination IP (E.Dest.IP), external destination port (E.Dest.port), and external source network addresses (E.Src.IP and E.Src.port), and (2) action attributes: internal source addresses (I.Src.IP and I.Src.port). For outgoing packets, the match attributes are: external destination IP (E.Dest.IP), external destination port (E.Dest.port), and internal source addresses (I.Src.IP and I.Src.port), while the action attributes are: external source network addresses (E.Src.IP and E.Src.port). Some embodiments that include destination port addresses in the connection-tracking records also create two sub-records or two separate connection-tracking records, rather than using a single connection-tracking record and determining which attributes are match or action attributes based on the direction of the packet flow.
  • In some embodiments, the connection-tracking record uses both the external destination address and external source network address for mapping to the internal network address because the external source network address is used as an external source network address for different packet flows to different destination addresses. For instance, as mentioned above, the method of some embodiments uses the same external source IP address along with the same 64K source port range for multiple different destination IP addresses. The method of some embodiments further extends the sharing of the 64K source ports by using this port range not only for different destination IP addresses but also for different destination port addresses to the same destination IP address. This allows the method to support up to 4,294,967,296 (64K multiplied by 64K) connections for each destination IP address.
  • Because of the potentially huge number of ports to be allocated for the multiple flows, it is useful to have a fast and efficient method of allocating and de-allocating ports of an external source network address (e.g., an external source IP address). For the sake of efficiency, rather than allocating the 64K ports of an external source IP in a random manner, some embodiments use a source-port allocation process that pre-allocates groups of source port addresses, assigns source port addresses to new connections from these pre-allocated port groups, and adds new and removes old pre-allocated port groups as the number of connections increases and decreases.
  • FIG. 4 conceptually illustrates such a source-port allocation process 400. The process 400 will be described by reference to an example shown in FIG. 5 , which illustrates pre-allocation of groups of source port addresses and dynamic growth and reduction of these groups as the number of connections increases and decreases. FIG. 5 includes a column of port addresses 500 of an external source IP address, multiple pre-allocated port groups 510 at time T=1, multiple pre-allocated port groups 520 at time T=2, and multiple pre-allocated port groups 530 at time T=3. The available ports 500 include 65,536 (64K) ports numbered from 0 to 65,535.
  • The process 400 (of FIG. 4 ) specifies (at 405) multiple pre-allocated port groups of external port addresses. The port addresses in the pre-allocated port groups are each port addresses of the same external source network address (e.g., of an external source IP address) and are all assigned with respect to the same external destination IP address. In some embodiments, a particular port value is not available to be allocated to a connection unless that port is in a pre-allocated port group. In FIG. 5 , at time T=1, the pre-allocated port groups include two groups 512 and 514. Each of these groups contains 512 pre-allocated ports from the set of possible port addresses 500. Within each pre-allocated port group, the source port addresses are contiguous. Group 512 includes ports 0-511 and group 514 includes ports 512-1023.
  • The process 400 (of FIG. 4 ) allocates/de-allocates (at 410) external source port addresses from the pre-allocated port groups. Ports are allocated (as needed) between machines of the datacenter and machines at external destination addresses. As FIG. 4 shows, operation 410 is applied repeatedly as new connections are needed.
  • When the process 400 determines (at 415) that all pre-allocated ports in the pre-allocated port groups have not been used (e.g., some ports are still available in the pre-allocated port groups) the process 400 determines (at 425) whether new connections that need a new port are to be allocated or an existing connection has terminated and the port for that connection needs to be de-allocated. When ports for new connections are being allocated more frequently than ports for old (terminated) connections are being de-allocated, the process 400 will eventually determine (at 415) that all available ports of the pre-allocated groups are in use (e.g., assigned to connections between machines of the datacenter and the external destination address). In that case, the process 400 pre-allocates (at 420) additional port groups, then returns to operation 425.
  • FIG. 5 illustrates an example of such dynamic modifications of multiple pre-allocated groups 510-530 from time T=1 to time T=3. In this example, 600 external source port addresses in the pre-allocated port groups 512 and 514 have been allocated by time T=1. The pre-allocated group 512 is shown completely shaded to indicate that all 512 ports in group 512 are allocated to various connections between the external source IP address and the particular destination IP address associated with the pre-allocated port groups. Group 514 is partially shaded, with the port number 600 shown as the lowest available port, indicating that group 514 still has available ports 600-1023 to be assigned to new connections.
  • Between time T=1 and time T=2 the process 400 (of FIG. 4 ) allocates (at 410) additional external source port addresses from the pre-allocated port group 514 (of FIG. 5 ) for new connections between the external source IP address and the destination IP address associated with the port groups. At first, each new allocated port address will be one of the available ports in the range 600-1023 from group 514. However, in the illustrated example, the process 400 (of FIG. 4 ) eventually allocates all the available ports in the pre-allocated port group 514. After that, the process 400 determines (at 415) that all pre-allocated ports in the existing port groups are in use. The process 400 then pre-allocates (at 420) an additional port group, group 522 of FIG. 5 . Group 522 also has 512 ports, specifically ports 1024-1535. The process 400 (of FIG. 4 ) then continues to allocate ports (at 410) until all ports of group 522 (of FIG. 5 ) are used, then pre-allocates (at 420) additional port group 524, which also has 512 ports, specifically ports 1536-2047.
  • The process 400 (of FIG. 4 ), when no connection is being allocated/de-allocated determines (at 430) whether it is time to re-examine port group allocation. In some embodiments, this determination is made periodically (e.g., every 5 seconds, every 10 seconds, etc.). In other embodiments, a state of the system may trigger the re-examination (e.g., the process may re-examine group allocation when the existing pre-allocated ports are nearly all used and/or when all ports of a pre-allocated group have become available either at all or for a threshold amount of time). When the process 400 determines (at 430) that it is not time to re-examine port group allocation, the process 400 returns to operation 425.
  • When the process 400 determines (at 430) that it is time for a re-examination and the re-examination determines that the number of connections that need external source ports to connect to the external destination address has changed, the process 400 will dynamically modify (at 435) the number of pre-allocated groups, by either increasing or reducing the number of pre-allocated groups. For example, the process 400 (of FIG. 4 ) reduces (at 435) the number of groups by identifying a pre-allocated port group that is no longer active and removing it after de-allocating (at 410) all of the ports of that pre-allocated port group. Removing the group may mean deleting the group, setting the group into an idle state, or otherwise eliminating it from use. After modifying the number of groups, the process 400 then returns to operation 425 to determine whether connections need to be allocated/de-allocated.
  • In FIG. 5 , sometime between the process adding group 524 and time T=2, connections using ports in group 522 began to terminate. When those connections terminated, the ports became available again and the process 400 de-allocated (at 410) the ports. The newly available ports are shown as the unshaded portion of group 522. In this example, sometime between time T=2 and time T=3, all of the connections in group 522 terminated and the process 400 (of FIG. 4 ) dynamically modified (at 435) the number of groups by removing (e.g., deleting) group 522 (of FIG. 5 ). In the illustrated example, some connections using ports tracked by groups 514 and 524 also terminated between T=2 and T=3, as shown by the unshaded portions of those groups. However, since not all connections with ports tracked by either of those groups terminated, the groups 514 and 524 were not removed by process 400.
  • Although for simplicity of explanation, the description described ports as either only being allocated or only being de-allocated at various times, the process 400 can allocate and de-allocate ports as necessary. For example, the process 400 can allocate a particular port for a new connection after an old connection (to which that port was allocated) terminates. In some embodiments, the method preferentially assigns the lowest available ports to new connections, resulting in a tendency for higher pre-allocated port groups to empty out sooner than lower pre-allocated port groups as overall demand for connections to the destination IP address decreases.
  • Although the above described figures show operations in a particular order, one of ordinary skill in the art will realize that other orders of operations are within the scope of the invention. For example, in the illustrated embodiment, a new port group is created once the last port of the groups are allocated, but in other embodiments, the new port group may be created when the number of available ports in the pre-allocated groups drops below a threshold, in anticipation of a need for more capacity. In still other embodiments, a new port group may be created only when a new connection needs a port and all available ports are already allocated.
  • The illustrated groups track port availability only for connections between one particular external source IP and one particular destination IP. Although packets may come in to or be forwarded from the ports of the external source IP from other destination IP addresses, those connections are not tracked by the illustrated pre-allocated port groups of FIG. 5 , but rather by separate pre-allocated port groups (not shown). That is, in some embodiments, there is a separate set of pre-allocated port groups for the external source address associated with each destination IP address. Furthermore, in some embodiments, there is a separate set of pre-allocated port groups for the external source address associated with each destination IP address/destination port pair. Although the illustrated pre-allocated port groups are each the same size (contain the same number of ports), in other embodiments, some pre-allocated port groups may be different sizes than others.
  • The methods of some embodiments provide efficient ways to search the multiple pre-allocated port groups for available ports. In some methods, each pre-allocated port group is associated with a set of metadata. The set of metadata for each group may include an indicator of how many of the ports tracked by that group are available and may also identify a specific available port tracked by that group (e.g., the lowest available port number tracked by the group).
  • FIG. 6 conceptually illustrates a process 600 of some embodiments to identify and allocate available ports using metadata of pre-allocated port groups. The process 600 uses the metadata to determine whether the existing pre-allocated port groups contain any available ports by iteratively examining metadata for each pre-allocated port group. The process will be described with respect to FIG. 7 . FIG. 7 conceptually illustrates iteratively searching metadata of pre-allocated port groups. FIG. 7 includes 3 pre-allocated port groups, specifically two pre-allocated port groups 705 and 715 with four ports each and a pre-allocated port group 725 with eight ports. The groups 705, 715, and 725 each have accompanying metadata 710, 720, and 730, respectively.
  • The process 600 (of FIG. 6 ) begins when a new connection requires a port allocation. The process 600 identifies (at 605) a new connection that requires an external source port. The new connection will be a connection between a particular external source IP address and a particular external destination IP address. The pre-allocated port groups to be examined are groups of ports for connections to that particular external destination address.
  • The process 600 examines (at 610) the metadata for an unexamined (so far in the port allocation process 600) pre-allocated port group. If the process 600 determines (at 615) that the metadata of the first group indicates that no ports are available, the process 600 determines (at 620) whether any other groups have not had their metadata examined and then cycles through operations 610, 615, and 620 until it identifies (at 615) an available port and proceeds to operation 630 (as described in the next paragraph) or determines (at 620) that the metadata of the last group indicates no available ports. If the metadata of every group indicates no available ports, the process 625 creates a new pre-allocated port group and identifies a first port of the new pre-allocated port group as available before proceeding to operation 630.
  • In the example of FIG. 7 the process 600 starts with the first pre-allocated port group and proceeds sequentially until it finds an available port. The pre-allocated port group 705 has no available ports, as indicated by all four ports of the first pre-allocated port group being shaded. Accordingly, the metadata 710 for group 705 shows no ports available. Therefore, the process 600 (of FIG. 6 ) determines, at 615, that the metadata identifies no port available in the first group. The process 600 then determines (at 620) that the group was not the last pre-allocated port group, because groups 715 and 725 have not been examined.
  • The process 600 then examines (at 610) the metadata for the next pre-allocated port group and returns to operation 615 to determine the results. In the example of FIG. 7 , the next group is pre-allocated port group 715. Pre-allocated port group 715 has two ports available, as indicated in the figure by two unshaded ports. The metadata 720 indicates that two ports are available in the group and that the next assignable port number is 5. Therefore the process 600 (of FIG. 6 ) determines (at 615) that port 5 is available. The process 600 (of FIG. 6 ) then proceeds to operation 630 and allocates port 5 to the new connection.
  • The process 600 then updates (at 635) the pre-allocated port group to indicate that the port is now allocated and updates the metadata to indicate the remaining number of available ports in the group and the number of the next available port. The process 600 then ends. In FIG. 7 , at time T=3, the newly allocated port of group 715 has been shaded to indicate that the port has been allocated and metadata 720 has been updated to indicate only one available port rather than two (as was the case at time T=2) and the next available port is identified in the metadata 720 as port number 6.
  • The metadata in the illustrated example includes the available port with the lowest numerical value as the next port for allocation. However, in other embodiments some other port of the port group may be designated as the next available port (e.g., the longest unused port, the highest numbered available port, etc.).
  • As mentioned above, in some embodiments, the connection using an allocated port may terminate. When the connection terminates, the port is de-allocated. The method of some embodiments, updates (1) the pre-allocated port group to which the de-allocated port belongs and (2) the metadata for that group to indicate that the port is available to be allocated to a new connection for a new outgoing flow (and its reply flow). Furthermore, when all the ports in a particular pre-allocated port group are de-allocated, the method of some embodiments removes the pre-allocated port group as well.
  • FIG. 8 illustrates a process 800 for de-allocating ports. The process 800 will be described with reference to FIG. 9 . FIG. 9 illustrates modifications of pre-allocated port groups upon the de-allocation of ports. The figure includes pre-allocated groups 905, 915, and 925 with metadata sets 910, 920, and 930 respectively. The figure is shown at times T=1 to T=3 as ports of pre-allocated group 905 are de-allocated and at time T=4 after the process 800 has ended and a separate cleanup process of some embodiments has removed an empty (e.g., with no allocated ports) pre-allocated port group.
  • The process 800 (of FIG. 8 ) determines (at 805) that a connection using an external source IP and port to connect to a particular external destination IP address has terminated. In some embodiments, the termination of a connection may be determined by a process that calculates how much time has passed since a packet of an outgoing and/or incoming flow of that connection has been received and identifies the connection as terminated after a threshold time has passed. Additionally or alternatively, a connection may be explicitly terminated by a termination code received from one or both of the machines at the original internal source address and the external destination address.
  • The process 800 then updates (at 810) the pre-allocated port group for that port in the set of pre-allocated port groups associated with that external destination to indicate that the port is available. Two examples of port-group updating are conceptually illustrated in FIG. 9 . At time T=1, the first port of pre-allocated port group 905 is shown by its shading as being allocated to a connection. By time T=2, the first port has been de-allocated, as shown by the lack of shading in the first port of group 905 at time T=2. Similarly, from time T=2 to time T=3, the last remaining allocated port of group 905 is de-allocated, as shown by the removal of its shading.
  • The process 800 (of FIG. 8 ) then updates (at 815) the metadata for the pre-allocated port group. In FIG. 9 , metadata 910 of group 905 is updated from showing 2 available ports in the associated pre-allocated port group 905 at time T=1 to showing 3 available ports at time T=2. In the illustrated embodiment, the metadata includes the first (lowest port numbered) available port as the next available port for allocation. The first available port identified in the metadata is updated from port 1 at time T=1 to port 0 (the de-allocated port) at time T=2. The metadata 910 is updated again at time T=3 to show 4 available ports in group 905. The process 800 (of FIG. 8 ) then ends.
  • In some embodiments, a separate clean-up process (e.g., as discussed with respect to operation 430 and 435 of FIG. 4 ) removes pre-allocated port groups with no allocated ports. In FIG. 9 , group 905 has a remaining allocated port at time T=2, so the group is not removed by such a clean-up process at that time. However, after the last remaining allocated port of group 905 is de-allocated, the group 905 is removed by the clean-up process, leaving only groups 915 and 925 as active pre-allocated groups at time T=4.
  • One of ordinary skill in the art will understand that in the illustrated embodiments of FIGS. 8 and 9 the process 800 updates the metadata 910 for the empty pre-allocated port group 905 before a separate clean-up process removes the group (e.g., using the metadata to identify the group as empty), while other embodiments may simply remove the group when it becomes empty, without updating the metadata first. Although the metadata in the illustrated example includes the available port with the lowest numerical value as the next port for allocation, in other embodiments some other port of the port group may be designated as the next available port (e.g., the longest unused port, the highest numbered available port, etc.).
  • In some embodiments, the pre-allocated port groups are stored as bitmap chunks. In such embodiments, each bit of a bitmap chunk represents a single port, with (i) the port number based on the position of the bit within the bitmap and (ii) the state of the port (allocated or not-allocated) determined by the value of the bit. In some such embodiments, as the number of connections to a destination IP grows, larger pre-allocated port groups are allocated (i.e., as larger bitmap chunks). For example, in some embodiments, the first two pre-allocated chunks are implemented as two 512-bit chunks, the next four pre-allocated chunks are implemented as four 1024-bit chunks, the next eight pre-allocated chunks are implemented as eight 2048-bit chunks, and the next eleven pre-allocated chunks are implemented as eleven 4096-bit chunks. In some embodiments, the maximum total number of bits in all the bitmap chunks for a given destination IP address (or destination IP address and port) is 64K. Other embodiments that implement pre-allocated port groups as bitmaps may use different sizes of bitmap chunks to reach 64K bits or may have other maximum numbers of bits (e.g., in order to limit the number of ports available for connections to a particular destination address).
  • As mentioned above, the method of some embodiments uses hash functions to quickly locate connection-tracking records. FIG. 10 illustrates the use of a hash function to locate tracking-records. The figure includes a set of packet header data 1005, a hash function 1010, and hash buckets 1015 (e.g., rows of a hash table) with tracking record entries 1017. Some of the entries are stored in linked lists 1020 and 1025. One of ordinary skill in the art will understand that although both the data to which the hash function is applied in this figure, and the match and action attributes described with respect to FIGS. 2 and 3 , are packet header data, some or all of the packet header data on which the hash is performed may not be the same as any of the match or action attributes.
  • In the illustrated embodiment of FIG. 10 , when a packet comes into the network, the method identifies the external destination IP (EDI) and external destination port (EDP) values from the packet header data 1005. A hash function 1010 is then applied to the EDI/EDP pairs to identify a particular bucket 1015 of a hash table in which the connection-tracking records 1017 are stored.
  • In some embodiments, hash collisions occur for some flows, such as when multiple connection-tracking records 1017 have the same EDI/EDP pair or when connection-tracking records 1017 of flows with different EDI/EDP pairs hash to the same location. In the event of a hash collision the connection-tracking record entries 1017 are stored in linked lists, such as linked list 1020, which includes three connection-tracking records 1017 from EDI2/EDP3 and linked list 1025 which contains one connection-tracking record 1017 for flows with the EDI1/EDP2 pair and two connection-tracking records 1017 for flows with the EDI2/EDP4 pair.
  • One of ordinary skill in the art will understand that the methods of some embodiments may use other packet header values as inputs for hash functions. For example, the methods of some embodiments may use the entire connection tuple of a packet or any chosen subset of its values as inputs for a hash function. Some embodiments may use multiple instances of one or more hash functions to populate multiple hash tables with the same general purpose. For example, some embodiments may provide a separate hash table for connection-tracking records for each external source IP address. Similarly, in some embodiments, the methods may use multiple hash functions for different purposes. For example, some embodiments use a hash function to sort entries of a hash table containing connection-tracking records and another hash function to identify where pre-allocation port groups are stored for each ESI/EDI pair or EST/EDI/EDP combination. Additionally, although the illustrated embodiment of FIG. 10 shows connection-tracking records 1017 in the buckets 1015, in some embodiments, the hash function identifies the location in the hash table of a pointer that in turn identifies a first entry in a linked list of connection-tracking records, the location of another hash table, the location of a binary tree, etc.
  • FIG. 11 conceptually illustrates an electronic system 1100 with which some embodiments of the invention are implemented. The electronic system 1100 can be used to execute any of the control, virtualization, or operating system applications described above. The electronic system 1100 may be a computer (e.g., a desktop computer, personal computer, tablet computer, server computer, mainframe, a blade computer etc.), or any other 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 1100 includes a bus 1105, processing unit(s) 1110, a system memory 1125, a read-only memory 1130, a permanent storage device 1135, input devices 1140, and output devices 1145.
  • The bus 1105 collectively represents all system, peripheral, and chipset buses that communicatively connect the numerous internal devices of the electronic system 1100. For instance, the bus 1105 communicatively connects the processing unit(s) 1110 with the read-only memory 1130, the system memory 1125, and the permanent storage device 1135.
  • From these various memory units, the processing unit(s) 1110 retrieve 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.
  • The read-only-memory (ROM) 1130 stores static data and instructions that are needed by the processing unit(s) 1110 and other modules of the electronic system. The permanent storage device 1135, 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 1100 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 1135.
  • 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 1135, the system memory 1125 is a read-and-write memory device. However, unlike storage device 1135, the system memory is a volatile read-and-write memory, such a random access memory. The system memory 1125 stores some of the instructions and data that the processor needs at runtime. In some embodiments, the invention's processes are stored in the system memory 1125, the permanent storage device 1135, and/or the read-only memory 1130. From these various memory units, the processing unit(s) 1110 retrieve instructions to execute and data to process in order to execute the processes of some embodiments.
  • The bus 1105 also connects to the input and output devices 1140 and 1145. The input devices 1140 enable the user to communicate information and select commands to the electronic system. The input devices 1140 include alphanumeric keyboards and pointing devices (also called “cursor control devices”). The output devices 1145 display images generated by the electronic system 1100. The output devices 1145 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.
  • Finally, as shown in FIG. 11 , bus 1105 also couples electronic system 1100 to a network 1165 through a network adapter (not shown). In this 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 1100 may be used in conjunction with the invention.
  • 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.
  • 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.
  • 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.
  • 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.
  • 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-virtualized environments that virtualize 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.
  • Hypervisor kernel network interface modules, in some embodiments, are non-VM DCNs that include 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.
  • It should be understood 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.
  • 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 other specific forms without departing from the spirit of the invention. In addition, a number of the figures 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 (18)

1-24. (canceled)
25. A method of allocating external source port addresses for a plurality of connections that share a limited set of external source IP addresses for connections to a destination IP address outside of a network, the method comprising:
specifying a plurality of pre-allocated port groups with each group comprising a plurality of external source port addresses;
allocating, for new connections to the destination IP address, external source port addresses from the pre-allocated groups when external source port addresses are available in the pre-allocated groups; and
dynamically modifying a number of the pre-allocated groups as a number of connections increases or decreases to destinations outside of the network.
26. The method of claim 25, wherein said specifying, allocating and dynamically modifying provide an efficient mechanism for (i) tracking source port addresses assigned to connections to the destination IP address, and (ii) allocating new source port addresses when no previously pre-allocated source port addresses are available.
27. The method of claim 25, wherein each pre-allocated group includes a plurality of source port addresses.
28. The method of claim 27, wherein the source port addresses in each pre-allocated group are contiguous addresses in a range.
29. The method of claim 25, wherein the plurality of pre-allocated groups is a first set of pre-allocated groups, and dynamically modifying the number comprises
identifying a new connection for which an external source port has to be assigned;
determining that the first set of pre-allocated groups does not have an external source port address available to assign to the new connection; and
specifying a second set of pre-allocated groups of external port addresses and allocating an external port address from the second set of pre-allocated groups.
30. The method of claim 25 further comprising:
determining that a pre-allocated group does not have any available port for allocation to a new packet flow; and
selecting another pre-allocated group from which a port should be selected for the new packet flow.
31. The method of claim 25 further comprising:
defining different sets of pluralities of pre-allocated port groups, each set associated with a different external destination IP address;
identifying, for a new packet flow, the port-group set associated with an external destination IP address stored in a header field of the new flow; and
allocating, for the new packet flow, an external port address from a particular pre-allocated port group in the identified port-group set.
32. The method of claim 31 further comprising:
defining, for each external destination IP address, a connection-tracking data store for storing connection-tracking records that map allocated external source port addresses to internal source IP and port addresses within the network, said connection-tracking records for use in performing network address translation on packets of flows exiting the network and performing destination address translation on packets of flows entering the network.
33. The method of claim 25 further comprising:
allocating a bitmap of available source ports;
allocating contiguous blocks of source ports in the bitmap to different pre-allocated port groups; and
using the bitmap to identify the pre-allocated port groups and adjust the number of pre-allocated port groups.
34. A non-transitory machine readable medium storing a program which when executed by one or more processing units allocates external source port addresses for a plurality of connections that share a limited set of external source IP addresses for connections to a destination IP address outside of a network, the program comprising sets of instructions for:
specifying a plurality of pre-allocated port groups with each group comprising a plurality of external source port addresses;
allocating, for new connections to the destination IP address, external source port addresses from the pre-allocated groups when external source port addresses are available in the pre-allocated groups; and
dynamically modifying a number of the pre-allocated groups as a number of connections increases or decreases to destinations outside of the network.
35. The non-transitory machine readable medium of claim 34, wherein said specifying, allocating and dynamically modifying provide an efficient mechanism for (i) tracking source port addresses assigned to connections to the destination IP address, and (ii) allocating new source port addresses when no previously pre-allocated source port addresses are available.
36. The non-transitory machine readable medium of claim 34, wherein each pre-allocated group includes a plurality of source port addresses.
37. The non-transitory machine readable medium of claim 36, wherein the source port addresses in each pre-allocated group are contiguous addresses in a range.
38. The non-transitory machine readable medium of claim 34, wherein the plurality of pre-allocated groups is a first set of pre-allocated groups, and dynamically modifying the number comprises
identifying a new connection for which an external source port has to be assigned;
determining that the first set of pre-allocated groups does not have an external source port address available to assign to the new connection; and
specifying a second set of pre-allocated groups of external port addresses and allocating an external port address from the second set of pre-allocated groups.
39. The non-transitory machine readable medium of claim 34, wherein the program further comprises sets of instructions for:
defining different sets of pluralities of pre-allocated port groups, each set associated with a different external destination IP address;
identifying, for a new packet flow, the port-group set associated with an external destination IP address stored in a header field of the new flow; and
allocating, for the new packet flow, an external port address from a particular pre-allocated port group in the identified port-group set.
40. The non-transitory machine readable medium of claim 39, wherein the program further comprises sets of instructions for:
defining, for each external destination IP address, a connection-tracking data store for storing connection-tracking records that map allocated external source port addresses to internal source IP and port addresses within the network, said connection-tracking records for use in performing network address translation on packets of flows exiting the network and performing destination address translation on packets of flows entering the network.
41. The non-transitory machine readable medium of claim 34, wherein the program further comprises sets of instructions for:
allocating a bitmap of available source ports;
allocating contiguous blocks of source ports in the bitmap to different pre-allocated port groups; and
using the bitmap to identify the pre-allocated port groups and adjust the number of pre-allocated port groups.
US18/137,647 2020-07-02 2023-04-21 Connection tracking records for a very large scale nat engine Pending US20230262020A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US18/137,647 US20230262020A1 (en) 2020-07-02 2023-04-21 Connection tracking records for a very large scale nat engine

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
IN202041028206 2020-07-02
IN202041028206 2020-07-02
US17/072,102 US11689493B2 (en) 2020-07-02 2020-10-16 Connection tracking records for a very large scale NAT engine
US18/137,647 US20230262020A1 (en) 2020-07-02 2023-04-21 Connection tracking records for a very large scale nat engine

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
US17/072,102 Continuation US11689493B2 (en) 2020-07-02 2020-10-16 Connection tracking records for a very large scale NAT engine

Publications (1)

Publication Number Publication Date
US20230262020A1 true US20230262020A1 (en) 2023-08-17

Family

ID=79167880

Family Applications (3)

Application Number Title Priority Date Filing Date
US17/072,102 Active US11689493B2 (en) 2020-07-02 2020-10-16 Connection tracking records for a very large scale NAT engine
US17/072,109 Active US11303609B2 (en) 2020-07-02 2020-10-16 Pre-allocating port groups for a very large scale NAT engine
US18/137,647 Pending US20230262020A1 (en) 2020-07-02 2023-04-21 Connection tracking records for a very large scale nat engine

Family Applications Before (2)

Application Number Title Priority Date Filing Date
US17/072,102 Active US11689493B2 (en) 2020-07-02 2020-10-16 Connection tracking records for a very large scale NAT engine
US17/072,109 Active US11303609B2 (en) 2020-07-02 2020-10-16 Pre-allocating port groups for a very large scale NAT engine

Country Status (4)

Country Link
US (3) US11689493B2 (en)
EP (1) EP4078934A1 (en)
CN (1) CN115769562A (en)
WO (1) WO2022005606A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11689493B2 (en) 2020-07-02 2023-06-27 Vmware, Inc. Connection tracking records for a very large scale NAT engine
CN115865863A (en) * 2022-11-23 2023-03-28 北京有竹居网络技术有限公司 Source address conversion method, device, equipment and storage medium
CN117834580A (en) * 2023-12-13 2024-04-05 天翼云科技有限公司 Network address port conversion method and device, storage medium and electronic equipment

Family Cites Families (39)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6453357B1 (en) * 1999-01-07 2002-09-17 Cisco Technology, Inc. Method and system for processing fragments and their out-of-order delivery during address translation
US7042876B1 (en) 2000-09-12 2006-05-09 Cisco Technology, Inc. Stateful network address translation protocol implemented over a data network
US7248585B2 (en) 2001-10-22 2007-07-24 Sun Microsystems, Inc. Method and apparatus for a packet classifier
US7647427B1 (en) 2002-10-18 2010-01-12 Foundry Networks, Inc. Redundancy support for network address translation (NAT)
US7814232B2 (en) 2003-03-28 2010-10-12 Cisco Technology, Inc. Network address translation with gateway load distribution
WO2006034023A2 (en) 2004-09-16 2006-03-30 Ip Fabrics, Inc. Data plane technology including packet processing for network processors
US8619771B2 (en) * 2009-09-30 2013-12-31 Vmware, Inc. Private allocated networks over shared communications infrastructure
US7715386B2 (en) 2007-03-15 2010-05-11 Microsoft Corporation Reducing network traffic to teredo server
US8194683B2 (en) 2007-03-30 2012-06-05 Microsoft Corporation Teredo connectivity between clients behind symmetric NATs
US8005098B2 (en) * 2008-09-05 2011-08-23 Cisco Technology, Inc. Load balancing across multiple network address translation (NAT) instances and/or processors
US9083587B2 (en) * 2009-08-21 2015-07-14 Cisco Technology, Inc. Port chunk allocation in network address translation
WO2011052082A1 (en) 2009-10-30 2011-05-05 富士通株式会社 Address translation device, address translation method, and address translation program
MY174984A (en) 2010-03-24 2020-05-31 Mimos Berhad Method of communicating signals in 6lowpan network to ipv6 network
CN102377833B (en) 2010-08-19 2015-07-22 华为技术有限公司 Method and device for managing network address translation
US9258271B1 (en) * 2011-01-13 2016-02-09 Google Inc. Network address translation for virtual machines
US9306903B2 (en) 2011-09-13 2016-04-05 Cable Television Laboratories, Inc. Deterministic mapping
US9178846B1 (en) * 2011-11-04 2015-11-03 Juniper Networks, Inc. Deterministic network address and port translation
JP5682610B2 (en) * 2012-11-07 2015-03-11 トヨタ自動車株式会社 In-vehicle communication device, in-vehicle communication system, and communication method
US9331946B2 (en) 2013-01-08 2016-05-03 Hitachi, Ltd. Method and apparatus to distribute data center network traffic
US9876759B2 (en) 2014-04-07 2018-01-23 Benu Networks, Inc. Carrier grade NAT
US10057167B2 (en) * 2014-04-09 2018-08-21 Tallac Networks, Inc. Identifying end-stations on private networks
US20150295869A1 (en) 2014-04-14 2015-10-15 Microsoft Corporation Filtering Electronic Messages
US10135737B2 (en) * 2014-09-30 2018-11-20 Nicira, Inc. Distributed load balancing systems
US9553806B2 (en) * 2015-02-06 2017-01-24 Telefonaktiebolaget L M Ericsson (Publ) Method and system for supporting port ranging in a software-defined networking (SDN) system
US9853903B1 (en) * 2015-04-23 2017-12-26 Cisco Technology, Inc. Simultaneous redirecting and load balancing
US10749808B1 (en) * 2015-06-10 2020-08-18 Amazon Technologies, Inc. Network flow management for isolated virtual networks
US9772915B2 (en) 2015-06-30 2017-09-26 International Business Machines Corporation Cluster file system support for extended network service addresses
US9832072B1 (en) * 2016-05-31 2017-11-28 128 Technology, Inc. Self-configuring computer network router
US10212072B2 (en) * 2016-06-14 2019-02-19 Arista Networks, Inc. Peer state synchronization mechanism for dynamic network address translation (DNAT) in a network element
EP3479553B1 (en) 2016-07-01 2020-04-29 Telefonaktiebolaget LM Ericsson (PUBL) Efficient nat in sdn network
US10382392B2 (en) 2016-08-01 2019-08-13 Big Switch Networks, Inc. Systems and methods for network address translation
US10341371B2 (en) * 2016-08-31 2019-07-02 Nicira, Inc. Identifying and handling threats to data compute nodes in public cloud
US20190364014A1 (en) 2017-01-17 2019-11-28 Nec Corporation Gateway apparatus, network address translation apparatus, communication system, communication method, and program
US10791089B2 (en) * 2017-03-29 2020-09-29 Hewlett Packard Enterprise Development Lp Converged address translation
CN109561164B (en) 2017-09-27 2021-02-09 华为技术有限公司 NAT table entry management method and device and NAT equipment
CN110417924B (en) * 2018-04-28 2021-10-01 华为技术有限公司 Message processing method in distributed equipment and distributed equipment
EP3790260B8 (en) * 2019-09-06 2023-03-29 Rohde & Schwarz GmbH & Co. KG Device and method for identifying network devices in a nat based communication network
US11689493B2 (en) 2020-07-02 2023-06-27 Vmware, Inc. Connection tracking records for a very large scale NAT engine
US11316824B1 (en) 2020-11-30 2022-04-26 Vmware, Inc. Hybrid and efficient method to sync NAT sessions

Also Published As

Publication number Publication date
WO2022005606A1 (en) 2022-01-06
US11689493B2 (en) 2023-06-27
US20220006777A1 (en) 2022-01-06
CN115769562A (en) 2023-03-07
EP4078934A1 (en) 2022-10-26
US20220006776A1 (en) 2022-01-06
US11303609B2 (en) 2022-04-12

Similar Documents

Publication Publication Date Title
US20230262020A1 (en) Connection tracking records for a very large scale nat engine
US11709710B2 (en) Memory allocator for I/O operations
US20210258397A1 (en) Management of update queues for network controller
US11080252B1 (en) Proxy hash table
US20230221874A1 (en) Method of efficiently receiving files over a network with a receive file command
US20230224356A1 (en) Zero-copy method for sending key values
US20200036636A1 (en) Selection of paired transmit queue
US20180337860A1 (en) Fast adjusting load balancer
US10025725B2 (en) Dynamic address translation table allocation
US20230370417A1 (en) Identifying routes with indirect addressing in a datacenter
US6961840B2 (en) Method and apparatus for managing a dynamic alias page table
US11928367B2 (en) Logical memory addressing for network devices
WO2020005831A1 (en) Dynamic distributed data clustering
US20200065013A1 (en) Selective memory page initialization
CN114465956A (en) Method and device for limiting flow rate of virtual machine, electronic equipment and storage medium
WO2023229862A1 (en) Logical memory addressing by smart nic across multiple devices
US20230089300A1 (en) Optimal method for deleting sub-blocks of a pointer block that do not have on-disk metadata headers for addresses
US12008130B1 (en) Secure data access management system
US11900161B2 (en) Memory allocation for processing-in-memory operations
US9753646B2 (en) Providing a reserved data area to use to extend a data set
US11334380B2 (en) Remote memory in hypervisor
US11847052B2 (en) Memory allocation apparatus and method
US10140038B2 (en) Utilization of a thin provision grid storage array
US20240007386A1 (en) Route aggregation for virtual datacenter gateway
US11068411B2 (en) Reducing impact of context switches through dynamic memory-mapping overallocation

Legal Events

Date Code Title Description
STPP Information on status: patent application and granting procedure in general

Free format text: DOCKETED NEW CASE - READY FOR EXAMINATION

AS Assignment

Owner name: VMWARE LLC, CALIFORNIA

Free format text: CHANGE OF NAME;ASSIGNOR:VMWARE, INC.;REEL/FRAME:066692/0103

Effective date: 20231121