An operator identification method and system based on IP addresses

By building an operator identification library, using the correspondence between the first 24 IP addresses and the operators, the problem of low operator identification efficiency in the existing technology is solved, and efficient and fast operator query is achieved, which is suitable for the Internet technology field.

CN114490436BActive Publication Date: 2025-07-08JINAN DIANLIANG SOFTWARE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210095349.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-26
Publication Date
2025-07-08
Estimated Expiration
2042-01-26

AI Technical Summary

Technical Problem

The prior art is inefficient in quickly identifying the operator to which the IP address belongs, especially in the scenario of large-scale concurrency of large users, and lacks a reliable and authoritative IP database.

Method used

Build an operator identification library, and realize fast operator query through the correspondence between the first 24 bits of the IP address and the operator, use memory area storage and complete query through one memory addressing.

Benefits of technology

It improves the efficiency of operator query, saves data storage space, and can maintain high efficiency in massive concurrent queries, has small memory usage and fast query speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114490436B_ABST
    Figure CN114490436B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for identifying an operator based on an IP address. The method includes: obtaining a list of IP addresses and detailed information of all IP segments; parsing to obtain the operator category according to the detailed information of the IP segments, so as to obtain a list of IP addresses including the operator; using the first 24 bits in the binary form of the IP address as identification information to determine the corresponding relationship between the 24-bit IP address and the operator, which is used to identify the operator of the IP address to be identified. The present invention realizes fast operator query based on the IP address by constructing an operator identification library.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of Internet technologies, and particularly relates to a method and system for identifying an operator based on an IP address. Background Art

[0002] The statements in this part merely provide background technical information related to the present invention and do not necessarily constitute prior art.

[0003] Generally, the network communication speed between different operators is much lower than that between the same operator. Therefore, in many cases, it is necessary to determine the operator to which a user belongs based on the user's IP and try to schedule the user to the same operator group as much as possible, so as to facilitate more efficient communication between these user devices. For example, when a user downloads a traditional file, if the server is not a BGP self-adaptive line, it is best to automatically assign the user request to a server on the same operator network according to the source IP of the user, so that the download speed can be faster.

[0004] The P2P system is in more urgent need of a fast operator identification technology. In the process of developing the P2P system for many years, we found that if a large number of terminals in the P2P are downloading the same resource, when a new node joins, it is unrealistic for the system to return all the current nodes that may exceed hundreds of thousands to it and let it connect to each one in turn. This will waste a lot of resources, and a large number of invalid connections will also cause network congestion or Flood phenomenon. Generally, in this case, the Tracker and other scheduling servers in the P2P system need to use excellent methods to quickly find hundreds of IPs that are most suitable for this node from 100,000 node information for it to connect to. Generally, the most suitable selection strategy will give priority to selecting those within the same intranet, and then use the same operator as a condition. In these applications, how to quickly locate the operator to which a certain IP belongs is an extremely important key technology.

[0005] Currently, for the method of querying the operator to which an IP belongs, some are based on http / https query interfaces. This method requires establishing an http connection each time for querying, and the speed is relatively slow, which is only suitable for a small number of queries. In the scenario of a large number of concurrent users, it cannot be used. Some are based on queries of certain IP databases. Most of these queries are based on methods such as binary search or B-tree, and multiple address searches and multiple localizations are required to find the final result. Moreover, many IP databases are formed based on the accumulation of reports from netizens over the years, and currently, there is a lack of a reliable and authoritative method for generating IP databases. Summary of the Invention

[0006] To overcome the deficiencies of the above-mentioned prior art, the present invention provides a method and system for identifying an operator based on an IP address. By constructing an operator identification library, fast operator query based on the IP address is realized.

[0007] To achieve the above object, one or more embodiments of the present invention provide the following technical solutions:

[0008] A method for identifying an operator based on an IP address, comprising the following steps:

[0009] Obtain an IP address list and detailed information of all IP segments;

[0010] According to the detailed information of the IP segment, parse to obtain the operator category, and obtain an IP address list containing the operator;

[0011] Use the first 24 bits of the IP address in binary form as identification information to determine the correspondence between the 24-bit IP address and the operator, for operator identification of the IP address to be identified.

[0012] Further, the method for determining the correspondence between the 24-bit IP address and the operator is:

[0013] For positive integers with values from 0 to 16777215, traverse them one by one. For each positive integer, shift its binary value 8 bits to the left and split it every 8 bits to obtain a dotted-decimal IP address. Search in the IP address list containing the operator to obtain the corresponding operator of the positive integer. Store the corresponding operators in sequence according to the order of positive integers to obtain an operator identification library.

[0014] Further, operator identification of the IP address to be identified includes:

[0015] Obtain the IP address to be queried, extract the first 24 bits and convert them into a positive integer, and determine the corresponding operator according to the position of the positive integer between 0 and 16777215.

[0016] Further, store the corresponding operators of positive integers with values from 0 to 16777215 into a memory area of 8 * 1024 * 1024 bytes in sequence. Each byte includes the information of 2 operators corresponding to 2 IP addresses.

[0017] Further, operator identification of the IP address to be identified includes: obtaining the IP address to be queried, extracting the first 24 bits and converting them into a positive integer. The positive integer is divided by 2 and rounded down to obtain the corresponding byte. If the positive integer is even, the first 4 bits of the byte are the corresponding operator; otherwise, the last 4 bits are the corresponding operator.

[0018] Further, the method for determining the correspondence between the 24-bit IP address and the operator is as follows:

[0019] For the IP address list containing the operator, for each IP address in each IP segment, the first 24 bits in binary form are extracted to obtain the standardized IP address, and the standardized IP address is associated and stored with the corresponding operator to obtain the operator identification library.

[0020] Further, obtain the IP address to be queried, extract the first 24 bits in binary form to obtain the standardized IP address, and obtain the corresponding operator according to the operator identification library.

[0021] Further, the method for determining the correspondence between the 24-bit IP address and the operator is as follows:

[0022] For positive integers with values from 0 to 16777215, traverse them one by one. For each positive integer, shift its binary value 8 bits to the left and split it every 8 bits to obtain the dotted decimal IP address. Search in the IP address list containing the operator to obtain the corresponding operator of the positive integer, and associate and store the positive integer and the corresponding operator to obtain the operator identification library.

[0023] Further, obtain the IP address to be queried, extract the first 24 bits in binary form and convert them into a positive integer, and obtain the corresponding operator according to the operator identification library.

[0024] One or more embodiments provide an operator identification system based on an IP address, including:

[0025] An operator identification library for storing the correspondence between the IP address and the operator, where the IP address is in the form of a 24-bit IP address or the corresponding positive integer; or, storing the corresponding operator data sorted according to the positive integer order of the IP address;

[0026] An operator identification module for obtaining the IP address to be queried and extracting the first 24 bits in binary form;

[0027] If based on the operator identification library storing the corresponding operator data sorted according to the positive integer order of the IP address, convert the first 24 bits into a positive integer, and determine the corresponding operator according to the position of the positive integer between 0 and 16777215;

[0028] If based on the operator identification library storing the correspondence between the IP address and the operator, obtain the standardized IP address or the corresponding positive integer, and search for the corresponding operator based on the operator identification library.

[0029] The above one or more technical solutions have the following beneficial effects:

[0030] A method for querying an operator through an IP address is proposed by constructing an operator identification library to associate the IP address with the operator, and the query efficiency is high.

[0031] A method for constructing an identification library that only includes operator information is proposed. The corresponding operators are obtained in the positive integer order of the IP address and stored sequentially, greatly saving the data storage space (only occupying 8M space in the embodiment); and it can be loaded into the memory, and the search can be completed with one address search in the memory, and the identification efficiency is relatively high. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] The specification drawings forming a part of the present invention are used to provide a further understanding of the present invention. The illustrative embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention.

[0033] Figure 1 It is the overall flowchart of the operator identification method based on the IP address in the first embodiment of the present invention;

[0034] Figure 2 It is a flowchart for establishing an operator identification library in the first embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0035] It should be noted that the following detailed descriptions are all exemplary and are intended to provide further descriptions of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which the present invention belongs.

[0036] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.

[0037] In the case of no conflict, the embodiments in the present invention and the features in the embodiments can be combined with each other.

[0038] Embodiment 1

[0039] This embodiment discloses an operator identification method based on an IP address, as Figure 1 shown, including the following steps:

[0040] Step 1: Obtain the IP address list and the detailed information of all IP segments.

[0041] Step 2: According to the detailed information of the IP segmentation, parse to obtain the operator category, and obtain an IP address list including the operator.

[0042] In this embodiment, the IP address list is obtained from the Asia-Pacific Network Information Center (APNIC), one of the five major regional Internet registration authorities in the world. The Asia-Pacific Network Information Center is responsible for the allocation of IP addresses and ASNs (Autonomous System Numbers) in the Asia-Pacific region, and the data is authoritative.

[0043] In the obtained IP address list, each line is a segment of allocated IP, and the IP is marked in integer form as follows:

[0044] apnic|AU|asn|4806|2|19961025|allocated

[0045] apnic|CN|asn|4808|1|19960109|allocated

[0046] apnic|CN|asn|4809|2|19960109|allocated

[0047] From the IP address list, according to the specified country / region identification information, filter the corresponding IP address list.

[0048] Obtain the detailed information of all IP segments in the IP address list, parse to obtain the operator category, and obtain an IP address list including the operator;

[0049] The following is an example of the detailed information:

[0050] inetnum:39.64.0.0 - 39.95.255.255

[0051] netname:UNICOM-SD

[0052] descr:China Unicom Shandong province network

[0053] descr:China Unicom

[0054] country:CN

[0055] admin-c:CH1302-AP

[0056] tech-c:XZ14-AP

[0057] mnt-by:APNIC-HM

[0058] mnt-lower:MAINT-CNCGROUP

[0059] mnt-lower:MAINT-CNCGROUP-SD

[0060] Based on the information of netname (network name) and descr (description information) in the detailed information, the operator corresponding to the IP segment can be obtained. By analyzing the detailed information of all IP segments in the list, all operators can be obtained. In this embodiment, an IP list with 8 different operator tags is formed.

[0061] This embodiment is described by taking a Class C IP address as an example. All IP addresses involved below are Class C IP addresses.

[0062] Step 3: Use the first 24 bits in the binary form of the IP address as the identification information to determine the correspondence between the 24-bit IP address and the operator, and use it to identify the operator of the IP address to be recognized.

[0063] An IP address is a 32-bit binary number, usually divided into 4 "8-bit binary numbers" (that is, divided by 4 bytes). An IP address is usually represented in the form of "dotted decimal" as (a.b.c.d), where a, b, c, and d are all decimal integers between 0 and 255. For example: the dotted decimal IP address (100.4.5.6) is actually the 32-bit binary number (01100100.00000100.00000101.00000110).

[0064] In this embodiment, the first 24 bits are selected as the identification information of the operator. This is because the IPs applied by the operator are all a continuous segment of IPs. The last 8 bits are different, which does not affect their belonging to the same operator. Therefore, the last 8 bits can be omitted.

[0065] As a specific implementation manner, as Figure 2 shown, the specific steps of Step 3 include:

[0066] Step 3.1: Traverse all positive integers with values from 0 to 16777215 one by one. For each positive integer, shift its binary value 8 bits to the left, and slice it every 8 bits to obtain the dotted decimal IP address. Search in the IP address list containing the operator to obtain the corresponding operator of the positive integer. Store the corresponding operators in sequence according to the order of positive integers to obtain the operator identification library.

[0067] For 8 different operators, the 8 types of different operators are marked with values from 0x0 to 0x7, a total of 4 digits. In this way, the IP corresponding to the integer N can uniquely determine its affiliated operator mark (0x0 - 0x07).

[0068] Since the value range of the integer N is 24 bits, that is, there are a total of 16 * 1024 * 1024, a total of 16M different values. Among them, the mark of the operator corresponding to each N needs to be 4 bits, that is, half a byte for marking. Therefore, one byte can actually mark 2 operators.

[0069] Therefore, a memory area of 8 * 1024 * 1024 bytes can be formed to store the operator identification library. Specifically, each byte is used to record 2 operators, so a total of 8 * 1024 * 1024 bytes of memory area is required.

[0070] Step 3.2: Obtain the IP address to be queried, extract the first 24 bits and convert them into a positive integer, and determine the corresponding operator according to the position of the positive integer between 0 and 16777215.

[0071] When using 8M memory to store operator information, obtain the IP address to be queried, extract the first 24 bits and convert them into a positive integer. The positive integer is divided by 2 and rounded down to obtain the corresponding byte. If the positive integer is even, the first 4 bits of the byte are the corresponding operator, otherwise, the last 4 bits are the corresponding operator.

[0072] As a second specific implementation method, the specific steps of step 3 include:

[0073] Step 3.1: Extract the first 24 bits in binary form for each IP address in the IP segment to obtain a standardized IP address, and associate and store the standardized IP address with the corresponding operator to obtain an operator identification library;

[0074] When associating and storing the standardized IP address with the corresponding operator, duplicate record removal processing is also performed to remove duplicate records.

[0075] Step 3.2: Obtain the IP address to be queried, extract the first 24 bits in binary form, and obtain the corresponding operator according to the operator identification library.

[0076] As a third specific implementation method, the specific steps of step 3 include:

[0077] Step 3.1: Traverse all positive integers from 0 to 16777215 one by one. For each positive integer, shift its binary value left by 8 bits and split it into segments of 8 bits each to obtain a dotted-decimal IP address. Search in the IP address list containing the operator to obtain the corresponding operator for this positive integer, and store the positive integer and the corresponding operator in association to obtain an operator identification library.

[0078] The value of N obtained by converting the first 24 bits of the IP address ranges from 0 to 16777215 (2 to the power of 24 minus 1). For each positive integer, to obtain its 32-bit IP address, first shift its binary value left by 8 bits and split it into segments of 8 bits each to obtain a dotted-decimal IP address. For example, the complete hexadecimal of the integer 1920103026 is 0x72727272. Splitting it into segments of 8 bits each forms four segments: 0x72 0x72 0x72 0x72. The decimal value of 0x72 is 114, so its IP representation is: 114.114.114.114. Since the value of N has only 24 bits, the IP address it actually corresponds to is of the type x.x.x.0, and the last segment will be fixed as 0.

[0079] For operators that cannot be found in the IP address list containing the operator, they are regarded as operators from other countries / regions.

[0080] The form of the positive integer in the operator identification library can be binary, decimal, or hexadecimal, which is not limited here.

[0081] Step 3.2: Obtain the IP address to be queried, extract the first 24 bits in binary form, and obtain the corresponding operator according to the operator identification library.

[0082] According to the storage form of the IP address in the operator identification library, convert the first 24 bits of the IP address to be queried into binary, decimal, or hexadecimal representation and then perform the search.

[0083] Repeat steps 1 - 3 at regular intervals to obtain the latest operator identification library.

[0084] Embodiment 2

[0085] Based on Embodiment 1, this embodiment provides an operator identification system based on IP addresses, including:

[0086] An operator identification library for storing the correspondence between IP addresses and operators, or for storing the corresponding operator data sorted in the order of IP address positive integers;

[0087] The operator identification library can be a database or can be loaded into a memory area.

[0088] For the operator identification library that stores the corresponding relationship between IP addresses and operators, the form of the IP address can be binary, decimal, hexadecimal, etc., which is not limited here.

[0089] The operator identification module is used to obtain the IP address to be queried and extract the first 24 bits;

[0090] If based on the operator identification library that stores the corresponding relationship between IP addresses and operators, the corresponding operator is found according to the first 24 bits in binary form;

[0091] If based on the operator identification library that stores the corresponding operator data sorted in ascending order of the IP address as a positive integer, convert the first 24 bits into a positive integer, and determine the corresponding operator according to the position of the positive integer between 0 and 16777215.

[0092] Among them, the construction method of the operator identification library is as described in the corresponding part of Embodiment 1, which will not be elaborated here.

[0093] One or more of the above embodiments provide a method for obtaining reliable and authoritative IP operator data. And this method can obtain relatively new data by executing regularly. Compared with existing various paid databases, it is simpler, more effective, and controllable. And, based on very little memory occupancy, it realizes finding the operator to which it belongs with a single memory addressing. Compared with other search methods such as b-tree, binary search, and database query, a single memory addressing is the most efficient and fastest method, and it can meet the needs of massive concurrent queries in actual use.

[0094] Those skilled in the art should understand that the above-mentioned modules or steps of the present invention can be implemented by a general computer device. Optionally, they can be implemented by program codes executable by a computing device, so that they can be stored in a storage device and executed by the computing device, or they can be separately made into individual integrated circuit modules, or multiple of them can be made into a single integrated circuit module to implement. The present invention is not limited to any specific combination of hardware and software.

[0095] Although the specific implementation manners of the present invention have been described above in conjunction with the accompanying drawings, it is not a limitation to the protection scope of the present invention. Those skilled in the art should understand that on the basis of the technical solution of the present invention, various modifications or deformations that can be made by those skilled in the art without creative efforts are still within the protection scope of the present invention.

Claims

1. A method for identifying an operator based on an IP address, characterized in that, It includes the following steps: Obtain a list of IP addresses and detailed information of all IP segments; Parse the operator category according to the detailed information of the IP segment to obtain an IP address list containing the operator; Use the first 24 bits in the binary form of the IP address as identification information to determine the correspondence between the 24-bit IP address and the operator, which is used to identify the operator of the IP address to be recognized; The method for determining the correspondence between the 24-bit IP address and the operator is as follows: For positive integers with values from 0 to 16777215, traverse them one by one. For each positive integer, shift its binary value 8 bits to the left and split it every 8 bits to obtain a dotted-decimal IP address. Search in the IP address list containing the operator to obtain the corresponding operator of the positive integer. Store the corresponding operators in sequence according to the order of positive integers to obtain an operator identification library; The operator identification of the IP address to be recognized includes: storing the corresponding operators of positive integers with values from 0 to 16777215 into a memory area of 8 * 1024 * 1024 bytes in sequence, and each byte includes the information of the two operators to which two IP addresses belong; obtain the IP address to be queried, extract the first 24 bits and convert them into a positive integer. The positive integer is divided by 2 and rounded down to obtain the corresponding byte. If the positive integer is even, the first 4 bits of the byte are the corresponding operator, otherwise, the last 4 bits are the corresponding operator.

2. The operator identification method based on IP address according to claim 1, wherein The operator identification of the IP address to be recognized includes: Obtain the IP address to be queried, extract the first 24 bits and convert them into a positive integer, and determine the corresponding operator according to the position of the positive integer between 0 and 16777215.

3. The operator identification method based on IP address according to claim 1, characterized in that, The method for determining the correspondence between the 24-bit IP address and the operator is as follows: For the IP address list containing the operator, extract the first 24 bits in the binary form of each IP address in each IP segment to obtain a standardized IP address, and associate and store the standardized IP address with the corresponding operator to obtain an operator identification library.

4. The operator identification method based on IP address according to claim 3, wherein, Obtain the IP address to be queried, extract the first 24 bits in the binary form to obtain a standardized IP address, and obtain the corresponding operator according to the operator identification library.

5. The operator identification method based on IP address according to claim 1, characterized in that, Obtain the IP address to be queried, extract the first 24 bits in the binary form and convert them into a positive integer, and obtain the corresponding operator according to the operator identification library.

6. An operator identification system based on IP addresses, characterized in that, This system is used to execute an operator identification method based on IP address as described in claim 1. This system includes: An operator identification library, which is used to store the correspondence between IP addresses and operators, where the IP address is in the form of a 24-bit IP address or the corresponding positive integer; or, store the corresponding operator data sorted according to the positive integer order of the IP address; An operator identification module, which is used to obtain the IP address to be queried and extract the first 24 bits in the binary form; If it is based on the operator identification library that stores the corresponding operator data sorted according to the positive integer order of the IP address, first convert the first 24 bits into a positive integer, and then determine the corresponding operator according to the position of the positive integer between 0 and 16777215. If it is an operator identification library based on the corresponding relationship between the stored IP address and the operator, first obtain the standardized IP address or the corresponding positive integer, and then look up the corresponding operator based on the operator identification library.

Citation Information

Patent Citations

  • Geographical attribution information inquiry method oriented to MapReduce frame

    CN104102707A

  • Method for realizing efficient matching of IP network segments

    CN111245726A