A subnet management method and device and related equipment
By obtaining subnet configuration and comparing MAC addresses, and merging the same subnet data, the management difficulties caused by the same subnet configuration but different actual conditions are solved, and accurate management of subnet IP addresses is achieved.
Patent Information
- Application Number
- CN202411230921.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-03
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2044-09-03
AI Technical Summary
After NAT mapping is used in subnets, it is difficult to effectively manage IP addresses with existing technologies, resulting in the problem that subnets have the same configuration but are actually different.
By obtaining the subnet data of the subnet, it is determined whether the subnet configuration is the same, and the MAC address of the device is obtained through the ARP message. It is determined whether the number of identical MAC addresses exceeds the threshold to determine the same subnet and merge the subnet data for management.
It achieves clear control over subnets, avoids subnet identification errors caused by different NAT gateway devices, and improves the accuracy of IP address management.
Smart Images

Figure CN119211186B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network management technology, and in particular to a subnet management method, apparatus, and related equipment. Background Art
[0002] Currently, when managing IP addresses, they are usually managed by subnet. When the managed subnet is mapped using NAT (Network Address Translation), the situation will be different from the subnet managed directly.
[0003] Therefore, how to manage the IP addresses mapped by NAT in the subnet has become an urgent problem to be solved. Summary of the Invention
[0004] The present application provides a subnet management method, apparatus and related equipment.
[0005] In a first aspect, the present application provides a subnet management method, the method comprising:
[0006] Obtain subnet data for each subnet included in the network, wherein the subnet data for a subnet includes the subnet configuration of the subnet and the IP address information of each device included in the subnet;
[0007] Determine whether there is a first subnet and a second subnet with the same subnet configuration;
[0008] If it is determined that a first subnet and a second subnet exist with the same subnet configuration, obtaining first MAC addresses corresponding to the IP addresses of the devices included in the first subnet, and obtaining second MAC addresses corresponding to the IP addresses of the devices included in the second subnet;
[0009] Determine whether the number of identical MAC addresses in the first MAC address and the second MAC address exceeds a preset threshold;
[0010] If the judgment result is yes, it is determined that the first subnet and the second subnet are the same subnet, and the subnet data of the first subnet and the second subnet are merged into one subnet data for management.
[0011] Optionally, each subnet is connected to the Internet through a NAT gateway device; and the step of obtaining subnet data of each subnet included in the network includes:
[0012] The subnet data of each subnet is obtained from the NAT gateway device connected to each subnet, wherein the subnet data of a subnet also includes device identification information of the NAT gateway device connected to the subnet.
[0013] Optionally, the subnet configuration of a subnet includes: subnet address allocation rules, network segments, subnet masks, and reserved addresses.
[0014] Optionally, the step of obtaining the MAC address corresponding to each IP address of each device included in a subnet includes:
[0015] According to the IP address of each device included in the subnet, an Address Resolution Protocol ARP message is sent to each device;
[0016] Receive the ARP response from each device to obtain the MAC address corresponding to the IP address of each device.
[0017] In a second aspect, the present application provides a subnet management device, the device comprising:
[0018] An acquisition unit, configured to acquire subnet data of each subnet included in the network, wherein the subnet data of a subnet includes the subnet configuration of the subnet and the IP address information of each device included in the subnet;
[0019] A judging unit, configured to judge whether there are a first subnet and a second subnet with the same subnet configuration;
[0020] If the judgment unit determines that there are a first subnet and a second subnet with the same subnet configuration, the acquisition unit is further configured to acquire a first MAC address corresponding to each IP address of each device included in the first subnet, and acquire a second MAC address corresponding to each IP address of each device included in the second subnet;
[0021] The determining unit is further configured to determine whether the number of identical MAC addresses in the first MAC address and the second MAC address exceeds a preset threshold;
[0022] A management unit, if the judgment unit determines that the number of identical MAC addresses in the first MAC address and the second MAC address exceeds a preset threshold, the management unit is used to determine that the first subnet and the second subnet are the same subnet, and merge the subnet data of the first subnet and the second subnet into one subnet data for management.
[0023] Optionally, each subnet accesses the Internet through a NAT gateway device; when acquiring subnet data of each subnet included in the network, the acquiring unit is specifically configured to:
[0024] The subnet data of each subnet is obtained from the NAT gateway device connected to each subnet, wherein the subnet data of a subnet also includes device identification information of the NAT gateway device connected to the subnet.
[0025] Optionally, the subnet configuration of a subnet includes: subnet address allocation rules, network segments, subnet masks, and reserved addresses.
[0026] Optionally, when obtaining the MAC addresses corresponding to the IP addresses of the devices included in a subnet, the obtaining unit is specifically configured to:
[0027] According to the IP address of each device included in the subnet, an Address Resolution Protocol ARP message is sent to each device;
[0028] Receive the ARP response from each device to obtain the MAC address corresponding to the IP address of each device.
[0029] In a third aspect, an embodiment of the present application provides a subnet management device, the subnet management device comprising:
[0030] a memory for storing program instructions;
[0031] The processor is configured to call the program instructions stored in the memory and execute the steps of the method as described in any one of the first aspects above according to the obtained program instructions.
[0032] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable the computer to execute the steps of the method described in any one of the above-mentioned first aspects.
[0033] In summary, the subnet management method provided in the embodiment of the present application obtains the subnet data of each subnet included in the network, wherein the subnet data of a subnet includes the subnet configuration of the subnet and the IP address information of each device included in the subnet; determines whether there is a first subnet and a second subnet with the same subnet configuration; if it is determined that there are a first subnet and a second subnet with the same subnet configuration, obtains the first MAC address corresponding to the IP address of each device included in the first subnet, and obtains the second MAC address corresponding to the IP address of each device included in the second subnet; determines whether the number of identical MAC addresses in the first MAC address and the second MAC address exceeds a preset threshold; if the judgment result is yes, determines that the first subnet and the second subnet are the same subnet, and merges the subnet data of the first subnet and the second subnet into one subnet data for management.
[0034] By adopting the subnet management method provided in the embodiment of the present application, in the scenario where the subnet accesses the network through multiple NAT gateway devices, the MAC data obtained by analyzing the ARP message can effectively determine the subnet duplication problem, which is conducive to the clear control of the IP address management of the subnet. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the description of the embodiments of the present application or the prior art. Obviously, the drawings in the following description only represent some embodiments described in the present application, and other drawings can also be obtained by those skilled in the art according to these drawings of the embodiments of the present application.
[0036] Figure 1 A subnetwork networking schematic diagram;
[0037] Figure 2 Another subnetwork networking schematic diagram;
[0038] Figure 3 A detailed flowchart of a subnetwork management method provided by the embodiments of the present application;
[0039] Figure 4 A structural schematic diagram of a subnetwork management device provided by the embodiments of the present application;
[0040] Figure 5 A hardware architecture schematic diagram of a subnetwork management device provided by the embodiments of the present application. DETAILED DESCRIPTION
[0041] The terms used in the embodiments of the present application are only for the purpose of describing particular embodiments and are not intended to limit the present application. The singular forms "a", "an" and "the" used in the present application and claims are intended to include plural forms, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein refers to any or all possible combinations of one or more associated listed items.
[0042] It should be understood that although the terms first, second, third, etc. can be used in the embodiments of the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, the first information can also be referred to as the second information without departing from the scope of the present application, and similarly, the second information can also be referred to as the first information. In addition, depending on the context, the word "if" used can be interpreted as "when" or "in response to determining" or "in response to ascertaining".
[0043] Currently, different subnets in different NAT gateways can use the same configuration. Then, in the subnet (IP address management of the subnet) system, it is necessary to identify different subnets. Usually, this case can be identified as different subnets by different NAT gateways. That is, a subnet is uniquely identified by NT gateway identification plus subnet. For example, Figure 1As shown, the server is an IP address management server, which obtains two subnets in VPN (Virtual Private Network) A and VPN B. The IP allocation rules in the subnets are the same. In this case, different NAT gateway identifiers can be used to distinguish them.
[0044] For example, VPNA and VPNB belong to different subnets, but their subnet configurations are identical. On the server side, the subnet data for VPNA is identified as: NAT1+VPNA(192.168.1.1 / 24); the subnet data for VPNB is identified as: NAT2+VPNB(192.168.1.1 / 24). This solves the problem of identifying different subnets even though the subnet configurations are identical.
[0045] In actual applications, the same subnet can have multiple NAT gateway mappings. If a subnet is identified by a NAT gateway identifier, the IP address management system will identify the subnet as a different subnet. For example, see Figure 2 As shown in the figure, VPNA accesses the network through NAT1 and NAT2. At this time, the server can obtain the subnet data of NAT1+VPNA and the subnet data of NAT2+VPNA. VPNA is a subnet. In this case, the server will identify NAT1+VPNA and NAT2+VPNA as different subnets.
[0046] In order to solve the above problem, the present application provides a technical solution for identifying whether data of different subnets belong to the same subnet based on ARP packets.
[0047] For example, see Figure 3 FIG. 1 is a detailed flow chart of a subnet management method provided in an embodiment of the present application, the method comprising the following steps:
[0048] Step 300: Obtain subnet data of each subnet included in the network, wherein the subnet data of a subnet includes the subnet configuration of the subnet and the IP address information of each device included in the subnet.
[0049] In the embodiment of the present application, each subnet is connected to the Internet through a NAT gateway device; then, when obtaining the subnet data of each subnet included in the network, a preferred implementation method is:
[0050] The subnet data of each subnet is obtained from the NAT gateway device connected to each subnet, wherein the subnet data of a subnet also includes device identification information of the NAT gateway device connected to the subnet.
[0051] In actual applications, when the management device scans the entire network IP and determines that each subnet is connected to the Internet through a NAT gateway device, it can obtain the subnet data of the corresponding subnet from the NAT gateway device and save it. At this time, the obtained subnet data is unprocessed temporary data.
[0052] It should be noted that, in the present embodiment, the subnet data of a subnet may specifically include: subnet configuration (subnet division rules), subnet device IP division (IP address information of each device included in the subnet), and the user status associated with the subnet device; and the subnet configuration may specifically include: subnet address allocation rules, network segments, subnet masks, and reserved addresses.
[0053] Step 310: Determine whether there is a first subnet and a second subnet with the same subnet configuration.
[0054] In actual applications, since subnets are independent of each other, when creating a subnet, in order to simplify the operation, you can copy the configuration of other created subnets as the configuration of the newly created subnet. In this way, the subnet address allocation rules, network segments, subnet masks, and reserved addresses of the two subnets may be exactly the same.
[0055] Step 320: If it is determined that there are a first subnet and a second subnet with the same subnet configuration, obtain the first MAC address corresponding to each device IP address included in the first subnet, and obtain the second MAC address corresponding to each device IP address included in the second subnet.
[0056] In an embodiment of the present application, if it is determined that there are two subnets with identical subnet configurations (e.g., a first subnet and a second subnet), then the MAC address of each device in the first subnet can be obtained based on the IP address of each device in the first subnet, and the MAC address of each device in the second subnet can be obtained based on the IP address of each device in the second subnet. A MAC address is an address that uniquely identifies a device.
[0057] In the embodiment of the present application, when obtaining the MAC addresses corresponding to the IP addresses of each device included in a subnet, a preferred implementation method is:
[0058] According to the IP addresses of the devices included in the subnet, an Address Resolution Protocol ARP message is sent to each device; and an ARP response fed back by each device is received to obtain the MAC address corresponding to each device IP address.
[0059] That is, the MAC corresponding to each IP in the first subnet is obtained through the ARP message, and the MAC corresponding to each IP in the second subnet is obtained through the ARP message.
[0060] Step 330: Determine whether the number of identical MAC addresses in the first MAC address and the second MAC address exceeds a preset threshold.
[0061] Specifically, the obtained first MAC address and the second MAC address are compared to determine whether the same rate of MAC addresses included in the first MAC address and the second MAC address exceeds a set threshold.
[0062] In actual applications, due to the presence of dynamic MAC addresses in the network, it is not possible to determine whether two subnets are the same subnet based on whether the MAC addresses are exactly the same. For example, if the MAC addresses are consistent at 80%, the two subnets are considered to be the same subnet.
[0063] Step 340: If the judgment result is yes, it is determined that the first subnet and the second subnet are the same subnet, and the subnet data of the first subnet and the second subnet are merged into one subnet data for management.
[0064] In a network, if the MAC addresses of devices in two subnets are the same, they are connected to multiple NAT gateways. This means that the management device obtains subnet data for the subnet twice from the NAT network management device. The management device obtains subnet data for the subnet repeatedly from different NAT gateways. In this case, the subnet data for the subnet needs to be merged, meaning only one copy of the subnet data is needed.
[0065] Specifically, since the NAT device identifier + subnet data is needed to uniquely identify the subnet data of a subnet, if the subnet data of the first subnet (target subnet) is identified as: NAT1 + subnet data 1, and the subnet data of the second subnet (target subnet) is identified as: NAT2 + subnet data 1, when the subnet data of the first subnet and the second subnet are merged, the subnet data of the subnet (target subnet) can be identified as: NAT1 and / or NAT2 + subnet data 1.
[0066] For example, see Figure 4 FIG. 1 is a schematic diagram of a subnet management device provided in an embodiment of the present application, the device comprising:
[0067] An acquisition unit 40 is configured to acquire subnet data of each subnet included in the network, wherein the subnet data of a subnet includes the subnet configuration of the subnet and the IP address information of each device included in the subnet;
[0068] A judging unit 41 is configured to judge whether there is a first subnet and a second subnet with the same subnet configuration;
[0069] If the determining unit 41 determines that there are a first subnet and a second subnet with the same subnet configuration, the acquiring unit 40 is further configured to acquire a first MAC address corresponding to each IP address of each device included in the first subnet, and acquire a second MAC address corresponding to each IP address of each device included in the second subnet;
[0070] The determining unit 41 is further configured to determine whether the number of identical MAC addresses in the first MAC address and the second MAC address exceeds a preset threshold;
[0071] The management unit 42 is used to determine that the number of identical MAC addresses in the first MAC address and the second MAC address exceeds a preset threshold if the judgment unit 41 determines that the first subnet and the second subnet are the same subnet, and merge the subnet data of the first subnet and the second subnet into one subnet data for management.
[0072] Optionally, each subnet accesses the Internet through a NAT gateway device; when obtaining subnet data of each subnet included in the network, the obtaining unit 42 is specifically used to:
[0073] The subnet data of each subnet is obtained from the NAT gateway device connected to each subnet, wherein the subnet data of a subnet also includes device identification information of the NAT gateway device connected to the subnet.
[0074] Optionally, the subnet configuration of a subnet includes: subnet address allocation rules, network segments, subnet masks, and reserved addresses.
[0075] Optionally, when obtaining the MAC addresses corresponding to the IP addresses of the devices included in a subnet, the obtaining unit 42 is specifically configured to:
[0076] According to the IP address of each device included in the subnet, an Address Resolution Protocol ARP message is sent to each device;
[0077] Receive the ARP response from each device to obtain the MAC address corresponding to the IP address of each device.
[0078] The above units may be one or more integrated circuits configured to implement the above methods, such as one or more application-specific integrated circuits (ASICs), one or more digital signal processors (DSPs), or one or more field programmable gate arrays (FPGAs). For another example, when a unit is implemented by scheduling program code through a processing element, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these units may be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0079] Furthermore, the subnet management device provided in the embodiment of the present application, from the hardware level, the hardware architecture diagram of the subnet management device can be found in Figure 5 As shown, the subnet management device may include: a memory 50 and a processor 51,
[0080] The memory 50 is used to store program instructions. The processor 51 calls the program instructions stored in the memory 50 and executes the above method embodiment according to the obtained program instructions. The specific implementation method and technical effect are similar and will not be repeated here.
[0081] Optionally, the present application also provides a subnet management device, comprising at least one processing element (or chip) for executing the above method embodiment.
[0082] Optionally, the present application also provides a program product, such as a computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions are used to enable the computer to execute the above method embodiments.
[0083] Here, the machine-readable storage medium can be any electronic, magnetic, optical or other physical storage device that can contain or store information, such as executable instructions, data, etc. For example, the machine-readable storage medium can be: RAM (Random Access Memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard disk drive), solid state drive, any type of storage disk (such as CD, DVD, etc.), or similar storage media, or a combination thereof.
[0084] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email transceiver, game console, tablet computer, wearable device, or any combination of these devices.
[0085] For the convenience of description, the above devices are described as being divided into various units according to their functions. Of course, when implementing this application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0086] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the embodiments of the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0087] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0088] Furthermore, these computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0089] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable device to implement the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0090] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A subnet management method, characterized in that: The method comprises: Obtain subnet data for each subnet included in the network, where each subnet is connected to the Internet through a NAT gateway device; the subnet data for a subnet includes the subnet configuration of the subnet and the IP address information of each device included in the subnet; Determine whether there is a first subnet and a second subnet with the same subnet configuration; If it is determined that a first subnet and a second subnet exist with the same subnet configuration, obtaining first MAC addresses corresponding to the IP addresses of the devices included in the first subnet, and obtaining second MAC addresses corresponding to the IP addresses of the devices included in the second subnet; Determine whether the number of identical MAC addresses in the first MAC address and the second MAC address exceeds a preset threshold; If the judgment result is yes, it is determined that the first subnet and the second subnet are the same subnet, and the subnet data of the first subnet and the second subnet are merged into one subnet data for management.
2. The method according to claim 1, wherein The steps for obtaining subnet data of each subnet included in the network include: The subnet data of each subnet is obtained from the NAT gateway device connected to each subnet, wherein the subnet data of a subnet also includes device identification information of the NAT gateway device connected to the subnet.
3. The method according to claim 1 or 2, wherein: The subnet configuration of a subnet includes: subnet address allocation rules, network segment, subnet mask, and reserved addresses.
4. The method according to claim 1 or 2, wherein: The steps for obtaining the MAC addresses corresponding to the IP addresses of each device in a subnet include: According to the IP address of each device included in the subnet, an Address Resolution Protocol ARP message is sent to each device; Receive the ARP response from each device to obtain the MAC address corresponding to the IP address of each device.
5. A subnet management device, characterized in that: The device comprises: An acquisition unit is configured to acquire subnet data of each subnet included in the network, wherein each subnet is connected to the Internet through a NAT gateway device; the subnet data of a subnet includes the subnet configuration of the subnet and the IP address information of each device included in the subnet; A judging unit, configured to judge whether there are a first subnet and a second subnet with the same subnet configuration; If the judgment unit determines that there are a first subnet and a second subnet with the same subnet configuration, the acquisition unit is further configured to acquire a first MAC address corresponding to each IP address of each device included in the first subnet, and acquire a second MAC address corresponding to each IP address of each device included in the second subnet; The determining unit is further configured to determine whether the number of identical MAC addresses in the first MAC address and the second MAC address exceeds a preset threshold; A management unit, if the judgment unit determines that the number of identical MAC addresses in the first MAC address and the second MAC address exceeds a preset threshold, the management unit is used to determine that the first subnet and the second subnet are the same subnet, and merge the subnet data of the first subnet and the second subnet into one subnet data for management.
6. The device according to claim 5, characterized in that When acquiring subnet data of each subnet included in the network, the acquiring unit is specifically configured to: The subnet data of each subnet is obtained from the NAT gateway device connected to each subnet, wherein the subnet data of a subnet also includes device identification information of the NAT gateway device connected to the subnet.
7. The device according to claim 5 or 6, characterized in that The subnet configuration of a subnet includes: subnet address allocation rules, network segment, subnet mask, and reserved addresses.
8. The device according to claim 5 or 6, characterized in that When obtaining the MAC addresses corresponding to the IP addresses of the devices included in a subnet, the obtaining unit is specifically used to: According to the IP address of each device included in the subnet, an Address Resolution Protocol ARP message is sent to each device; Receive the ARP response from each device to obtain the MAC address corresponding to the IP address of each device.
9. A subnet management device, characterized in that: The subnet management device includes: a memory for storing program instructions; The processor is configured to call the program instructions stored in the memory, and execute the steps of the method according to any one of claims 1 to 4 according to the obtained program instructions.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable the computer to execute the steps of the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Method for routing and forwarding packet of power line communication system of low-voltage distribution network
CN102355405A
MAC address proxy response method and device
CN111130981A