Abstract:
In the field of communications technologies, a method for advertising Network Address Translation (NAT) device information is provided, so as to solve a problem in the prior art that a process for finding an NAT device is complex, and that the NAT device information acquired is limited. The method provides a packet carrying the NAT device information for a node in a private network to which the NAT device belongs by carrying the NAT device information in the packet. The method not only enables the nodes in the private network to find the NAT device, but also enables the nodes in the private network to acquire related information of the NAT device. An apparatus and a system for advertising NAT device information are also provided.

Description:
CROSS-REFERENCE TO RELATED APPLICATIONS 
       [0001]    This application is a continuation of International Application No. PCT/CN2009/076060, filed on Dec. 25, 2009, which claims priority to Chinese Patent Application No. 200910105680.2, filed on Feb. 28, 2009, both of which are hereby incorporated by reference in their entireties. 
     
    
     FIELD OF THE INVENTION 
       [0002]    The present invention relates to the field of communications technologies, and in particular, to a method, an apparatus and a system for advertising Network Address Translation (NAT) device information. 
       BACKGROUND OF THE INVENTION 
       [0003]    NAT/NAPT (Network Address Translation/Network Address Port Translation), referred to as NAT in the following, is a technology introduced in 1990s when Internet was developing rapidly, so as to solve a shortage problem of Internet Protocol (IP) addresses. By deploying an NAT device at an edge of a network that uses private network addresses, address information carried in a packet header is translated, so that nodes in the private network may access a public network. Apart from translating private network addresses and public network addresses, NAT may be further used for translation of Internet Protocol version 4 (IPv4) and Internet Protocol version 6 (IPv6) addresses. 
         [0004]    The NAT technology effectively improves utilization efficiency of network addresses, and decreases a consumption rate of the IPv4 addresses. Moreover, NAT only supports one-way initiation of session connection, and nodes in the public network may not actively communicate with the nodes in the private network directly. Therefore, using NAT may secure the private network. 
         [0005]    However, while improving the security, NAT also impedes deployment of applications. As a part of the applications also needs to carry address information in a payload of a packet, when the packet passes through NAT, the address information carried in the payload needs to be translated, which requires special processing for a specific application. NAT seriously affects the deployment of such an application. Secondly, two devices behind NAT may not communicate directly either, because a device behind NAT is neither aware of the existence of NAT, nor aware of public network addresses used by the device. 
         [0006]    In order to realize NAT traversal, the prior art provides solutions of Simple Traversal of User Datagram Protocol (UDP) Through NAT (STUN) and Traversal Using Relay NAT (TURN). STUN and TURN require a special server deployed in the public network. The node in the private network needs to perform repeated information exchange with the server to acquire a public network address of the node in the private network, so as to realize the NAT traversal. 
         [0007]    During the implementation of the present invention, a disadvantage is found: because STUN and TURN are only a method and are not defined as a protocol specifically, at present, each application protocol adopts the method independently; therefore, an implementation cost is still high. 
       SUMMARY OF THE INVENTION 
       [0008]    Accordingly, embodiments of the present invention provide a method, an apparatus and a system for advertising NAT device information. 
         [0009]    A method for advertising NAT device information includes: 
         [0010]    carrying NAT device information in a packet; and 
         [0011]    providing the packet carrying the NAT device information for a node in a private network to which an NAT device belongs. 
         [0012]    An apparatus for advertising NAT device information includes: 
         [0013]    an information module, configured to insert the NAT device information into a packet, so that the packet carries the NAT device information; and 
         [0014]    a sending module, configured to send the packet carrying the NAT device information and provide the packet for a node in a private network to which the NAT device belongs. 
         [0015]    A system for advertising NAT device information includes: 
         [0016]    at least one NAT device, configured to insert the NAT device information into a packet, and provide the packet carrying the NAT device information for a network device in a private network to which the NAT device belongs; and 
         [0017]    at least one network device, located in the private network to which the NAT device belongs, and configured to acquire the NAT device information according to a received packet carrying the NAT device information. 
         [0018]    According to the embodiments of the present invention, not only the nodes in the private network are enabled to find the NAT device, but also the nodes in the private network are enabled to acquire related information of the NAT device. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0019]      FIG. 1  is a flow chart of a method for advertising NAT device information according to an embodiment of the present invention; 
           [0020]      FIG. 2  is a schematic structural diagram of an apparatus for advertising NAT device information according to another embodiment of the present invention; 
           [0021]      FIG. 3  is a schematic structural diagram of an information module  200  in an apparatus for advertising NAT device information according to another embodiment of the present invention; 
           [0022]      FIG. 4  is a schematic structural diagram of an information module  200  in an apparatus for advertising NAT device information according to another embodiment of the present invention; 
           [0023]      FIG. 5  is a schematic structural diagram of a sending module  210  in an apparatus for advertising NAT device information according to another embodiment of the present invention; 
           [0024]      FIG. 6  is a schematic structural diagram of a system for advertising NAT device information according to further another embodiment of the present invention; 
           [0025]      FIG. 7  is a schematic diagram of a format of an Open Shortest Path First (OSPF) Router Information Link State Advertisement (LSA) in an application scenario according to an embodiment of the present invention; and 
           [0026]      FIG. 8  is a schematic diagram of a format of a sub-Type-Length-Value (sub-TLV) of an OSPF Router Information LSA in an application scenario according to an embodiment of the present invention. 
       
    
    
     DETAILED DESCRIPTION OF THE EMBODIMENTS 
       [0027]    In order to make the objectives, technical solutions and advantages of the embodiments of the present invention clearer, the embodiments of the present invention are hereinafter described in detail with reference to the accompanying drawings. 
         [0028]    As shown in  FIG. 1 ,  FIG. 1  is a flow chart of a method for advertising NAT device information according to an embodiment of the present invention, and the method includes the following steps: 
         [0029]    Step  100 : Carry NAT device information in a packet. 
         [0030]    In the embodiment, the packet may be a Dynamic Host Configuration Protocol (DHCP) packet, or may be an Interior Gateway Protocol (IGP) packet such as an OSPF protocol packet, an Intermediate System to Intermediate Systems (ISIS) protocol packet, or a Routing Information Protocol (RIP) packet. Definitely, the packet in the embodiment may also be a Router Advertisement (RA) packet in IPv6. When the NAT device information is inserted into the packets, the packets carry the NAT device information. 
         [0031]    The NAT device information may be address information of an NAT device, for example, an address used by the NAT device to communicate with other nodes in a private network to which the NAT device belongs. Through the address information, network nodes may find the NAT device in the network. Definitely, apart from the address information of the NAT device, optionally, the NAT device information may also include at least one type of the following information: capability information of the NAT device and attribute information of the NAT device. 
         [0032]    The capability information of the NAT device may be one or more types of the following information: 
         [0033]    (a) An IP address version supported by the NAT device. The information may indicate whether the NAT device supports an IPv4 address version or an IPv6 address version, or supports the IPv4 version and the IPv6 version at the same time. 
         [0034]    (b) Whether the NAT device supports an address unnumbered. The information may indicate whether the NAT device allows a node in the private network to which the NAT device belongs to use a public network address and a port range of the NAT device. 
         [0035]    (c) Whether the NAT device is allowed to communicate with other network nodes. The information may indicate whether network nodes are allowed to further communicate with the NAT device to acquire more information or manage NAT. 
         [0036]    The attribute information of the NAT device may be one or more types of the following information: 
         [0037]    (d) Type information of the NAT device. The information may indicate the type information of the NAT device, and common types of the NAT device, for example, include: symmetric NAT, port restricted cone NAT, address restricted cone NAT, and full cone NAT. 
         [0038]    (e) Use priority of the NAT device. The information may indicate the use priority of NAT devices when multiple NAT devices exist, and normally a network device in the private network preferentially uses an NAT device with a high priority. 
         [0039]    (f) An aging time of dynamic address mapping between a private network address and a public network address in the NAT device. The information may indicate a maximum duration of dynamic address mapping information in the NAT device when no packet passes. 
         [0040]    (g) A private network address pool range of the NAT device. The information may indicate addresses that may be used by the private network to which the NAT device belongs, for example 192.168.1.0/24. 
         [0041]    (h) A public network address pool range of the NAT device. The information may indicate a public network address and address segments used by the NAT device, for example 64.1.1.0/24. 
         [0042]    Step  110 : Provide the packet carrying the NAT device information for nodes in a private network to which the NAT device belongs. 
         [0043]    In the embodiment, providing the packet carrying the NAT device information for the nodes in the private network to which the NAT device belongs may be implemented by flooding the packet carrying the NAT device information in the private network to which the NAT device belongs, for example, flooding an OSPF packet carrying the NAT device information in the private network; or may be implemented by sending the packet carrying the NAT device information to the nodes in the private network by unicasting, for example, sending a DHCP packet carrying the NAT device information to the nodes in the private network by unicasting, so that the node in the private network may acquire the NAT device information. Definitely alternatively, the providing the packet carrying the NAT device information for the nodes in the private network to which the NAT device belongs may also be implemented in other manners. For example, if in the private network to which the NAT device belongs, the private network addresses of the nodes only have one network segment, the providing the packet carrying the NAT device information for the nodes in the private network to which the NAT device belongs may be implemented by broadcasting the packet carrying the NAT device information in the private network to which the NAT device belongs. 
         [0044]    The nodes in the private network to which the NAT device belongs may acquire the NAT device information by receiving the packet carrying the NAT device information. For example, when the packet carries the address information and capability information of the NAT device, the nodes in the private network to which the NAT device belongs may use the acquired information to find the NAT device, and further communicate with the NAT device to acquire information such as external addresses of network nodes in the private network. When the packet carries the attribute information of the NAT device, the nodes in the private network to which the NAT device belongs may know basic characteristics of the NAT device through the information, and as a result further optimize some application protocols. For example, in applications such as Peer to Peer (P2P), after knowing the type information of the NAT device, the nodes in the private network may decide whether to choose direct communication between the peers or communication between the peers through relay of a super node. In another example, if the aging time of the dynamic address mapping between the private addresses and public addresses in the NAT device is known, an appropriate sending interval of a keep alive packet may be selected. 
         [0045]    In the embodiment, the nodes in the private network may be a router, a customer border gateway, a Customer Premises Equipment (CPE), or a terminal device. 
         [0046]    In general cases, network nodes such as the router, customer border gateway and CPE acquire the NAT device information directly by receiving the packet carrying the NAT device information. The terminal device acquires the NAT device information indirectly from the above network nodes through router advertisement information or the DHCP. 
         [0047]    In may be seen that, the method for advertising NAT device information according to the embodiment of the present invention not only enables the nodes in the private network to find the NAT device, but also enables the nodes in the private network to acquire related information of the NAT device, so that the NAT does not impede deployment of applications while improving security. In addition, because two devices behind the NAT may know the existence of the NAT according to the NAT device information advertised in the embodiment, the two devices behind the NAT both may conveniently know public network addresses thereof, and therefore, the two devices behind the NAT may communicate with each other conveniently. Eventually, the method of the embodiment may realize NAT traversal with a low cost without deploying a special server. 
         [0048]    Another embodiment of the present invention provides an apparatus for advertising NAT device information. As shown in  FIG. 2 , the apparatus includes: 
         [0049]    an information module  200 , configured to insert NAT device information into a packet, so that the packet carries the NAT device information; and 
         [0050]    a sending module  210 , configured to send the packet carrying the NAT device information and provide the packet carrying the NAT device information for a node in a private network to which the NAT device belongs. 
         [0051]    Specifically, as shown in  FIG. 3 , the information module  200  includes: 
         [0052]    a first adding unit  201 , configured to insert address information of the NAT device into the packet, so that the packet carries the address information of the NAT device. 
         [0053]    Optionally, as shown in  FIG. 4 , the information module  200  may further include: 
         [0054]    a second adding unit  202 , configured to insert capability information and/or attribute information of the NAT device into the packet, so that the packet carries the capability information and/or attribute information of the NAT device. 
         [0055]    Optionally, as shown in  FIG. 5 , the sending module  210  may include one unit or a combination of any units among the following units: 
         [0056]    a flooding unit  211 , configured to flood the packet carrying the NAT device information in the private network to which the NAT device belongs; 
         [0057]    a broadcast unit  212 , configured to broadcast the packet carrying the NAT device information in the private network to which the NAT device belongs; 
         [0058]    a unicast unit  213 , configured to send the packet carrying the NAT device information to the nodes in the private network to which the NAT device belongs by unicasting. 
         [0059]    It should be noted that, for the convenience of understanding,  FIG. 5  only shows a situation that the sending module  210  includes the flooding unit  211 , the broadcast unit  212  and the unicast unit  213  at the same time, and other combination situations are not shown. 
         [0060]    In the embodiment of the present invention, the apparatus for advertising the NAT device information may be an independent network device, for example, an independent NAT device or a DHCP server. When the apparatus is a DHCP server, the NAT device information may be pre-configured on the DHCP server. When the DHCP server communicates with a client, the NAT device information may be inserted into a DHCP response packet and sent to the client, so that the client may acquire the NAT device information. In practice, the NAT device and the DHCP server may be the same device. Therefore, in the embodiment of the present invention, the apparatus for advertising the NAT device information may be a device integrating NAT functions and DHCP server functions. 
         [0061]    Definitely, in the embodiment of the present invention, the apparatus for advertising the NAT device information may also be a component disposed in a network device, for example, a component disposed in the NAT device, or a component disposed in other network devices. 
         [0062]    In may be seen that, the apparatus for advertising NAT device information according to the embodiment of the present invention not only enables the nodes in the private network to find the NAT device, but also enables the nodes in the private network to acquire related information of the NAT device, so that the NAT does not impede deployment of applications while improving security. In addition, because two devices behind the NAT may know the existence of the NAT according to the NAT device information advertised by the apparatus in the embodiment, the two devices behind the NAT both may conveniently know public network addresses thereof, and therefore, the two devices behind the NAT may communicate with each other conveniently. Eventually, the apparatus of the embodiment may realize NAT traversal with a low cost without deploying a special server. 
         [0063]    Another embodiment of the present invention provides a system for advertising NAT device information. As shown in  FIG. 6 , the system includes: 
         [0064]    at least one NAT device, configured to insert NAT device information into a packet, and provide the packet carrying the NAT device information for a network device in a private network to which the NAT device belongs. 
         [0065]    at least one network device, located in the private network to which the NAT device belongs and configured to acquire the NAT device information according to a received packet carrying the NAT device information. 
         [0066]    The system for advertising the NAT device information according to the embodiment of the present invention not only enables the nodes in the private network to find the NAT device, but also enables the nodes in the private network to acquire related information of the NAT device. 
         [0067]    In the embodiment of the present invention, carrying the NAT device information in the packet may be multiplexing an existing option/field in the packet to bear the NAT device information, or may be extending the existing option/field in the packet to bear the NAT device information. Definitely, a new option/field may be added in the packet to bear the NAT device information. 
         [0068]    For a better understanding of the embodiment of the present invention, a specific application scenario of carrying TLV of the NAT device information by extending a Router Information LSA in an OSFP protocol is described. 
         [0069]    In the application scenario, a format of an OSPF Router Information LAS is shown in  FIG. 7 , where 
         [0070]    Type indicates that the TLV is an NAT device information advertisement; 
         [0071]    Length indicates a length of sub-TLVs, for example, the number of bits; and 
         [0072]    Sub-TLVs are child TLVs, and carry various information of the NAT device that needs to be advertised, and a format thereof may be as shown in  FIG. 8 , where: 
         [0073]    Type indicates a type of information of the NAT device that the sub-TLV advertises; 
         [0074]    Address-Type indicates an IP address version of the Value of the sub-TLV, and different values may be used to represent different IP address versions; 
         [0075]    Length indicates a length of Value; and 
         [0076]    Value is the NAT device information. 
         [0077]    When the Value is the address information of the NAT device, which may be an IPv4 address or an IPv6 address according to specification of Address-Type. This part may carry one IP address or carry multiple IP addresses which are generally IP addresses of the same type. 
         [0078]    When the Value is the capability information of the NAT device, each bit may be used to represent a capability of the NAT device, for example, a private network IP address version supported by the NAT device, a public network IP address version supported by the NAT device, and whether the NAT device supports a Carrier Grade NAT (CGN) function. 
         [0079]    When the Value is the attribute information of the NAT device, a fixed format similar to the one used for indicating the capability information of the NAT device may be used to indicate various attribute information of the NAT device; definitely, according to an actual situation, different formats may be used flexibly to indicate different attribute information of the NAT device. 
         [0080]    It should be understood that, in the embodiment of the present invention, the OSPF Router Information LSA may have one sub-TLV, or have multiple sub-TLVs. 
         [0081]    In can be seen that, the system for advertising NAT device information according to the embodiment of the present invention not only enables a network device in the private network to find the NAT device, but also enables the network device in the private network to acquire related information of the NAT device, so that the NAT does not impede deployment of applications while improving security. In addition, because two network devices behind the NAT may know the existence of the NAT according to the NAT device information provided by the NAT device in the embodiment, the two network devices behind the NAT in the private network may conveniently know public network addresses thereof, and therefore, the two network devices behind the NAT in the private network may communicate with each other conveniently. Eventually, the system of the embodiment may realize NAT traversal with a low cost without deploying a special server. 
         [0082]    Through the description of the above embodiments, it is clearly understood by persons skilled in the art that the present invention may be accomplished through software plus a necessary universal hardware platform, or through hardware. Based on this and erstanding, the technical solutions of the present invention may be embodied in the form of a software product. The computer software product may be stored in a storage medium such as a Read Only Memory (ROM)/a Random Access Memory (RAM), a magnetic disk, or an optical disk and contain several instructions adapted to instruct a computer equipment, or a server, or other network devices to perform the method according to the embodiments or a part of the embodiments of the present invention. 
         [0083]    The above embodiments are merely exemplary embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Any modifications, equivalent replacements or improvements made without departing the spirit and principle of the present invention shall fall within the protection scope of the present invention.