Communication methods and devices

The communication method and apparatus that dynamically obtains and translates IPv6 addresses solve the static configuration problem of address translation strategies during the transition from IPv4 to IPv6, enabling IPv4 user equipment to access IPv6 servers without being aware of them, simplifying deployment and reducing costs.

CN119629145BActive Publication Date: 2026-05-05NEW H3C TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NEW H3C TECH CO LTD
Filing Date
2024-11-29
Publication Date
2026-05-05

AI Technical Summary

Technical Problem

During the transition from IPv4 to IPv6, address translation policies need to be set up in advance by administrators and distributed in a static configuration manner, and there are problems with the various classes of IP addresses being inconvenient for administrators to remember and use.

Method used

A communication method and apparatus are provided, which receive IPv4 packets from user equipment, dynamically obtain IPv6 addresses and perform conversions using a locally stored address mapping table and an IPv6 address pool, thereby enabling IPv4 user equipment to access IPv6 servers without being aware of them.

Benefits of technology

It simplifies deployment and implementation, reduces costs, and solves the memory and management complexity issues caused by static configuration, thus shortening the transition period.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119629145B_ABST
    Figure CN119629145B_ABST
Patent Text Reader

Abstract

This application provides a communication method and apparatus. The method is applied to a network device and includes: receiving a first IPv4 packet sent by a user equipment, the first IPv4 packet including a first source address and a first destination address; if a first address mapping table entry matching the first destination address exists in a locally stored address mapping table, then obtaining a first IPv6 address from the first address mapping table entry; obtaining a second IPv6 address from a first address pool according to the first source address; sending a first IPv6 packet to a server indicated by the first IPv6 address, the first IPv6 packet including a second source address and a second destination address, the second source address being the second IPv6 address and the second destination address being the first IPv6 address; wherein the first address pool is a reserved set of IPv6 addresses.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technology, and in particular to a communication method and apparatus. Background Technology

[0002] Currently, with the continuous increase in internet users, the traditional IPv4 address space (approximately 4 billion addresses) is nearing exhaustion, which will severely limit the access of new devices and users. Furthermore, with the rapid development of new technologies such as the Internet of Things, smart homes, and smart cities, the demand for a large number of connected devices is also constantly increasing.

[0003] Internet Protocol Version 6 (IPv6) is the latest version of the Internet Protocol (IP). IPv6 has a relatively large address space, providing a considerable supply of addresses to meet the future growth in the number of Internet devices and users, as well as the address requirements of emerging technologies. As the next-generation Internet protocol, IPv6 offers better scalability and flexibility, effectively promoting the development and innovation of the global Internet.

[0004] Therefore, to address the address shortage of Internet Protocol Version 4 (IPv4), promote the development of new devices and technologies, improve network security, and foster the stable and sustainable development of the global internet, a gradual transition to IPv6 can provide a more reliable and stable foundation for the future development of the internet.

[0005] During the transition from IPv4 to IPv6, IPv4 clients cannot directly access IPv6 servers. Network Address Translation (NAT) is typically used to provide the conversion between IPv4 and IPv6 addresses to enable communication between networks. For example, when a host on an IPv4 network tries to access a server on an IPv6 network, NAT receives an IPv4 packet from the host, translates the source address in the IPv4 packet to an IPv6 address according to its locally configured address translation policy, and then forwards the translated IPv4 packet to the server.

[0006] However, the above transition also exposed the following problems: administrators need to set up the translation relationship between IPv4 addresses and IPv6 addresses in advance, and configure the address translation policy in NAT46 through static configuration. In addition, multiple classes of IP addresses are inconvenient for administrators to remember and use. Summary of the Invention

[0007] In view of this, this application provides a communication method and apparatus to solve the problem that in the transition from IPv4 to IPv6, the address translation strategy needs to be set in advance by the administrator and distributed in a static configuration manner, and that multiple types of IP addresses are inconvenient for the administrator to remember and use.

[0008] In a first aspect, this application provides a communication method applied to a network device, the method comprising:

[0009] Receive a first IPv4 packet sent by a user equipment, the first IPv4 packet including a first source address and a first destination address;

[0010] If a first address mapping table entry matching the first destination address exists in the locally stored address mapping table, then the first IPv6 address is obtained from the first address mapping table entry.

[0011] Based on the first source address, obtain the second IPv6 address from the first address pool;

[0012] Send a first IPv6 packet to the server indicated by the first IPv6 address. The first IPv6 packet includes a second source address and a second destination address. The second source address is the second IPv6 address, and the second destination address is the first IPv6 address.

[0013] The first address pool is a set of reserved IPv6 addresses.

[0014] Secondly, this application provides a communication device applied to a network device, the device comprising:

[0015] The receiving unit is configured to receive a first IPv4 packet sent by a user equipment, wherein the first IPv4 packet includes a first source address and a first destination address;

[0016] The first acquisition unit is configured to acquire the first IPv6 address from the first address mapping table entry if there is a first address mapping table entry in the locally stored address mapping table that matches the first destination address.

[0017] The second acquisition unit is used to acquire a second IPv6 address from the first address pool based on the first source address;

[0018] The sending unit is configured to send a first IPv6 packet to the server indicated by the first IPv6 address. The first IPv6 packet includes a second source address and a second destination address, wherein the second source address is the second IPv6 address and the second destination address is the first IPv6 address.

[0019] The first address pool is a set of reserved IPv6 addresses.

[0020] Thirdly, this application provides a network device including a processor and a machine-readable storage medium storing machine-executable instructions that can be executed by the processor, which in turn cause the processor to perform the method provided in the first aspect of this application.

[0021] Therefore, by applying the communication method and apparatus provided in this application, the network device receives a first IPv4 packet sent by a user equipment, the first IPv4 packet including a first source address and a first destination address; if there is a first address mapping table entry in the locally stored address mapping table that matches the first destination address, the network device obtains a first IPv6 address from the first address mapping table entry; according to the first source address, the network device obtains a second IPv6 address from the first address pool; and sends a first IPv6 packet to the server indicated by the first IPv6 address, the first IPv6 packet including a second source address and a second destination address, the second source address being the second IPv6 address and the second destination address being the first IPv6 address; wherein, the first address pool is a reserved set of IPv6 addresses.

[0022] In this way, IPv4 user devices can simultaneously access both IPv4 and IPv6 servers through network devices, with priority given to IPv6 servers. Deployment is simple, low-cost, and shortens the transition period. It also solves the problem that existing address translation policies require administrators to pre-configure and distribute them statically, and that multiple IP address classes are inconvenient for administrators to remember and use. Attached Figure Description

[0023] Figure 1 A flowchart illustrating the communication method provided in the embodiments of this application;

[0024] Figure 2 A schematic diagram illustrating host access to the network provided in an embodiment of this application;

[0025] Figure 3 A structural diagram of a communication device provided in an embodiment of this application;

[0026] Figure 4 The network device hardware structure provided in the embodiments of this application. Detailed Implementation

[0027] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0028] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more of the corresponding listed items.

[0029] It should be understood that although the terms first, second, third, etc., may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."

[0030] The communication method provided in the embodiments of this application will be described in detail below. See also... Figure 1 , Figure 1 This is a flowchart illustrating a communication method provided in an embodiment of this application. The method is applied to a network device, which may have Domain Name System (DNS) proxy functionality and NAT translation functionality. The communication method provided in this application embodiment may include the following steps.

[0031] Step 110: Receive a first IPv4 packet sent by the user equipment, wherein the first IPv4 packet includes a first source address and a first destination address;

[0032] Specifically, a user equipment, such as a host, wishes to access the network. The user equipment generates a first IPv4 packet, which includes a first source address and a first destination address. The user equipment sends the first IPv4 packet to the server indicated by the first destination address.

[0033] After receiving the first IPv4 packet, the network device in the network obtains the first source address and the first destination address from it.

[0034] Wherein, the first source address is the address of the user device, and the first destination address is the address of the server that the user device wants to access.

[0035] In this embodiment of the application, the user equipment may specifically be an IPv4 user equipment, and the first source address and the first destination address are both IPv4 addresses.

[0036] The aforementioned network devices can act as proxy devices between user equipment and servers. For example, a DNS46 proxy server, which has both DNS proxy and NAT translation functions.

[0037] Step 120: If there is a first address mapping table entry in the locally stored address mapping table that matches the first destination address, then obtain the first IPv6 address from the first address mapping table entry;

[0038] Specifically, according to the description of step 110, after the network device obtains the first destination address, it determines whether there is a first address mapping table entry in the locally stored address mapping table that matches the first destination address.

[0039] If a first address mapping table entry exists that matches the first destination address, the network device obtains the first IPv6 address from the first address mapping table entry.

[0040] It is understandable that the address mapping table stores the mapping relationship between IPv4 addresses and IPv6 addresses belonging to the same server.

[0041] Step 130: Obtain the second IPv6 address from the first address pool based on the first source address;

[0042] Specifically, according to the description of step 110, after the network device obtains the first source address, it obtains the second IPv6 address from the first address pool based on the first source address.

[0043] In this embodiment, the network device includes a NAT function module, and the first address pool is a set of IPv6 addresses reserved in the NAT function module. The IPv6 addresses are used for NAT translation of the source address when forwarding IPv4 packets.

[0044] Step 140: Send a first IPv6 packet to the server indicated by the first IPv6 address. The first IPv6 packet includes a second source address and a second destination address. The second source address is the second IPv6 address, and the second destination address is the first IPv6 address.

[0045] Specifically, according to the descriptions of steps 120 and 130, after the network device obtains the first IPv6 address and the second IPv6 address, it performs NAT translation processing on the first source address and the first destination address included in the first IPv4 packet to obtain the first IPv6 packet. This first IPv6 packet includes a second source address and a second destination address. The second source address is the second IPv6 address, and the second destination address is the first IPv6 address.

[0046] Understandably, the first IPv4 packet also includes the source port number. During the NAT translation process, the network device also performs NAT translation on the source port number. Since the NAT translation of the source port number can be performed according to the existing translation process, it will not be repeated here.

[0047] After the NAT translation process described above, the network device sends the first IPv6 packet to the server indicated by the first IPv6 address. In this way, IPv4 user devices can access the IPv6 server preferentially without being aware of it.

[0048] It should be noted that during NAT translation, network devices can uniquely identify a service flow using the source address and source port number. When subsequently receiving a response message from the server, the network device can again uniquely identify the service flow using the destination address and destination port number included in the message (because the server swaps the source and destination addresses of the received message when generating the response message).

[0049] Therefore, by applying the communication method provided in this application, the network device receives a first IPv4 packet sent by a user equipment, the first IPv4 packet including a first source address and a first destination address; if there is a first address mapping table entry in the locally stored address mapping table that matches the first destination address, the network device obtains a first IPv6 address from the first address mapping table entry; according to the first source address, the network device obtains a second IPv6 address from the first address pool; and sends a first IPv6 packet to the server indicated by the first IPv6 address, the first IPv6 packet including a second source address and a second destination address, the second source address being the second IPv6 address and the second destination address being the first IPv6 address; wherein, the first address pool is a reserved set of IPv6 addresses.

[0050] In this way, IPv4 user devices can simultaneously access both IPv4 and IPv6 servers through network devices, with priority given to IPv6 servers. Deployment is simple, low-cost, and shortens the transition period. It also solves the problem that existing address translation policies require administrators to pre-configure and distribute them statically, and that multiple IP address classes are inconvenient for administrators to remember and use.

[0051] Optionally, in this embodiment of the application, the process of the server processing the first IPv6 packet and then sending a second IPv6 packet back to the network device is also included.

[0052] Specifically, after receiving the first IPv6 packet, the server provides the corresponding service to the user equipment based on the content requested in the first IPv6 packet. The server generates a second IPv6 packet, which includes a third source address and a third destination address. The third source address is the first IPv6 address, and the third destination address is the second IPv6 address. The server then sends the second IPv6 packet to the user equipment.

[0053] Similarly, after receiving the second IPv6 packet, the network device obtains the third destination address from it. Understandably, the second IPv6 packet also includes the destination port number. The network device further obtains the destination port number from the second IPv6 packet.

[0054] Based on the third destination address and destination port number, the network device retrieves a first session table entry from the locally stored session table that matches the third destination address and destination port number. Based on the first session table entry, the network device converts the second IPv6 packet into a second IPv4 packet. This second IPv4 packet includes a fourth source address and a fourth destination address, where the fourth source address is the first destination address and the fourth destination address is the first source address.

[0055] After receiving the second IPv4 packet, the network device sends a second IPv4 packet to the user equipment. This second IPv4 packet is the IPv4 packet that the server sends back based on the first IPv4 packet. In this way, the IPv4 user equipment can receive feedback from the IPv6 server without being aware of it.

[0056] The specific process by which the network device converts the second IPv6 packet into the second IPv4 packet according to the first session table entry is as follows: the network device obtains the first source address and the first destination address from the first session table entry, and performs NAT translation on the third source address and the third destination address (for example, translating the third source address into the first destination address and the third destination address into the first source address), thereby obtaining the fourth source address and the fourth destination address.

[0057] Understandably, the first session entry also includes the source port number. Based on the source port number, the network device also performs NAT translation on the destination port number.

[0058] Optionally, in embodiments of this application, the process of establishing a first address mapping table entry by the network device is also included.

[0059] Specifically, before accessing the network, the user equipment needs to obtain the IP address of the server to be accessed. The user equipment generates a first DNS request, which includes a first domain name (e.g., ABCD.com). This first domain name is the domain name of the server to be accessed. The user equipment sends the first DNS request to the network device.

[0060] After receiving the first DNS request, the network device retrieves the first domain name. In this embodiment, the first domain name includes various types. For example, it may be the domain name of a server that supports IPv4 address types, the domain name of a server that supports IPv6 address types, or the domain name of a server that supports both IPv4 and IPv6 address types. The first domain name may specifically be any of the above types.

[0061] A network may include multiple network types (e.g., IPv4 network, IPv6 network) and multiple types of DNS servers corresponding to each network. After obtaining the first domain name, the network device generates a DNS request corresponding to each type of DNS server. For example, based on the first domain name, the network device generates a second DNS request and a third DNS request. The second DNS request includes the first domain name, and the third DNS request also includes the first domain name.

[0062] Network devices send a second DNS request to the first server and a third DNS request to the second server. For example, the first server is an IPv4 DNS server and the second server is an IPv6 DNS server, or vice versa.

[0063] After receiving the DNS request, the first and second servers retrieve the first domain name. They then search their local domain name address tables for a matching entry. If a matching entry is found, the first and second servers retrieve the IP address from that entry.

[0064] The first server and the second server generate a first DNS response and a second DNS response, respectively. The first DNS response includes a first address, and the second DNS response includes a second address. The first server and the second server send the first DNS response and the second DNS response to the network device, respectively.

[0065] After receiving the first DNS response and the second DNS response, if the network device obtains the first address and the second address from them, the network device establishes a first address mapping table entry between the first address and the second address. The network device generates and sends a third DNS response to the user equipment, which includes the first address, so that the user equipment uses the first address as the first destination address.

[0066] In this embodiment of the application, the address type of the first address is IPv4 and the address type of the second address is IPv6.

[0067] Optionally, in this embodiment of the application, after the network device sends the first IPv6 packet to the server, it will also perform the process of generating the first session entry.

[0068] Specifically, the network device generates a first session entry, which includes fields before address translation, fields after address translation, and session state.

[0069] The fields before address translation store the first source address and the first destination address, while the fields after address translation store the second source address and the second destination address. The session state is used to indicate the current state of the service traffic sent by the user equipment.

[0070] In this embodiment of the application, the above-mentioned pre-address translation field is used to store the source address, destination address, source port number, and destination port number included in the first IPv4 packet; the above-mentioned post-address translation field is used to store the source address, destination address, source port number, and destination port number included in the first IPv6 packet; the above-mentioned session state is used to monitor whether the sending and receiving of service traffic meets expectations, so as to prevent some attacks from consuming network device resources and to be used when prematurely aging session entries.

[0071] Optionally, in this embodiment of the application, after the network device receives the first DNS response and the second DNS response, the following process is further included.

[0072] Specifically, after receiving a DNS request, the first server and the second server retrieve the first domain name. The first server and the second server then search their local domain name address tables for a matching entry. If a matching entry is found, the server retrieves the IP address from the entry; otherwise, the server determines that no matching IP address exists within its own database.

[0073] For example, if the first server finds a matching domain name address entry, it retrieves the first address from the domain name address table; if the second server does not find a matching domain name address entry, it cannot retrieve the second address.

[0074] The first server and the second server generate a first DNS response and a second DNS response, respectively. The first DNS response includes the first address, while the second DNS response does not include the second address and is an empty response. The first server and the second server send the first DNS response and the second DNS response to the network device, respectively.

[0075] After receiving the first DNS response and the second DNS response, if the network device obtains the first address but does not obtain the second address, the network device generates and sends a third DNS response to the user equipment. The third DNS response includes the first address, so that the user equipment uses the first address as the first destination address.

[0076] It should be noted that because the network device did not obtain the second address, it could not establish the first mapping table entry. Subsequently, after receiving the first IPv4 packet, if the network device could not find the first address mapping table entry locally, it would send the first IPv4 packet within the IPv4 network based on the first destination address included in the first IPv4.

[0077] Optionally, in this embodiment of the application, after the network device receives the first DNS response and the second DNS response, the following process is further included.

[0078] Specifically, after receiving a DNS request, the first server and the second server retrieve the first domain name. The first server and the second server then search their local domain name address tables for a matching entry. If a matching entry is found, the server retrieves the IP address from the entry; otherwise, the server determines that no matching IP address exists within its own database.

[0079] For example, if the second server finds a matching domain name address entry, it can obtain the second address from the domain name address entry; if the first server does not find a matching domain name address entry, it cannot obtain the first address.

[0080] The first server and the second server generate a first DNS response and a second DNS response, respectively. The first DNS response is empty (excluding the first address), while the second DNS response includes the second address. The first server and the second server then send the first DNS response and the second DNS response to the network device, respectively.

[0081] After receiving the first and second DNS responses, if the network device obtains the second address but not the first address, it retrieves the third address from the second address pool. The network device establishes a second address mapping entry between the third address and the second address. The network device generates and sends a fourth DNS response to the user equipment, which includes the third address, so that the user equipment uses the third address as the first destination address.

[0082] In this embodiment of the application, the second address pool is a set of IPv4 addresses reserved in the NAT function module. The IPv4 addresses are used to provide matching IPv4 addresses for the IPv6 addresses returned by the IPv6 DNS server when no IPv4 address is obtained from the IPv4 DNS server.

[0083] The communication method provided in the embodiments of this application will be described in detail below. See also... Figure 2 , Figure 2 This is a schematic diagram illustrating user equipment accessing a network as provided in an embodiment of this application. Figure 2 The network includes hosts, network devices, IPv4 DNS servers, IPv6 DNS servers, IPv4 servers, IPv6 servers, and IPv4v6 servers.

[0084] The host connects to the network devices; the network devices are connected to the IPv4 network and the IPv6 network respectively; the IPv4 DNS server and the IPv4 server are connected to the IPv4 network respectively; the IPv6 DNS server and the IPv6 server are connected to the IPv6 network respectively; the IPv4v6 server is connected to the IPv4 network and the IPv6 network respectively.

[0085] Specifically, the IPv4 server can provide services with the domain name v4.com, and stores the IPv4 address corresponding to the domain name; the IPv6 server can provide services with the domain name v6.com, and stores the IPv6 address corresponding to the domain name; the IPv4v6 server can provide services with the domain name v4v6.com, and stores both the IPv4 address and the IPv6 address corresponding to the domain name.

[0086] Before accessing the network, a host needs to obtain the IP address of the server to be accessed. In this embodiment, the host's IP address is 192.168.100.1, which is an IPv4 address. Therefore, the IP address of the server that the host needs to obtain should also be an IPv4 address.

[0087] The host generates DNS request 1, which includes domain name 1 (e.g., v4v6.com). Domain name 1 is the domain name provided by the IPv4v6 server to be accessed. The host sends DNS request 1 to the network device.

[0088] After receiving DNS request 1, the network device retrieves domain name 1 from it. For each type of DNS server, the network device generates a corresponding DNS request. For example, based on domain name 1, the network device generates DNS request 2 and DNS request 3. DNS request 2 includes domain name 1, and DNS request 3 includes domain name 1.

[0089] The network devices send DNS request 2 to the IPv4 server and DNS request 3 to the IPv6 server respectively.

[0090] After receiving a DNS request, the IPv4 and IPv6 servers retrieve the domain name 1. They then search their local domain name address tables for a matching entry. If a matching entry is found, the IPv4 and IPv6 servers retrieve the corresponding IP address from the table. For example, IP address 1 and IP address 2. IP address 1 is an IPv4 address, and IP address 2 is an IPv6 address.

[0091] The IPv4 server and the IPv6 server generate DNS response 1 and DNS response 2, respectively. DNS response 1 includes IP address 1, and DNS response 2 includes IP address 2. The IPv4 server and the IPv6 server send DNS response 1 and DNS response 2 to the network device, respectively.

[0092] After receiving DNS response 1 and DNS response 2, if the network device obtains IP address 1 and IP address 2 from them, the network device establishes address mapping table entry 1 between IP address 1 and IP address 2, as shown in Table 1 below.

[0093] Table 1 Address Mapping Entry 1

[0094] IPv4 address IPv6 address IP address 1 IP address 2

[0095] Since the host is an IPv4 host, the network device generates and sends DNS response 3 to the host, which includes IP address 1. After receiving DNS response 3, the host obtains IP address 1 from it, and thus obtains the IP address corresponding to the domain name to be accessed.

[0096] The host wants to access the network. The host generates IPv4 packet 1, which includes source address 1, destination address 1, source port number 1, and destination port number 1. Source address 1 is the host's IPv4 address, i.e., 192.168.100.1, destination address 1 is IP address 1, source port number is port number 1, and destination port number 1 is port number X.

[0097] The host sends IPv4 packet 1. Upon receiving IPv4 packet 1, the network device retrieves the source address 1 (192.168.100.1) and destination address 1 (IP address 1) from it. Based on the destination address 1 (IP address 1), the network device checks if there is a matching entry 1 in its locally stored address mapping table.

[0098] If there is an address mapping table entry 1 that matches destination address 1 (IP address 1) in the address mapping table, the network device obtains IP address 2 from the address mapping table entry.

[0099] Meanwhile, after obtaining source address 1 (192.168.100.1), the network device obtains IP address 3 from address pool 1 based on source address 1 (192.168.100.1). This IP address 3 is also an IPv6 address.

[0100] In this embodiment, the network device includes a NAT function module, and address pool 1 is a set of IPv6 addresses reserved in the NAT function module. The IPv6 addresses are used for NAT translation of the source address when forwarding IPv4 packets.

[0101] After obtaining IP address 2 and IP address 3, the network device updates the source address 1 (192.168.100.1) in IPv4 packet 1 to IP address 3, and updates the destination address 1 (IP address 1) in IPv4 packet 1 to IP address 2, thus obtaining IPv6 packet 1.

[0102] It is understood that IPv4 packet 1 also includes source port number 1 (e.g., port number 1) and destination port number 1. During NAT translation, the network device also performs NAT translation on source port number 1. For example, it translates port number 1 to port number 2. In this embodiment, the network device does not perform NAT translation on destination port number 1.

[0103] After the above NAT translation process, IPv6 packet 1 includes source address 2 (IP address 3), destination address 2 (IP address 2), source port number 2 (port number 2), and destination port number 2 (without NAT translation).

[0104] The network device sends IPv6 packet 1 to the IPv4v6 server indicated by IP address 2 via the IPv6 network. In this way, the host can access the IPv6 server preferentially without being aware of it.

[0105] After sending IPv6 packet 1, the network device uses IPv4 packet 1 and IPv6 packet 1 to generate session table entry 1. The network device obtains the host's IP address, IP address 1, source port number 1, and destination port number 1 from IPv4 packet 1; the network device also obtains IP address 2, IP address 3, source port number 2, and destination port number 2 from IPv6 packet 1.

[0106] In this embodiment, session entry 1 includes a pre-address translation field, a post-address translation field, and a session state. The pre-address translation field stores the host's IP address, IP address 1, port number 1, and port number X included in IPv4 packet 1. The post-address translation field stores the IP address 2, IP address 3, port number 2, and port number X included in IPv6 packet 1. The session state indicates the current status of the service traffic sent by the user equipment. See Table 2 below.

[0107] Table 2. Conversation Item 1

[0108]

[0109] After receiving IPv6 packet 1, the server provides the corresponding service to the host based on the request content of IPv6 packet 1. The server generates IPv6 packet 2, which includes source address 3, destination address 3, source port number 3, and destination port number 3. In other words, the server swaps the source address 2 and destination address 2 in IPv6 packet 1 to obtain IPv6 packet 2, which includes source address 3 and destination address 3. That is, source address 3 is IP address 2, and destination address 3 is IP address 3.

[0110] Similarly, the source port number 2 and destination port number 2 in IPv6 packet 1 are swapped to obtain the source port number 3 and destination port number 3 in IPv6 packet 2. That is, source port number 3 is port number X and destination port number 3 is port number 2.

[0111] The server sends IPv6 packet 2 to the host. After receiving IPv6 packet 2, the network device obtains the destination address 3 (IP address 3) and destination port number 3 (port number 2) from it. Based on the destination address 3 (IP address 3) and destination port number 3 (port number 2), it retrieves the session table entry 1 that matches the destination address 3 (IP address 3) and destination port number 3 (port number 2) from the locally stored session table.

[0112] From session table entry 1, the network device obtains 192.168.100.1 corresponding to IP address 3, IP address 1 corresponding to IP address 2, port number 1 corresponding to port number 2, and port number X corresponding to port number X.

[0113] The network device generates IPv4 packet 2, which includes source address 4, destination address 4, source port number 4, and destination port number 4. The source address 4 is IP address 1, the destination address 4 is 192.168.100.1, the source port number is port number X, and the destination port number is port number 1.

[0114] After receiving IPv4 packet 2, the network device sends IPv4 packet 2 to the host. This IPv4 packet 2 is the IPv4 packet that the server sends back in response to IPv4 packet 1. In this way, hosts with IPv4 addresses can receive responses from the IPv6 server without being aware of them.

[0115] Based on the same inventive concept, embodiments of this application also provide a communication device corresponding to the communication method. See also Figure 3 , Figure 3 A communication device provided in this application embodiment, the device being applied to a network device, the device comprising:

[0116] The receiving unit 310 is configured to receive a first IPv4 packet sent by a user equipment, wherein the first IPv4 packet includes a first source address and a first destination address;

[0117] The first acquisition unit 320 is configured to acquire the first IPv6 address from the first address mapping table entry if there is a first address mapping table entry in the locally stored address mapping table that matches the first destination address.

[0118] The second acquisition unit 330 is used to acquire a second IPv6 address from the first address pool based on the first source address;

[0119] The sending unit 340 is configured to send a first IPv6 packet to the server indicated by the first IPv6 address. The first IPv6 packet includes a second source address and a second destination address. The second source address is the second IPv6 address and the second destination address is the first IPv6 address.

[0120] The first address pool is a set of reserved IPv6 addresses.

[0121] Optionally, the receiving unit 310 is further configured to receive a second IPv6 packet sent by the server according to the first IPv6 packet, wherein the second IPv6 packet includes a third source address and a third destination address, wherein the third source address is the first IPv6 address and the third destination address is the second IPv6 address.

[0122] The device further includes: a third acquisition unit (not shown in the figure), used to acquire a first session table entry that matches the second IPv6 address according to a locally stored session table;

[0123] A conversion unit (not shown in the figure) is used to convert the second IPv6 packet into a second IPv4 packet according to the first session table entry. The second IPv4 packet includes a fourth source address and a fourth destination address, wherein the fourth source address is the first destination address and the fourth destination address is the first source address.

[0124] The sending unit 340 is further configured to send the second IPv4 message to the user equipment.

[0125] Optionally, the receiving unit 310 is further configured to receive a first DNS request sent by the user equipment, wherein the first DNS request includes a first domain name;

[0126] The sending unit 340 is further configured to send a second DNS request to the first server and a third DNS request to the second server, wherein the second DNS request includes the first domain name and the third DNS request includes the first domain name;

[0127] The receiving unit 310 is further configured to receive a first DNS response sent by the first server and a second DNS response sent by the second server.

[0128] The apparatus further includes: an establishment unit (not shown in the figure), configured to establish a first address mapping table entry between the first address and the second address if the first DNS response includes a first address and the second DNS response includes a second address;

[0129] The sending unit 340 is further configured to send a third DNS response to the user equipment, the third DNS response including the first address, so that the user equipment uses the first address as the first destination address;

[0130] Wherein, the first server is an IPv4 DNS server, the second server is an IPv6 DNS server, the address type of the first address is an IPv4 address type, and the address type of the second address is an IPv6 address type.

[0131] Optionally, the device further includes:

[0132] The generation unit (not shown in the figure) is used to generate the first session table entry, which includes the fields before address translation, the fields after address translation, and the session state.

[0133] The field before address translation stores the first source address and the first destination address, and the field after address translation stores the second source address and the second destination address. The session state is used to indicate the current state of the service traffic sent by the user equipment.

[0134] Optionally, the sending unit 340 is further configured to send the third DNS response to the user equipment if the first DNS response is received and the second DNS response does not include the second address.

[0135] Optionally, the sending unit 340 is further configured to, if the first address mapping table entry does not exist in the locally stored address mapping table, send the first IPv4 packet within the IPv4 network according to the first destination address.

[0136] Optionally, the device further includes:

[0137] The fourth acquisition unit (not shown in the figure) is used to acquire a third address from the second address pool if the second DNS response is received and the first DNS response does not include the first address.

[0138] The establishment unit is further configured to establish a second address mapping table entry between the third address and the second address;

[0139] The sending unit (not shown in the figure) is further configured to send a fourth DNS response to the user equipment, the fourth DNS response including the third address, so that the user equipment uses the third address as the first destination address;

[0140] The second address pool is a set of reserved IPv4 addresses, and the third address is of IPv4 address type.

[0141] Therefore, by applying the communication device provided in this application, the network device receives a first IPv4 packet sent by a user equipment, the first IPv4 packet including a first source address and a first destination address; if there is a first address mapping table entry in the locally stored address mapping table that matches the first destination address, the network device obtains a first IPv6 address from the first address mapping table entry; according to the first source address, the network device obtains a second IPv6 address from the first address pool; and sends a first IPv6 packet to the server indicated by the first IPv6 address, the first IPv6 packet including a second source address and a second destination address, the second source address being the second IPv6 address and the second destination address being the first IPv6 address; wherein, the first address pool is a reserved set of IPv6 addresses.

[0142] In this way, IPv4 user devices can simultaneously access both IPv4 and IPv6 servers through network devices, with priority given to IPv6 servers. Deployment is simple, low-cost, and shortens the transition period. It also solves the problem that existing address translation policies require administrators to pre-configure and distribute them statically, and that multiple IP address classes are inconvenient for administrators to remember and use.

[0143] Based on the same inventive concept, embodiments of this application also provide a network device, such as... Figure 4 As shown, the system includes a processor 410, a transceiver 420, and a machine-readable storage medium 430. The machine-readable storage medium 430 stores machine-executable instructions that can be executed by the processor 410. The processor 410 is prompted by the machine-executable instructions to execute the communication method provided in the embodiments of this application. (The foregoing...) Figure 3 The communication device shown can be used as follows: Figure 4 The hardware structure of the network device shown is implemented.

[0144] The aforementioned computer-readable storage medium 430 may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the computer-readable storage medium 430 may also be at least one storage device located remotely from the aforementioned processor 410.

[0145] The processor 410 mentioned above can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0146] In this embodiment of the application, the processor 410 reads the machine-executable instructions stored in the machine-readable storage medium 430, and is prompted by the machine-executable instructions to enable the processor 410 itself and the transceiver 420 to execute the communication method described in the foregoing embodiment of the application.

[0147] In addition, this application provides a machine-readable storage medium 430 that stores machine-executable instructions. When called and executed by the processor 410, the machine-executable instructions cause the processor 410 itself and the transceiver 420 to execute the communication method described in the aforementioned application.

[0148] The specific implementation process of the functions and roles of each unit in the above device can be found in the implementation process of the corresponding steps in the above method, and will not be repeated here.

[0149] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this application according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0150] For the embodiments of communication devices and machine-readable storage media, since the methods involved are basically similar to those of the aforementioned method embodiments, the description is relatively simple, and relevant details can be found in the descriptions of the method embodiments.

[0151] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A communication method, characterized in that, The method is applied to a network device, and the method includes: Receive a first IPv4 packet sent by a user equipment, the first IPv4 packet including a first source address and a first destination address; If a first address mapping table entry matching the first destination address exists in the locally stored address mapping table, then the first IPv6 address is obtained from the first address mapping table entry. Based on the first source address, obtain the second IPv6 address from the first address pool; Send a first IPv6 packet to the server indicated by the first IPv6 address. The first IPv6 packet includes a second source address and a second destination address. The second source address is the second IPv6 address, and the second destination address is the first IPv6 address. The first address pool is a set of reserved IPv6 addresses.

2. The method according to claim 1, characterized in that, The method further includes: Receive a second IPv6 packet sent by the server based on the first IPv6 packet. The second IPv6 packet includes a third source address and a third destination address. The third source address is the first IPv6 address, and the third destination address is the second IPv6 address. Based on the locally stored session table, retrieve the first session table entry that matches the second IPv6 address; According to the first session table entry, the second IPv6 packet is converted into a second IPv4 packet. The second IPv4 packet includes a fourth source address and a fourth destination address. The fourth source address is the first destination address, and the fourth destination address is the first source address. The second IPv4 message is sent to the user equipment.

3. The method according to claim 1, characterized in that, Before receiving the first IPv4 packet sent by the user equipment, the method further includes: Receive a first DNS request sent by the user equipment, wherein the first DNS request includes a first domain name; Send a second DNS request to the first server and a third DNS request to the second server, wherein the second DNS request includes the first domain name and the third DNS request includes the first domain name; Receive the first DNS response sent by the first server and the second DNS response sent by the second server; If the first DNS response includes a first address and the second DNS response includes a second address, then establish the first address mapping table entry between the first address and the second address; Send a third DNS response to the user equipment, the third DNS response including the first address, so that the user equipment uses the first address as the first destination address; Wherein, the first server is an IPv4 DNS server, the second server is an IPv6 DNS server, the address type of the first address is an IPv4 address type, and the address type of the second address is an IPv6 address type.

4. The method according to claim 1, characterized in that, The method further includes: Generate a first session table entry, which includes fields before address translation, fields after address translation, and session status. The field before address translation stores the first source address and the first destination address, and the field after address translation stores the second source address and the second destination address. The session state is used to indicate the current state of the service traffic sent by the user equipment.

5. The method according to claim 3, characterized in that, After receiving the first DNS response sent by the first server and the second DNS response sent by the second server, the method further includes: If the first DNS response is received and the second DNS response does not include the second address, then the third DNS response is sent to the user equipment.

6. The method according to claim 5, characterized in that, After receiving the first IPv4 packet sent by the user equipment, the method further includes: If the first address mapping table entry does not exist in the locally stored address mapping table, then the first IPv4 packet is sent within the IPv4 network according to the first destination address.

7. The method according to claim 3, characterized in that, After receiving the first DNS response sent by the first server and the second DNS response sent by the second server, the method further includes: If the second DNS response is received and the first DNS response does not include the first address, then obtain the third address from the second address pool; Establish a second address mapping entry between the third address and the second address; Send a fourth DNS response to the user equipment, the fourth DNS response including the third address, so that the user equipment uses the third address as the first destination address; The second address pool is a set of reserved IPv4 addresses, and the third address is of IPv4 address type.

8. A communication device, characterized in that, The device is used in a network device, and the device includes: The receiving unit is configured to receive a first IPv4 packet sent by a user equipment, wherein the first IPv4 packet includes a first source address and a first destination address; The first acquisition unit is configured to acquire the first IPv6 address from the first address mapping table entry if there is a first address mapping table entry in the locally stored address mapping table that matches the first destination address. The second acquisition unit is used to acquire a second IPv6 address from the first address pool based on the first source address; The sending unit is configured to send a first IPv6 packet to the server indicated by the first IPv6 address. The first IPv6 packet includes a second source address and a second destination address, wherein the second source address is the second IPv6 address and the second destination address is the first IPv6 address. The first address pool is a set of reserved IPv6 addresses.

9. The apparatus according to claim 8, characterized in that, The receiving unit is further configured to receive a second IPv6 packet sent by the server according to the first IPv6 packet, wherein the second IPv6 packet includes a third source address and a third destination address, wherein the third source address is the first IPv6 address and the third destination address is the second IPv6 address; The device further includes: a third acquisition unit, configured to acquire a first session table entry that matches the second IPv6 address based on a locally stored session table; The conversion unit is configured to convert the second IPv6 packet into a second IPv4 packet according to the first session table entry. The second IPv4 packet includes a fourth source address and a fourth destination address, wherein the fourth source address is the first destination address and the fourth destination address is the first source address. The sending unit is further configured to send the second IPv4 message to the user equipment.

10. The apparatus according to claim 8, characterized in that, The receiving unit is further configured to receive a first DNS request sent by the user equipment, wherein the first DNS request includes a first domain name; The sending unit is further configured to send a second DNS request to the first server and a third DNS request to the second server, wherein the second DNS request includes the first domain name and the third DNS request includes the first domain name; The receiving unit is further configured to receive a first DNS response sent by the first server and a second DNS response sent by the second server; The apparatus further includes: an establishment unit, configured to establish a first address mapping table entry between the first address and the second address if the first DNS response includes a first address and the second DNS response includes a second address; The sending unit is further configured to send a third DNS response to the user equipment, the third DNS response including the first address, so that the user equipment uses the first address as the first destination address; Wherein, the first server is an IPv4 DNS server, the second server is an IPv6 DNS server, the address type of the first address is an IPv4 address type, and the address type of the second address is an IPv6 address type.

11. The apparatus according to claim 8, characterized in that, The device further includes: The generation unit is used to generate a first session table entry, which includes fields before address translation, fields after address translation, and session status. The field before address translation stores the first source address and the first destination address, and the field after address translation stores the second source address and the second destination address. The session state is used to indicate the current state of the service traffic sent by the user equipment.

12. The apparatus according to claim 10, characterized in that, The sending unit is further configured to send the third DNS response to the user equipment if the first DNS response is received and the second DNS response does not include the second address.

13. The apparatus according to claim 12, characterized in that, The sending unit is further configured to, if the first address mapping table entry does not exist in the locally stored address mapping table, send the first IPv4 packet within the IPv4 network according to the first destination address.

14. The apparatus according to claim 10, characterized in that, The device further includes: The fourth acquisition unit is configured to acquire a third address from the second address pool if the second DNS response is received and the first DNS response does not include the first address; The establishment unit is further configured to establish a second address mapping table entry between the third address and the second address; The sending unit is further configured to send a fourth DNS response to the user equipment, the fourth DNS response including the third address, so that the user equipment uses the third address as the first destination address; The second address pool is a set of reserved IPv4 addresses, and the third address is of IPv4 address type.

Citation Information

Patent Citations

  • Data processing method and data processing device

    CN104378301A

  • Load balancing method and device, electronic equipment and storage medium

    CN115766588A