CN114710466B - IPV6 address translation method, device, equipment and medium based on address pool offset - Google Patents

IPV6 address translation method, device, equipment and medium based on address pool offset Download PDF

Info

Publication number
CN114710466B
CN114710466B CN202210399548.2A CN202210399548A CN114710466B CN 114710466 B CN114710466 B CN 114710466B CN 202210399548 A CN202210399548 A CN 202210399548A CN 114710466 B CN114710466 B CN 114710466B
Authority
CN
China
Prior art keywords
address
byte order
conversion
converted
pool
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210399548.2A
Other languages
Chinese (zh)
Other versions
CN114710466A (en
Inventor
梁雅静
王京烁
鲍晓玲
孙峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Topsec Technology Co Ltd
Beijing Topsec Network Security Technology Co Ltd
Beijing Topsec Software Co Ltd
Original Assignee
Beijing Topsec Technology Co Ltd
Beijing Topsec Network Security Technology Co Ltd
Beijing Topsec Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Topsec Technology Co Ltd, Beijing Topsec Network Security Technology Co Ltd, Beijing Topsec Software Co Ltd filed Critical Beijing Topsec Technology Co Ltd
Priority to CN202210399548.2A priority Critical patent/CN114710466B/en
Publication of CN114710466A publication Critical patent/CN114710466A/en
Application granted granted Critical
Publication of CN114710466B publication Critical patent/CN114710466B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate

Landscapes

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

Abstract

The present disclosure relates to an IPV6 address translation method, apparatus, device, and medium based on address pool offset, wherein the method comprises: acquiring an address conversion request; the address conversion request comprises an address to be converted, and an address conversion strategy matched with the address to be converted is obtained; the address conversion strategy comprises an address object before conversion and an address object after conversion, the offset is determined based on the address type of the address object before conversion, the address to be converted and the address pool of the address object before conversion, and the target conversion address is determined based on the address type of the address object after conversion, the offset and the address pool of the address object after conversion. Therefore, the conversion among different address types is supported, the application range is wide, the converted address can be configured in the address conversion strategy, the converted address does not need to be calculated, and the maintenance and management of the IPv6 network are more convenient.

Description

IPV6 address translation method, device, equipment and medium based on address pool offset
Technical Field
The present disclosure relates to the field of security service technologies, and in particular, to an IPV6 address translation method, apparatus, device, and medium based on address pool offset.
Background
The IPv6 is a thorough solution for solving the problem of IP address shortage, and with the continuous expansion of network user scale, the use of IPv6 is wider and wider, and the demand for control and management of IPv6 networks is also larger and larger. The NAT (Network Address Translation) technology not only alleviates the problem of IP Address shortage, but also hides and protects the computer inside the Network, effectively avoiding attacks from outside the Network. By combining NAT and IPv6, the maintenance and management cost of IPv6 network can be effectively reduced and hacker attack can be reduced.
In the related art, the IPv6 address is translated by replacing the address prefix in the IPv6 address and modifying the following 16 bits to ensure that the checksum does not change. However, since the checksum is guaranteed to be unchanged, the user does not know the converted source address and the converted destination address, when the destination conversion is used, the real destination address after conversion needs to be calculated by using a conversion tool, and the destination configures an IP (Internet Protocol) according to the calculated address, which increases the cost for maintaining and managing the IPv6 network. In addition, only source conversion and destination conversion are supported, and only the subnet addresses can be converted due to algorithm limitation, and the lengths of the subnet prefixes before and after conversion are required to be equal and must be between 16 and 112, thereby greatly limiting the applicable scenarios.
Disclosure of Invention
To solve the above technical problem or at least partially solve the above technical problem, the present disclosure provides an IPV6 address translation method, apparatus, device, and medium based on an address pool offset.
The present disclosure provides an IPV6 address translation method based on address pool offset, including:
acquiring an address conversion request; wherein the address translation request comprises an address to be translated;
acquiring an address conversion strategy matched with the address to be converted; wherein the address translation policy includes a pre-translation address object and a post-translation address object;
determining an offset based on the address type of the address object before conversion, the address to be converted and an address pool of the address object before conversion;
determining a target translation address based on the address type of the translated address object, the offset, and the address pool of the translated address object.
In an optional embodiment of the present disclosure, the determining an offset based on the address type of the address object before conversion, the address to be converted, and the address pool of the address object before conversion includes:
when the address type of the address object before the conversion is the host address type, circularly judging whether the address to be converted is equal to the address in the address pool of the address object before the conversion;
and when the address to be converted is equal to the address in the address pool of the address object before conversion, returning the cycle number, and taking the cycle number as the offset.
In an optional embodiment of the present disclosure, the determining an offset based on the address type of the address object before conversion, the address to be converted, and the address pool of the address object before conversion includes:
when the address type of the address object before conversion is a subnet address type, judging whether the subnet prefixes of the address to be converted and the address object before conversion are equal;
if the addresses are equal, converting the first address in the address pool of the address object to be converted and the address object before conversion from a network byte order to a host byte order to obtain a first byte order and a second byte order;
and calculating the difference value of the first byte order and the second byte order to obtain the offset.
In an optional embodiment of the present disclosure, the determining an offset based on the address type of the address object before conversion, the address to be converted, and the address pool of the address object before conversion includes:
when the address type of the address object before the conversion is a range address type, judging whether the address to be converted is in the range of the address object before the conversion;
if the address is in the range, converting the address to be converted and the first address in the address pool of the address object before conversion from a network byte order to a host byte order to obtain a third byte order and a fourth byte order;
and calculating the difference value of the third byte order and the fourth byte order to obtain the offset.
In an optional embodiment of the present disclosure, the determining a target translation address based on the address type of the translated address object, the offset, and the address pool of the translated address object includes:
and when the address type of the address object after the conversion is the host address type, taking a first offset address in an address pool of the address object after the conversion as the target conversion address.
In an optional embodiment of the present disclosure, the determining a target translation address based on the address type of the translated address object, the offset, and the address pool of the translated address object includes:
when the address type of the converted address object is a subnet address type, acquiring a first address of an address pool of the converted address object;
converting the first address of the address pool of the converted address object from a network byte order to a host byte order to obtain a first byte order;
and calculating the sum of the first byte order and the offset to obtain a target byte order, and converting the target byte order from the host byte order to the network byte order to obtain the target conversion address.
In an optional embodiment of the present disclosure, the determining a target translation address based on the address type of the translated address object, the offset, and the address pool of the translated address object by using the IPV6 address translation method based on the address pool offset includes:
when the address type of the address object after the conversion is the range address type, acquiring a first address of an address pool of the address object after the conversion;
converting the first address of the address pool of the converted address object from a network byte order to a host byte order to obtain a first byte order;
and calculating the sum of the first byte order and the offset to obtain a target byte order, and converting the target byte order from the host byte order to the network byte order to obtain the target conversion address.
The present disclosure provides an IPV6 address translation apparatus based on address pool offset, including:
the first acquisition module is used for acquiring an address conversion request; wherein, the address translation request comprises an address to be translated;
the second acquisition module is used for acquiring the address conversion strategy matched with the address to be converted; wherein the address translation policy includes a pre-translation address object and a post-translation address object;
a first determining module, configured to determine an offset based on the address type of the address object before conversion, the address to be converted, and an address pool of the address object before conversion;
a second determining module, configured to determine a target translation address based on the address type of the translated address object, the offset, and an address pool of the translated address object.
The present disclosure provides an electronic device, including: a processor and a memory;
the processor is configured to execute the IPV6 address translation method based on address pool offset according to the foregoing embodiment by calling a program or instructions stored in the memory.
The present disclosure provides a computer-readable storage medium storing a program or instructions for causing a computer to execute the IPV6 address translation method based on address pool offsets described in the foregoing embodiments.
Compared with the prior art, the technical scheme provided by the embodiment of the disclosure has the following advantages:
acquiring an address conversion request; the address conversion request comprises an address to be converted, and an address conversion strategy matched with the address to be converted is obtained; the address conversion strategy comprises an address object before conversion and an address object after conversion, the offset is determined based on the address type of the address object before conversion, the address to be converted and the address pool of the address object before conversion, and the target conversion address is determined based on the address type of the address object after conversion, the offset and the address pool of the address object after conversion. Therefore, the conversion among different address types is supported, the application range is wide, the converted address can be configured in the address conversion strategy, the converted address does not need to be calculated, and the maintenance and management of the IPv6 network are more convenient.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
In order to more clearly illustrate the embodiments or technical solutions in the prior art of the present disclosure, the drawings used in the description of the embodiments or prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a flowchart illustrating an IPV6 address translation method based on address pool offset according to an embodiment of the present disclosure;
fig. 2 is a diagram illustrating a scenario of an IPV6 address translation method based on an address pool offset according to an embodiment of the present disclosure;
fig. 3 is a diagram illustrating an exemplary structure of an IPV6 address translation apparatus based on an address pool offset according to an embodiment of the present disclosure.
Detailed Description
In order that the above objects, features and advantages of the present disclosure may be more clearly understood, aspects of the present disclosure will be further described below. It should be noted that the embodiments and features of the embodiments of the present disclosure may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present disclosure, but the present disclosure may be practiced in other ways than those described herein; it is to be understood that the embodiments disclosed in the specification are only a few embodiments of the present disclosure, and not all embodiments.
In practical application, because the address translation algorithm adopted by the MAP66 requires that the checksum is guaranteed to be unchanged, the user is not aware of the translated source address and the translated destination address, the translated real destination address needs to be calculated by means of a translation tool, only the source translation and the destination translation are supported, and because of algorithm limitation, only the subnet address can be translated, and the subnet prefixes before and after translation are required to be equal in length and must be between 16 and 112, thereby greatly limiting the applicable scenarios.
In view of the above problems, an embodiment of the present disclosure provides an IPV6 address translation method based on address pool offset, which supports translation between different address types, has a wide application range, can configure a translated address in an address translation policy, does not need to calculate and compute the translated address, is more convenient for maintenance and management of an IPV6 network, adjusts the address translation policy according to an application scenario, actual requirements, and performance of equipment, and further meets the requirements for flexibility and diversity of IPV6 address translation.
Specifically, IPv6 host addresses, subnet addresses and range addresses can be converted, and source conversion, destination conversion and bidirectional conversion are supported. In addition, the method requires that the size of the address pools of the addresses before and after conversion is equal, and the threshold value of the address pools can be adjusted according to actual requirements and the performance of equipment.
Fig. 1 is a flowchart illustrating an IPV6 address translation method based on address pool offsets according to an embodiment of the present disclosure.
Step 101, obtaining an address translation request; wherein the address translation request includes an address to be translated.
In the embodiment of the present disclosure, the address translation request refers to a request for triggering address translation operation generation, including an address to be translated; wherein, the address to be converted refers to the address information of the quintuple in the message.
102, acquiring an address translation strategy matched with an address to be translated; wherein the address translation policy includes a pre-translation address object and a post-translation address object.
In the embodiment of the present disclosure, the address translation policy is configured in advance, for example, the policy includes whether only one address object before and after translation is referenced, whether the address object type is an IPv6 address type, whether the number of address pools before and after translation is equal, whether the size of the address pool exceeds a threshold, and the like. And adjusting an address translation strategy according to an application scene, actual requirements and the performance of equipment, and further meeting the requirements of flexibility and diversity of IPV6 address translation.
The IPv6 address types comprise an IPv6 host address type, an IPv6 subnet address type and an IPv6 range address type. For the IPv6 host address type, all addresses and other information in the host address pool are stored in the address object, for the IPv6 subnet address type, the address object stores information such as the first address of the subnet address, the prefix length of the subnet, and the like, and for the IPv6 range address type, the address object stores information such as the starting address and the ending address of the range address. For example, the host address object includes address 1, address 2, through address n; the range address object comprises a starting address ipaddr1, an ending address ipaddr2 and the like; the subnet address object includes a start address ipaddr, a subnet prefix length prefix, and the like.
Wherein the content of the first and second substances, whether the number of address pools before and after conversion is equal and whether the address pool size exceeds the threshold value may be specifically expressed as "if (orig _ addr _ pool = trans _ addr _ pool) & (0- <orig_addr_pool_num) & (0- < -trans_addr_pool _upool _num) } where, orig _ addr _ pool represents the number of addresses in the address pool before translation, trans _ addr _ pool represents the number of address pools for addresses after translation, and pool _ num represents the threshold for the size of the address pools.
In the embodiment of the present disclosure, after receiving an address translation request, address information, that is, an address to be translated, is obtained from a message five-tuple, and an address translation policy, that is, an address object before translation, an address object after translation, and the like, that is, the address to be translated is obtained.
Step 103, determining an offset based on the address type of the address object before conversion, the address to be converted and the address pool of the address object before conversion.
In some embodiments, when the address type of the address object before translation is the host address type, the loop is determined to determine whether the address to be translated is equal to the address in the address pool of the address object before translation, and when the address to be translated is equal to the address in the address pool of the address object before translation, the loop is returned, and the loop is taken as the offset.
In some other embodiments, when the address type of the address object before the conversion is the subnet address type, determining whether the subnet prefixes of the address to be converted and the address object before the conversion are equal, if so, converting the first address in the address pool of the address to be converted and the address object before the conversion from a network byte order to a host byte order to obtain a first byte order and a second byte order, and calculating a difference between the first byte order and the second byte order to obtain the offset.
In some further embodiments, when the address type of the address object before the translation is the range address type, determining whether the address to be translated is within the range of the address object before the translation, if so, converting the first address in the address pool of the address object before the translation and the address object before the translation from the network byte order to the host byte order to obtain a third byte order and a fourth byte order, and calculating a difference between the third byte order and the fourth byte order to obtain the offset.
The above manner is merely an example, and the embodiment of the present disclosure does not specifically limit the manner of determining the offset based on the address type of the address object before the conversion, the address to be converted, and the address pool of the address object before the conversion.
Step 104, determining the target translation address based on the address type, the offset and the address pool of the translated address object.
In the embodiments of the present disclosure, there are many ways to determine the target translation address based on the address type, the offset, and the address pool of the translated address object, and in some embodiments, when the address type of the translated address object is the host address type, the second offset address in the address pool of the translated address object is used as the target translation address.
In some other embodiments, when the address type of the converted address object is the subnet address type, the first address of the address pool of the converted address object is obtained, the first address of the address pool of the converted address object is converted from the network byte order to the host byte order to obtain the first byte order, the sum of the first byte order and the offset is calculated to obtain the target byte order, and the target byte order is converted from the host byte order to the network byte order to obtain the target conversion address.
In some further embodiments, when the address type of the converted address object is the range address type, a first address of an address pool of the converted address object is obtained, the first address of the address pool of the converted address object is converted from a network byte order to a host byte order to obtain a first byte order, a sum of the first byte order and an offset is calculated to obtain a target byte order, and the target byte order is converted from the host byte order to the network byte order to obtain a target conversion address.
The above manner is merely an example, and the embodiment of the present disclosure does not specifically limit the manner of determining the target translation address based on the address type of the translated address object, the offset, and the address pool of the translated address object.
Therefore, the address to be converted can be converted into the target conversion address, and the conversion of the host address, the range address and the subnet address is supported. Furthermore, the method supports translation between different address types, such as: the host address can be converted into a host address, a range address or a subnet address, and the number of the address pools before and after conversion is equal. Therefore, the method has a wide application range.
The IPV6 address translation method based on the address pool offset obtains an address translation request; the address conversion request comprises an address to be converted, and an address conversion strategy matched with the address to be converted is obtained; the address conversion strategy comprises an address object before conversion and an address object after conversion, the offset is determined based on the address type of the address object before conversion, the address to be converted and the address pool of the address object before conversion, and the target conversion address is determined based on the address type of the address object after conversion, the offset and the address pool of the address object after conversion. Therefore, the conversion among different address types is supported, the application range is wide, the converted address can be configured in the address conversion strategy, the converted address does not need to be calculated, and the maintenance and management of the IPv6 network are more convenient.
In some embodiments, when the address type of the address object before translation is the host address type, the loop determines whether the address to be translated is equal to the address in the address pool of the address object before translation, and when the address to be translated is equal to the address in the address pool of the address object before translation, the loop number is returned, and the loop number is used as the offset.
Specifically, when the IPv6 address translation policy in the policy management module is matched, the address translation module translates the address according to the data in the policy, obtains the address information (address to be translated) ip _ addr in the packet five-tuple, the address object orig _ addr before translation and the address object trans _ addr after translation in the address translation policy, and determines the type ip _ type1 (host address, subnet address, range address) of the orig _ addr.
And when ip _ type1 is the host address type, circularly judging whether ip _ addr is equal to the address in the orig _ addr address pool, and if so, returning the number of cycles, wherein the number of cycles is the offset n of the ip _ addr in the orig _ addr address pool. The upper limit of the number of cycles is determined by the number of addresses in the orig _ addr address pool.
In some embodiments, when the address type of the address object before the conversion is the subnet address type, determining whether the subnet prefixes of the address to be converted and the address object before the conversion are equal, if so, converting the first address in the address pool of the address to be converted and the address object before the conversion from the network byte order to the host byte order to obtain a first byte order and a second byte order, and calculating a difference value between the first byte order and the second byte order to obtain the offset.
Specifically, when ip _ type1 is the subnet address type, it is first determined whether the subnet prefixes of ip _ addr and orig _ addr are equal. If the addresses are equal, further, the first address orig _ addr (0) in ip _ addr and orig _ addr is converted from the network endian to the host endian, which are ntohl (ip _ addr) and ntohl (orig _ addr (0)), respectively. At this time, the offset n = ntohl (ip _ addr) -ntohl (orig _ addr (0)).
In some embodiments, when the address type of the address object before the conversion is the range address type, determining whether the address to be converted is within the range of the address object before the conversion, if so, converting the first address in the address pool of the address object before the conversion and the address object before the conversion from the network byte order to the host byte order to obtain a third byte order and a fourth byte order, and calculating a difference value between the third byte order and the fourth byte order to obtain the offset.
When ip _ type1 is a range address type, first, it is determined whether ip _ addr is within the range of orig _ addr, and if so, further, the initial address orig _ addr (0) in ip _ addr and orig _ addr is converted from the network endian into the host endian, which are ntohl (ip _ addr) and ntohl (orig _ addr (0)), respectively. At this time, the offset n = ntohl (ip _ addr) -ntohl (orig _ addr (0)).
In some embodiments, when the address type of the translated address object is the host address type, the second offset address in the address pool of the translated address object is taken as the target translation address.
Specifically, when ip _ type2 is the host address type, the converted address ip _ trans _ addr is the nth address in trans _ addr according to the calculated offset n.
In some embodiments, when the address type of the converted address object is the subnet address type, a first address of an address pool of the converted address object is obtained, the first address of the address pool of the converted address object is converted from a network byte order to a host byte order to obtain a first byte order, a sum of the first byte order and the offset is calculated to obtain a target byte order, and the target byte order is converted from the host byte order to the network byte order to obtain a target converted address.
Specifically, when ip _ type2 is the subnet address type, the first address trans _ ip of trans _ addr is obtained, further, trans _ ip is converted from the network endian into the host endian ntohl (trans _ ip), and the converted address ip _ trans _ addr = htnol (ntohl (trans _ ip) + n) can be calculated by combining the obtained offset. Where htonl denotes the conversion from host endianness to network endianness.
In some embodiments, when the address type of the converted address object is the range address type, a first address of an address pool of the converted address object is obtained, the first address of the address pool of the converted address object is converted from a network byte order to a host byte order to obtain a first byte order, a sum of the first byte order and an offset is calculated to obtain a target byte order, and the target byte order is converted from the host byte order to the network byte order to obtain a target conversion address.
Specifically, when ip _ type2 is the range address type, the start address trans _ ip of trans _ addr is obtained, and the converted address ip _ trans _ addr = htonl (trans _ ip) + n) can be calculated by combining the obtained offset. Where htonl denotes the conversion from host endianness to network endianness.
As an example of a scenario, as shown in fig. 2, taking a host address as an example, after receiving an address translation request, obtaining an address to be translated in a packet five-tuple, for example, "ip _ addr", where "ip _ addr = orig _ addr (2)" is matched with the address to be translated in a policy management module, that is, the 2 nd address in an address pool before translation is matched, calculating an offset n of "ip _ addr" in the address pool before translation, for example, is 1, and an address with an offset n =1 in an address object after translation is "trans _ addr (2)".
Thereby, the conversion of the host address, the range address and the subnet address is supported. Furthermore, the method supports translation between different address types, such as: the host address can be converted into a host address, a range address or a subnet address, and the number of the address pools before and after conversion is equal. Therefore, the method has a wide application range, the address is converted into the address configured by the user, the user can definitely obtain the converted address, and the converted address does not need to be calculated by an address conversion tool. When the target is converted, the address of the target end is only needed to be configured in the address pool of the converted target address when the strategy is configured, the address can be converted into the ip of the target end through the address conversion module, and the IPv6 address of the target end does not need to be modified. Therefore, the method has a good source tracing effect, is more convenient for the maintenance and management of the IPv6 network, and can adjust the threshold parameter of the address pool according to the applicable scene, the actual demand and the performance of the equipment.
Corresponding to the method provided in the embodiments of fig. 1 to 2, the present disclosure also provides an apparatus, and since the apparatus provided in the embodiments of the present disclosure corresponds to the method provided in the embodiments of fig. 1 to 2, the implementation manner of the method is also applicable to the apparatus provided in the embodiments of the present disclosure, and is not described in detail in the embodiments of the present disclosure.
Fig. 3 is a schematic structural diagram of an IPV6 address translation apparatus based on address pool offsets according to an embodiment of the present disclosure.
As shown in fig. 3, the IPV6 address translation apparatus based on address pool offset includes:
a first obtaining module 301, configured to obtain an address translation request; wherein the address translation request comprises an address to be translated;
a second obtaining module 302, configured to obtain an address translation policy matched with the address to be translated; wherein the address translation policy includes a pre-translation address object and a post-translation address object;
a first determining module 303, configured to determine an offset based on the address type of the address object before conversion, the address to be converted, and an address pool of the address object before conversion;
a second determining module 304, configured to determine a target translation address based on the address type of the translated address object, the offset, and the address pool of the translated address object.
In some embodiments, the first determining module 303 is specifically configured to:
when the address type of the address object before the conversion is the host address type, circularly judging whether the address to be converted is equal to the address in the address pool of the address object before the conversion;
and when the address to be converted is equal to the address in the address pool of the address object before conversion, returning the cycle number, and taking the cycle number as the offset.
In some embodiments, the first determining module 303 is specifically configured to:
when the address type of the address object before conversion is a subnet address type, judging whether the subnet prefixes of the address to be converted and the address object before conversion are equal;
if the addresses are equal, converting the first address in the address pool of the address object to be converted and the address object before conversion from a network byte order to a host byte order to obtain a first byte order and a second byte order;
and calculating the difference value of the first byte order and the second byte order to obtain the offset.
In some embodiments, the first determining module 303 is specifically configured to:
when the address type of the address object before conversion is a range address type, judging whether the address to be converted is in the range of the address object before conversion;
if the address is in the range, converting the address to be converted and the first address in the address pool of the address object before conversion from a network byte order to a host byte order to obtain a third byte order and a fourth byte order;
and calculating the difference value of the third byte order and the fourth byte order to obtain the offset.
In some embodiments, the second determining module 304 is specifically configured to:
and when the address type of the address object after the conversion is the host address type, taking a first offset address in an address pool of the address object after the conversion as the target conversion address.
In some embodiments, the second determining module 304 is specifically configured to:
when the address type of the converted address object is a subnet address type, acquiring a first address of an address pool of the converted address object;
converting the first address of the address pool of the converted address object from a network byte order to a host byte order to obtain a first byte order;
and calculating the sum of the first byte order and the offset to obtain a target byte order, and converting the target byte order from the host byte order to the network byte order to obtain the target conversion address.
In some embodiments, the second determining module 304 is specifically configured to:
when the address type of the address object after the conversion is the range address type, acquiring a first address of an address pool of the address object after the conversion;
converting the first address of the address pool of the converted address object from a network byte order to a host byte order to obtain a first byte order;
and calculating the sum of the first byte order and the offset to obtain a target byte order, and converting the target byte order from the host byte order to the network byte order to obtain the target conversion address.
The IPV6 address translation device based on the offset of the address pool obtains an address translation request; the address conversion request comprises an address to be converted, and an address conversion strategy matched with the address to be converted is obtained; the address conversion strategy comprises an address object before conversion and an address object after conversion, the offset is determined based on the address type of the address object before conversion, the address to be converted and the address pool of the address object before conversion, and the target conversion address is determined based on the address type of the address object after conversion, the offset and the address pool of the address object after conversion. Therefore, the conversion among different address types is supported, the application range is wide, the converted address can be configured in the address conversion strategy, the converted address does not need to be calculated, and the maintenance and management of the IPv6 network are more convenient.
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.
The foregoing are merely exemplary embodiments of the present disclosure, which enable those skilled in the art to understand or practice the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the disclosure. Thus, the present disclosure is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (4)

1. An IPv6 address translation method based on address pool offset is characterized by comprising the following steps:
acquiring an address conversion request; wherein the address translation request comprises an address to be translated;
acquiring an address conversion strategy matched with the address to be converted; wherein the address translation policy includes a pre-translation address object and a post-translation address object;
determining an offset based on the address type of the address object before conversion, the address to be converted and the address pool of the address object before conversion;
when the address type of the address object before the conversion is the host address type, circularly judging whether the address to be converted is equal to the address in the address pool of the address object before the conversion, and when the address to be converted is equal to the address in the address pool of the address object before the conversion, returning the cycle number, and taking the cycle number as the offset;
when the address type of the address object before the conversion is a subnet address type, judging whether the subnet prefixes of the address object to be converted and the address object before the conversion are equal, if so, converting the first address in the address pool of the address object to be converted and the address object before the conversion from a network byte order to a host byte order to obtain a first byte order and a second byte order, and calculating the difference value of the first byte order and the second byte order to obtain the offset;
when the address type of the address object before conversion is a range address type, judging whether the address to be converted is in the range of the address object before conversion; if the address is in the range, converting the address to be converted and the first address in the address pool of the address object before conversion from a network byte order to a host byte order to obtain a third byte order and a fourth byte order; calculating the difference value of the third byte order and the fourth byte order to obtain the offset;
determining a target translation address based on the address type of the translated address object, the offset, and the address pool of the translated address object;
when the address type of the address object after the conversion is the host address type, taking a first offset address in an address pool of the address object after the conversion as the target conversion address;
when the address type of the converted address object is a subnet address type, acquiring a first address of an address pool of the converted address object, converting the first address of the address pool of the converted address object from a network byte order to a host byte order to obtain a first byte order, calculating the sum of the first byte order and the offset to obtain a target byte order, and converting the target byte order from the host byte order to the network byte order to obtain the target conversion address;
when the address type of the converted address object is a range address type, acquiring a first address of an address pool of the converted address object, converting the first address of the address pool of the converted address object from a network byte order to a host byte order to obtain a first byte order, calculating the sum of the first byte order and the offset to obtain a target byte order, and converting the target byte order from the host byte order to the network byte order to obtain the target conversion address.
2. An IPV6 address translation apparatus based on address pool offset, comprising:
the first acquisition module is used for acquiring an address conversion request; wherein the address translation request comprises an address to be translated;
the second acquisition module is used for acquiring the address conversion strategy matched with the address to be converted; wherein the address translation policy includes a pre-translation address object and a post-translation address object;
a first determining module, configured to determine an offset based on the address type of the address object before conversion, the address to be converted, and an address pool of the address object before conversion;
when the address type of the address object before the conversion is the host address type, circularly judging whether the address to be converted is equal to the address in the address pool of the address object before the conversion, and when the address to be converted is equal to the address in the address pool of the address object before the conversion, returning the cycle number, and taking the cycle number as the offset;
when the address type of the address object before conversion is a subnet address type, judging whether the subnet prefixes of the address object to be converted and the address object before conversion are equal, if so, converting the first address in the address pool of the address object to be converted and the address object before conversion from a network byte order to a host byte order to obtain a first byte order and a second byte order, and calculating the difference value of the first byte order and the second byte order to obtain the offset;
when the address type of the address object before conversion is a range address type, judging whether the address to be converted is in the range of the address object before conversion; if the address is in the range, converting the address to be converted and the first address in the address pool of the address object before conversion from a network byte order to a host byte order to obtain a third byte order and a fourth byte order; calculating the difference value of the third byte order and the fourth byte order to obtain the offset;
a second determining module, configured to determine a target translation address based on the address type of the translated address object, the offset, and an address pool of the translated address object;
when the address type of the address object after the conversion is the host address type, taking a first offset address in an address pool of the address object after the conversion as the target conversion address;
when the address type of the converted address object is a subnet address type, acquiring a first address of an address pool of the converted address object, converting the first address of the address pool of the converted address object from a network byte order to a host byte order to obtain a first byte order, calculating the sum of the first byte order and the offset to obtain a target byte order, and converting the target byte order from the host byte order to the network byte order to obtain the target conversion address;
when the address type of the converted address object is a range address type, acquiring a first address of an address pool of the converted address object, converting the first address of the address pool of the converted address object from a network byte order to a host byte order to obtain a first byte order, calculating the sum of the first byte order and the offset to obtain a target byte order, and converting the target byte order from the host byte order to the network byte order to obtain the target conversion address.
3. An electronic device, comprising: a processor and a memory;
the processor is configured to perform the steps of the method of claim 1 by calling a program or instructions stored in the memory.
4. A computer-readable storage medium storing a program or instructions for causing a computer to perform the steps of the method of claim 1.
CN202210399548.2A 2022-04-15 2022-04-15 IPV6 address translation method, device, equipment and medium based on address pool offset Active CN114710466B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210399548.2A CN114710466B (en) 2022-04-15 2022-04-15 IPV6 address translation method, device, equipment and medium based on address pool offset

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210399548.2A CN114710466B (en) 2022-04-15 2022-04-15 IPV6 address translation method, device, equipment and medium based on address pool offset

Publications (2)

Publication Number Publication Date
CN114710466A CN114710466A (en) 2022-07-05
CN114710466B true CN114710466B (en) 2023-03-24

Family

ID=82174683

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210399548.2A Active CN114710466B (en) 2022-04-15 2022-04-15 IPV6 address translation method, device, equipment and medium based on address pool offset

Country Status (1)

Country Link
CN (1) CN114710466B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114172861A (en) * 2021-12-07 2022-03-11 北京天融信网络安全技术有限公司 Identification method and device of network address translation equipment

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2010108431A1 (en) * 2009-03-26 2010-09-30 华为技术有限公司 Method for realizing ipv6 host visting ipv4 host, method for obtaining ipv6 address prefix and translation device
CN114095471A (en) * 2020-07-29 2022-02-25 中国电信股份有限公司 Address translation method and device and address tracing method and device

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114172861A (en) * 2021-12-07 2022-03-11 北京天融信网络安全技术有限公司 Identification method and device of network address translation equipment

Also Published As

Publication number Publication date
CN114710466A (en) 2022-07-05

Similar Documents

Publication Publication Date Title
US7779158B2 (en) Network device
CN107872545B (en) Message transmission method and device and computer readable storage medium
JP5093277B2 (en) Communication apparatus and computer program
US9866448B2 (en) Electronic device and method for DNS processing
US10237183B2 (en) Detecting tethering in networks
CN107613037B (en) Domain name redirection method and system
CN110839046B (en) Multi-protocol intercommunication method and system
CN110995886B (en) Network address management method, device, electronic equipment and medium
US10432579B2 (en) Internet protocol address allocation method and router
CN107124483A (en) Domain name analytic method and server
JP5850046B2 (en) COMMUNICATION DEVICE, COMMUNICATION SYSTEM, AND COMMUNICATION METHOD
CN114710466B (en) IPV6 address translation method, device, equipment and medium based on address pool offset
TW201611549A (en) Network device and method for routing
CN111541797A (en) Eco-based IPV6 implementation method
US8548136B2 (en) Communication apparatus
WO2015139397A1 (en) Nat64 resource acquisition method and acquisition/distribution apparatus
EP3387822B1 (en) Collecting addresses in a subnetwork
EP2961110A1 (en) Packet transmission method and apparatus, and server
EP3200433A1 (en) Ipv6 address management method, device and terminal
CN110798542A (en) Method and system for acquiring IP address
JP2009182750A (en) Communication system and ethod coping with a plurality of network protocol
JP2006262352A (en) Mobile terminal, packet relay device, communication system, and communication method
CN111083247B (en) Address conversion method, device, equipment and storage medium
WO2022218194A1 (en) Service routing method and device
CN114731338B (en) System and method for controlling load of domain name system server

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant