CN-119629145-B - Communication method and device
Abstract
The application provides a communication method and a communication device, wherein the method is applied to network equipment and comprises the steps of receiving a first IPv4 message sent by the user equipment, wherein the first IPv4 message comprises a first source address and a first destination address, acquiring a first IPv6 address from a first address mapping table item if the first address mapping table item matched with the first destination address exists in a locally stored address mapping table, acquiring a second IPv6 address from a first address pool according to the first source address, sending a first IPv6 message to a server indicated by the first IPv6 address, wherein the first IPv6 message comprises 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, and the first address pool is a reserved IPv6 address set.
Inventors
- GAO JU
Assignees
- 新华三技术有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20241129
Claims (14)
- 1. A method of communication, the method being applied to a network device, the method comprising: receiving a first IPv4 message sent by user equipment, wherein the first IPv4 message comprises a first source address and a first destination address; If a first address mapping table item matched with the first destination address exists in the locally stored address mapping table, a first IPv6 address is acquired from the first address mapping table item; acquiring a second IPv6 address from a first address pool according to the first source address; Sending a first IPv6 message to a server indicated by the first IPv6 address, wherein the first IPv6 message comprises 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; Wherein the first address pool is a reserved IPv6 address set.
- 2. The method according to claim 1, wherein the method further comprises: receiving a second IPv6 message sent by the server according to the first IPv6 message, wherein the second IPv6 message comprises 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; According to a locally stored session table, a first session table item matched with the second IPv6 address is obtained; Converting the second IPv6 message into a second IPv4 message according to the first session table entry, wherein the second IPv4 message comprises 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; and sending the second IPv4 message to the user equipment.
- 3. The method of claim 1, wherein prior to receiving the first IPv4 message sent by the user equipment, the method further comprises: Receiving a first DNS request sent by the user equipment, wherein the first DNS request comprises a first domain name; sending a second DNS request to a first server, and sending a third DNS request to the second server, wherein the second DNS request comprises the first domain name, and the third DNS request comprises the first domain name; Receiving a first DNS response sent by the first server and a second DNS response sent by the second server; if the first DNS response comprises a first address and the second DNS response comprises a second address, establishing the first address mapping table entry between the first address and the second address; Transmitting a third DNS reply to the user equipment, the third DNS reply including the first address, so that the user equipment takes the first address as the first destination address; 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, wherein the method further comprises: Generating a first session table item, wherein the first session table item comprises a field before address conversion, a field after address conversion and a session state; The pre-address-conversion field stores the first source address and the first destination address, the post-address-conversion field stores the second source address and the second destination address, and the session state is used for indicating the current state of the service flow sent by the user equipment.
- 5. A method according to claim 3, wherein after said receiving the first DNS reply sent by the first server and the second DNS reply sent by the second server, the method further comprises: and if the first DNS response is received and the second DNS response does not comprise the second address, sending the third DNS response to the user equipment.
- 6. The method of claim 5, wherein after receiving the first IPv4 message sent by the user equipment, the method further comprises: and if the first address mapping table item does not exist in the locally stored address mapping table, sending the first IPv4 message in the IPv4 network according to the first destination address.
- 7. A method according to claim 3, wherein after said receiving the first DNS reply sent by the first server and the second DNS reply sent by the second server, the method further comprises: if the second DNS response is received and the first DNS response does not include the first address, acquiring a third address from a second address pool; establishing a second address mapping table item between the third address and the second address; transmitting a fourth DNS reply to the user equipment, the fourth DNS reply including the third address, so that the user equipment takes the third address as the first destination address; the second address pool is a reserved IPv4 address set, and the address type of the third address is an IPv4 address type.
- 8. A communication apparatus, the apparatus being applied to a network device, the apparatus comprising: a receiving unit, configured to receive a first IPv4 packet sent by a user equipment, where the first IPv4 packet includes a first source address and a first destination address; a first obtaining unit, configured to obtain a first IPv6 address from a first address mapping table if a first address mapping table entry matching the first destination address exists in a locally stored address mapping table; The second acquisition unit is used for acquiring a second IPv6 address from the first address pool according to the first source address; a sending unit, configured to send a first IPv6 packet to a server indicated by the first IPv6 address, where 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; Wherein the first address pool is a reserved IPv6 address set.
- 9. The apparatus of claim 8, wherein the receiving unit is further configured to receive a second IPv6 message sent by the server according to the first IPv6 message, the second IPv6 message including a third source address and a third destination address, the third source address being the first IPv6 address, the third destination address being the second IPv6 address; The device also comprises a third acquisition unit, a second acquisition unit and a third acquisition unit, wherein the third acquisition unit is used for acquiring a first session table item matched with the second IPv6 address according to 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, where 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 sending unit is further configured to send the second IPv4 packet to the user equipment.
- 10. The apparatus of claim 8, wherein the receiving unit is further configured to receive a first DNS request sent by the user device, the first DNS request including a first domain name; the sending unit is further configured to send a second DNS request to the first server, and send a third DNS request to the second server, where 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 device also comprises a building unit, a first address mapping table item, a second address mapping table item and a second address mapping table item, wherein the building unit is used for building the first address mapping table item between the first address and the second address if the first DNS response comprises the first address and the second DNS response comprises the second address; The sending unit is further configured to send a third DNS reply to the user equipment, where the third DNS reply includes the first address, so that the user equipment uses the first address as the first destination address; 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 of claim 8, wherein the apparatus further comprises: the generating unit is used for generating a first session table item, wherein the first session table item comprises a field before address conversion, a field after address conversion and a session state; The pre-address-conversion field stores the first source address and the first destination address, the post-address-conversion field stores the second source address and the second destination address, and the session state is used for indicating the current state of the service flow sent by the user equipment.
- 12. The apparatus of claim 10, wherein the sending unit is further configured to send the third DNS reply to the user device if the first DNS reply is received and the second DNS reply does not include the second address.
- 13. The apparatus of claim 12, wherein the sending unit is further configured to send the first IPv4 message in an IPv4 network according to the first destination address if the first address mapping table entry does not exist in the locally stored address mapping table.
- 14. The apparatus of claim 10, wherein the apparatus further comprises: A fourth obtaining unit, configured to obtain a third address from a second address pool if the second DNS reply is received and the first DNS reply does not include the first address; The establishing 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 reply to the user equipment, where the fourth DNS reply includes the third address, so that the user equipment uses the third address as the first destination address; the second address pool is a reserved IPv4 address set, and the address type of the third address is an IPv4 address type.
Description
Communication method and device Technical Field The present application relates to the field of communications technologies, and in particular, to a communications method and apparatus. Background Currently, as internet users continue to increase, the traditional IPv4 address space (about 40 hundred million) has become nearly exhausted, thus severely limiting access to new devices, new users. In addition, with the rapid development of new technologies such as the internet of things, smart home, smart cities and the like, the demands for a large number of connection devices are also increasing. Version 6 of the internetworking protocol (English: internet Protocol Version, abbreviated: IPv 6) is the latest version of the internetworking protocol (English: internet Protocol, abbreviated: IP). The IPv6 address space is relatively large, and considerable address supply is provided, so that the increase of the number of internet devices and users in the future can be met, and the requirements of the emerging technology on address requirements can be met. The IPv6 is used as the next generation internet protocol, has better expandability and flexibility, and can effectively promote the development and innovation of the global internet. Therefore, in order to solve the problem of address shortage of the 4 th edition (English: internet Protocol Version 4, abbreviated: IPv 4) of the Internet protocol, the development of new devices and new technologies is promoted, the network security is improved, and the stable and continuous development of the global Internet is promoted. By gradually transitioning to IPv6, a more reliable and stable foundation can be provided for future Internet development. In the stepwise transition from IPv4 to IPv6, IPv4 clients cannot directly access an IPv6 server, and network address translation (english: network Address Translation, abbreviated: NAT) 46 generally provides for inter-translation between IPv4 addresses and IPv6 addresses to enable communication between networks. For example, a host in an IPv4 network pre-accesses a server in an IPv6 network. After receiving the IPv4 message sent by the host, the NAT46 converts the source address included in the IPv4 message into an IPv6 address according to the address conversion policy configured locally, and forwards the converted IPv4 message to the server. However, in the above-mentioned transition, there is also a problem in that a manager needs to set a conversion relationship between the IPv4 address and the IPv6 address in advance, and configure an address conversion policy in the NAT46 by means of static configuration, and various kinds of IP addresses are inconvenient for the manager to memorize and use. Disclosure of Invention In view of this, the present application provides a communication method and apparatus, which are used to solve the problems that in the transition from IPv4 to IPv6, an address conversion policy needs to be set in advance by a manager and issued in a static configuration manner, and multiple kinds of IP addresses are inconvenient for the manager to memorize and use. In a first aspect, the present application provides a communication method, the method being applied to a network device, the method comprising: receiving a first IPv4 message sent by user equipment, wherein the first IPv4 message comprises a first source address and a first destination address; If a first address mapping table item matched with the first destination address exists in the locally stored address mapping table, a first IPv6 address is acquired from the first address mapping table item; acquiring a second IPv6 address from a first address pool according to the first source address; Sending a first IPv6 message to a server indicated by the first IPv6 address, wherein the first IPv6 message comprises 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; Wherein the first address pool is a reserved IPv6 address set. In a second aspect, the present application provides a communication apparatus, the apparatus being for use in a network device, the apparatus comprising: a receiving unit, configured to receive a first IPv4 packet sent by a user equipment, where the first IPv4 packet includes a first source address and a first destination address; a first obtaining unit, configured to obtain a first IPv6 address from a first address mapping table if a first address mapping table entry matching the first destination address exists in a locally stored address mapping table; The second acquisition unit is used for acquiring a second IPv6 address from the first address pool according to the first source address; a sending unit, configured to send a first IPv6 packet to a server indicated by the first IPv6 address, where the first IPv6 packet includes a second source address and a second destination address, the second source