Method and apparatus for detecting network address conflict

By implementing network address conflict detection methods in DHCP servers, the problem of conflict between DHCP protocol and static IP address is solved, intelligent network address allocation and conflict avoidance are achieved, and user experience is improved.

CN118200290BActive Publication Date: 2025-07-18BEIJING TAIYUE TIANCHENG TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410326402.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-21
Publication Date
2025-07-18
Estimated Expiration
2044-03-21

AI Technical Summary

Technical Problem

In the prior art, the IP address assigned by the DHCP protocol is prone to conflict with the static IP address specified by artificially, resulting in network equipment being intermittent or unable to communicate with each other, and the user experience is poor.

Method used

By implementing a network address conflict detection method in the DHCP server, responding to the network access request of the network device, obtaining the network address to be allocated, and checking whether it is occupied through ARP query and other means. If it is not occupied, it is allocated to the network device, and intelligent prompts and address modifications are performed when a conflict is detected.

Benefits of technology

It effectively avoids network address conflicts, improves the intelligence of network access process, prevents network disconnection and unstable communications, and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118200290B_ABST
    Figure CN118200290B_ABST
Patent Text Reader

Abstract

The present invention provides a method and apparatus for detecting network address conflicts, which relates to the technical field of Ethernet communication. The method includes: responding to an access request sent by a network device, obtaining a network address to be allocated; querying whether the network address to be allocated is occupied; if not, allocating the network address to be allocated to the network device. The method and apparatus for detecting network address conflicts provided by the present invention can effectively avoid allocating conflicting network addresses to network devices through the process of querying whether the network address to be allocated is occupied. At the same time, it can also comprehensively detect conflicts of the network address to be allocated, and then give an intelligent prompt, making the access process of network devices more intelligent, and also avoiding the phenomenon of network disconnection or unstable communication caused by network address conflicts, thereby improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of Ethernet communication, and in particular, to a method and device for detecting network address conflicts. Background Art

[0002] Generally, for an IP (Internet Protocol) network using the DHCP (Dynamic Host Configuration Protocol), IP addresses are usually assigned to network devices accessing the network through a DHCP service. However, in actual use, there may also be static IP addresses specified manually on some DHCP network segments. This situation often leads to IP address conflicts, that is, the specified static IP address conflicts with the IP address assigned by the DHCP service. Network devices with address conflicts may experience intermittent network connections or inability to communicate, resulting in the affected network devices being forced to switch from using the DHCP protocol to using other static IP addresses, which leads to poor user experience. Summary of the Invention

[0003] In view of this, an object of the present invention is to provide a method and device for detecting network address conflicts to alleviate the above technical problems.

[0004] In a first aspect, an embodiment of the present invention provides a method for detecting network address conflicts, the method including: responding to an access request sent by a network device, and obtaining an available network address to be assigned; querying whether the network address to be assigned is occupied; if not, assigning the network address to be assigned to the network device.

[0005] Combined with the first aspect, an embodiment of the present invention provides a first possible implementation manner of the first aspect, wherein the network address to be assigned is an IP address; the step of querying whether the network address to be assigned is occupied includes: performing an ARP query operation on the network address to be assigned; monitoring whether an ARP response message is received; if so, determining that the network address to be assigned is occupied; if not, determining that the network address to be assigned is not occupied.

[0006] In combination with the first aspect, an embodiment of the present invention provides a second possible implementation manner of the first aspect. Wherein, the above method further includes: in response to the allocated network address meeting the marking condition, marking the allocated network address; recording the marking duration of the allocated network address, and if the marking duration reaches a preset duration threshold, determining the allocated network address as a network address to be allocated; if the marking duration of the network address does not reach the preset duration threshold, and the response information of the network device corresponding to the allocated network address is monitored, then reallocating the marked network address to the network device and restoring the recorded marking duration to the initial value.

[0007] In combination with the second possible implementation manner of the first aspect, an embodiment of the present invention provides a third possible implementation manner of the first aspect. Wherein, the step of responding that the allocated network address meets the marking condition includes: responding to receiving a sleep broadcast message, where the sleep broadcast message is sent when the network device enters the sleep state; determining that the network address of the network device sending the sleep broadcast message meets the marking condition; or, detecting the network connection status of the network device at a preset time interval, and if it is detected that the network device disconnects from the network, determining that the network address of the network device that disconnects from the network meets the marking condition.

[0008] In combination with the first possible implementation manner of the first aspect, an embodiment of the present invention provides a fourth possible implementation manner of the first aspect. Wherein, the above method further includes: in response to the network access event of the network device, extracting the IP address of the network device; judging whether there is a corresponding registration record for the IP address; the registration record is used to record the IP address and the corresponding relationship between the IP address and the MAC address; if so, sending MAC layer messages to the network device corresponding to the MAC address in the registration record and the network device corresponding to the network access event respectively; if response messages based on the MAC layer messages are received respectively, sending an address conflict message to the network device corresponding to the network access event.

[0009] In combination with the fourth possible implementation manner of the first aspect, an embodiment of the present invention provides a fifth possible implementation manner of the first aspect. Wherein, the above method further includes: if there is no corresponding registration record for the IP address, or the response message of the network device corresponding to the MAC address in the registration record is not received, then allowing the network device corresponding to the network access event to access the network; registering the network device that accesses the network to generate a registration record of the network device.

[0010] Combined with the fifth possible implementation manner of the first aspect, an embodiment of the present invention provides a sixth possible implementation manner of the first aspect, wherein the method further includes: monitoring the MAC address of the network device accessing the network; if it is detected that multiple routing ports have the same MAC address within the same time period, determining that a MAC conflict event occurs; recording the MAC address corresponding to the conflict event, and sending the MAC address corresponding to the conflict event to the network device.

[0011] Combined with the first aspect, an embodiment of the present invention provides a seventh possible implementation manner of the first aspect, wherein the method further includes: if it is queried that the network address to be allocated is occupied, obtaining the configuration status of the network device and the network device occupying the network address to be allocated; wherein, the configuration status includes whether the network device is configured to allow modification of the network address, and a dynamic modification priority; wherein, the dynamic modification priority is used to characterize the willingness of the network device to allow modification of the network address; modifying the network address of the network device based on the configuration status.

[0012] Combined with the seventh possible implementation manner of the first aspect, an embodiment of the present invention provides an eighth possible implementation manner of the first aspect, wherein the step of modifying the network address of the network device based on the configuration status includes: if both the network device and the network device occupying the network address to be allocated are configured to allow modification of the network address, obtaining the dynamic modification priority; selecting the network device with a higher willingness to modify the network address based on the dynamic modification priority to modify the network address; if only one of the network device and the network device occupying the network address to be allocated is configured to allow modification of the network address, modifying the network address of the network device that allows modification of the network address.

[0013] In a second aspect, an embodiment of the present invention further provides a network address conflict detection device, the device includes: a response module, configured to respond to an access request sent by a network device and obtain a network address to be allocated; wherein, the network address to be allocated is an available network address; a query module, configured to query whether the network address to be allocated is occupied; an allocation module, configured to allocate the network address to be allocated to the network device when the query result of the query module is negative.

[0014] In a third aspect, an embodiment of the present invention further provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the steps of the method described in the first aspect above are implemented.

[0015] Fourthly, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is run by a processor, it executes the steps of the method described in the first aspect above.

[0016] The embodiments of the present invention bring the following beneficial effects:

[0017] The method and device for detecting network address conflicts provided by the embodiments of the present invention can respond to the network access request sent by a network device, obtain the network address to be allocated, and further query whether the network address to be allocated is occupied. If not, the network address to be allocated is allocated to the network device for use. By querying whether the network address to be allocated is occupied, it is possible to effectively avoid allocating conflicting network addresses to network devices. At the same time, it is also possible to comprehensively detect conflicts for the network address to be allocated and then give an intelligent prompt, making the network access process of the network device more intelligent and also avoiding the phenomenon of network disconnection or unstable communication caused by network address conflicts, thereby improving the user experience.

[0018] Other features and advantages of the present invention will be described in the following specification, and some of them will become obvious from the specification or be understood by implementing the present invention. The objectives and other advantages of the present invention are achieved and obtained by the structures specifically pointed out in the specification, claims, and drawings.

[0019] To make the above objectives, features, and advantages of the present invention more obvious and understandable, the following specific preferred embodiments are given and described in detail in conjunction with the accompanying drawings. Description of the Drawings

[0020] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for the description of the specific embodiments or the prior art. Obviously, the following drawings are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative efforts.

[0021] Figure 1 It is a schematic diagram of the application scenario of a network system provided by an embodiment of the present invention;

[0022] Figure 2 It is a flowchart of a method for detecting network address conflicts provided by an embodiment of the present invention;

[0023] Figure 3 It is a flowchart of another method for detecting network address conflicts provided by an embodiment of the present invention;

[0024] Figure 4Schematic structural diagram of a network address conflict detection device provided by an embodiment of the present invention;

[0025] Figure 5 Schematic structural diagram of an electronic device provided by an embodiment of the present invention. Detailed implementation manners

[0026] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Apparently, the described embodiments are some but not all of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0027] Currently, when performing network address conflict detection, it is difficult to consider sleeping devices and temporarily disconnected devices, which reduces the effect of network address conflict detection.

[0028] For example, the inventor creatively found that when more and more network devices use static IP addresses, it will further cause a higher probability of conflict between the IP addresses dynamically allocated by DHCP and the addresses of other network devices. For example, when a network device attempts to access the network using a static IP address, before configuring the static IP address, the user is accustomed to pinging this static IP address. If there is no response, it will be occupied. Usually, for a sleeping network device, when it wakes up, it will continue to use the original IP address instead of reallocating a new IP address, which often leads to conflicts between the IP addresses of new static IP devices and the awakened network devices, causing great troubles to network users.

[0029] In the related art, the above problems are not recognized, so it is difficult to improve the user experience.

[0030] Based on this, a network address conflict detection method and device provided by an embodiment of the present invention can provide a more intelligent improvement method for the network address conflict detection process.

[0031] To facilitate the understanding of this embodiment, first, a network address conflict detection method disclosed in an embodiment of the present invention will be introduced in detail.

[0032] In a possible implementation manner, an embodiment of the present invention provides a network address conflict detection method. Specifically, the network address conflict detection method in the embodiment of the present invention is applied to a DHCP server of a network system. For example, it can be a DHCP server configured on a router or a separately configured DHCP server communicating with the router.

[0033] For ease of understanding,Figure 1 FIG. 1 shows a schematic diagram of an application scenario of a network system, which may include multiple network devices, switches, and routers. Here, taking the example of a router itself configured with a DHCP server, the network devices can be directly connected to the router and send network access requests to the router. When the ports of the router are limited or the number of network devices is large, the switches can also be used as a network medium to communicate with the router, and can also send network access requests to the router, and finally connect to the network system. For the sake of convenience of explanation, Figure 1 in which, taking a PC as a network device as an example, and, Figure 1 FIG. 1 shows a limited number of switches and routers. The number of network devices, switches, and routers included in a specific network system can be set according to actual usage conditions, and the embodiments of the present invention do not limit this.

[0034] Based on Figure 1 the application scenario shown in Figure 2 FIG. 2 shows a flowchart of a method for detecting network address conflicts, as Figure 2 shown, including the following steps:

[0035] Step S202, in response to a network access request sent by a network device, obtain a network address to be allocated; wherein, in the embodiments of the present invention, the network device can be a personal computer, a laptop, a desktop computer, a mobile phone, an early education machine, etc., an electronic device with a network connection requirement, and can establish a connection with the DHCP server in a wired or wireless manner, and then send the above-mentioned network access request.

[0036] Furthermore, the network address to be allocated in the embodiments of the present invention is an available network address, and these available network addresses can be recorded in the routing table and saved in the DHCP server, so that when allocating a network address, the network address to be allocated can be obtained from the routing table.

[0037] Step S204, query whether the network address to be allocated is occupied;

[0038] Step S206, if not, then allocate the network address to be allocated to the network device.

[0039] The method for detecting network address conflicts provided by the embodiments of the present invention can respond to the network access request sent by a network device to obtain the network address to be allocated; further query whether the network address to be allocated is occupied; if not, allocate the network address to be allocated to the network device for use. By querying whether the network address to be allocated is occupied, it is possible to effectively avoid allocating conflicting network addresses to network devices. At the same time, it is also possible to comprehensively detect conflicts for the network address to be allocated, and then give an intelligent prompt, making the network access process of the network device more intelligent, and also avoiding the phenomenon of network disconnection or unstable communication caused by network address conflicts, thereby improving the user experience.

[0040] In actual use, the network address to be allocated in the embodiments of the present invention is an IP address. In a network system using the DHCP protocol, a network device can send a network access request to a DHCP server to request the allocation of an IP address. In the embodiments of the present invention, network address conflict detection can be performed when the network device sends a network access request to the DHCP server, and the detection objects include the IP address and the MAC (Media Access Control Address) address.

[0041] In actual use, for the IP address allocated by the DHCP server, when it conflicts with other IP addresses and causes the inability to access the network, users often have to manually try to specify a static IP address. However, using this static IP address will further increase the probability of the IP address dynamically allocated by the DHCP conflicting with the addresses of other network devices, causing great confusion and inconvenience to network users. In the embodiments of the present invention, before allocating the IP address, it is possible to first detect whether the IP address is occupied, and further allocate the network address to be allocated to the network device when it is not occupied, which can effectively reduce the risk of the DHCP server allocating invalid IP addresses.

[0042] Further, in the embodiments of the present invention, when querying whether the network address to be allocated is occupied, it can be implemented through an ARP (Address Resolution Protocol) query operation. Therefore, on the basis of Figure 2 the above, Figure 3 a flowchart of another method for detecting network address conflicts is also shown, which further describes the process of querying whether the network address to be allocated is occupied and the processing process after detecting a conflict, as shown in Figure 3 the following steps:

[0043] Step S302, respond to the network access request sent by the network device to obtain the network address to be allocated;

[0044] Among them, in the embodiments of the present invention, the network address to be allocated is an IP address, and this network address to be allocated is an available network address. The above network access request is sent by a network device to a DHCP server.

[0045] Furthermore, considering that the network system in the embodiments of the present invention is a network system based on the DHCP protocol, therefore, the above network access request can also be referred to as a DHCP request.

[0046] Step S304, perform an ARP query operation on the network address to be allocated;

[0047] Step S306, monitor whether an ARP response message is received;

[0048] Among them, when performing the ARP query operation, the DHCP server can broadcast an ARP message in the network system to inquire whether the IP address is occupied. If it is occupied, the network device currently using this IP address can respond with an ARP response message. At this time, it means that this IP address is occupied. If no ARP response message is received within a preset time period, it means that this IP address is not occupied. Only the IP address for which no ARP response message is received is further allocated by the DHCP server to a newly networked network device, which can effectively reduce the risk of the DHCP server allocating invalid IP addresses.

[0049] If the answer is no, execute step S308. If the answer is yes, execute step S312;

[0050] Step S308, determine that the network address to be allocated is not occupied;

[0051] Step S310, allocate the network address to be allocated to the network device;

[0052] Step S312, determine that the network address to be allocated is occupied;

[0053] Step S314, obtain the configuration status of the network device and the network device occupying the network address to be allocated;

[0054] Step S316, modify the network address of the network device based on this configuration status.

[0055] Specifically, if it is found in the process of the above ARP query operation that the network address to be allocated is occupied, then the processes of step S314 and step S316 are executed, that is, obtaining the configuration status of the network device sending the network access request and the network device occupying the network address to be allocated; wherein, the configuration status in the embodiments of the present invention includes whether the network device is configured to allow modification of the network address, and the dynamic modification priority; the dynamic modification priority is used to characterize the willingness of the network device to allow modification of the network address; for example, the higher the dynamic modification priority, the easier it is for the network device to be modified with the IP address, and vice versa, the lower the dynamic modification priority, the more difficult it is for the network device to be modified with the IP address. For example, for network devices used in normal ordinary families, a higher dynamic modification priority can be set, while for some confidential places, a lower dynamic modification priority can be set. In addition, it can also be set that the lower the dynamic modification priority, the more difficult it is for the network device to be modified with the IP address, etc. Usually, the configuration status of the network device can be pre-configured according to the actual situation, and the embodiments of the present invention do not limit this.

[0056] Further, when modifying the network address of the network device based on the configuration status, if both the network device applying for network access and the network device occupying the network address to be allocated are configured to allow modification of the network address, then obtain the above dynamic modification priority; select the network device with a higher willingness to be modified with the network address based on the dynamic modification priority to modify the network address; if only one of the network device applying for network access and the network device occupying the network address to be allocated is configured to allow modification of the network address, then modify the network address of the network device that allows modification of the network address.

[0057] Wherein, the above modification of the network address means setting the IP address of the network device to a new available IP address. For example, re-searching for an available IP address in the routing table as the new IP address and allocating it to the network device that allows modification of the network address.

[0058] For example, options such as "the IP address can be dynamically modified by the DHCP server when there is a conflict" and "dynamic modification priority" can be added to the IP address configuration page of the network device. For network devices that open this option and select the DHCP protocol, when the DHCP server discovers a conflict, it automatically changes the IP address of the network device with the address conflict. As for which IP address to modify, it is determined according to the "dynamic modification priority". For example, select the party with a lower priority to modify.

[0059] For the option of not selecting "the IP address can be dynamically modified by the DHCP server in case of conflict", the DHCP server retains its fixed IP address, changes the IP address of the other party, and broadcasts the information of the IP address change on the internal network for a period of time. In this way, if there is a service on the network device with this IP address, the client program that was previously connected to this service can timely obtain the notice of this IP address change and switch to the new service address.

[0060] Further, if both the network device applying for network access and the network device occupying the network address to be allocated are configured not to allow modification of the network address, a prompt message indicating that there is no available network address currently will be sent to the network device applying for network access. Or, in step S302 above, when responding to the network access request sent by the network device, if it is detected that there is no available network address to be allocated currently, a prompt message indicating that there is no available network address currently will also be sent to the network device applying for network access.

[0061] Further, considering that the network address can be modified in the embodiments of the present invention, therefore, in order to facilitate the user to query the modified network address, in the embodiments of the present invention, the network address conflict and the modification information of the IP address can also be prompted in common commands. For example, in common commands such as ifconfig, prompts such as IP address conflict, MAC address conflict, and prompt for no available IP address are added. In ping, it is prompted whether the IP address has been dynamically modified by the DHCP server, and what the specific modified IP address is, etc. Specifically, corresponding commands can be configured according to the actual situation for the user to use, and the embodiments of the present invention do not limit this.

[0062] Further, considering the need for energy conservation and power saving, many current network devices are configured with a sleep function. Therefore, for the sleeping network devices, in the embodiments of the present invention, they can also be marked to keep the IP addresses of these sleeping devices so that they will not be temporarily allocated to other network devices.

[0063] Specifically, in the embodiments of the present invention, the allocated network address can be marked in response to the allocated network address meeting the marking condition; then the marking duration of the allocated network address is recorded. If the marking duration reaches the preset duration threshold, the allocated network address is determined as the network address to be allocated; that is, if the allocated network address has not been used for more than the preset duration threshold, it can be reallocated to other network devices for use.

[0064] If the marking duration of the network address does not reach the preset duration threshold and the response information of the network device corresponding to the allocated network address is monitored, the marked network address is reallocated to the network device, and the recorded marking duration is restored to the initial value.

[0065] For example, when a network device assigned an IP address by a DHCP server enters the sleep state, in the embodiments of the present invention, a sleep broadcast message is added to be sent by the network device before entering the sleep state on the DHCP server side. In this way, the DHCP server marks that the IP addresses of these network devices entering the sleep state will not be re-assigned to other network devices temporarily and can be used as the last standby IP addresses, which can be assigned to other network devices only after the available IP addresses are used up. In this way, some IP addresses that are withdrawn from the network after sleep can be reused with the lowest conflict risk.

[0066] That is, for a network device with a sleep function, the above-mentioned response to the assigned network address meets the marking condition and can respond to the received sleep broadcast message. Among them, the sleep broadcast message is sent by the network device when it enters the sleep state; then the DHCP server determines that the network address of the network device sending the sleep broadcast message meets the marking condition.

[0067] Furthermore, for a network device that is disconnected from the network, the network address can also be set to meet the marking condition. Specifically, the network connection status of the network device can be detected at a preset time interval. If it is detected that the network device is disconnected from the network, it is determined that the network address of the network device disconnected from the network meets the marking condition.

[0068] For example, the DHCP server periodically detects each network device. For example, it can periodically send ARP messages to the network devices that have accessed the network. If there is no response, it means that the network device is disconnected from the network, such as being offline or having the network cable unplugged, etc. At this time, in the embodiments of the present invention, it can be determined that the network address of the network device disconnected from the network meets the marking condition, and then the DHCP server reserves the IP address of this network device for a period of time. In this way, when the network device accesses the network again, it can still be assigned the same IP address. Otherwise, sometimes just changing the network cable or temporarily disconnecting the network will result in the re-assignment of the IP address. Especially when the network is unstable, it will cause the network device to be continuously assigned new IP addresses, which will cause a great waste of IP address resources. If the marking duration reaches a preset duration threshold, such as one week, or several days, etc., and the network device that has been disconnected from the network has not accessed the network again, the DHCP server can recycle this IP address and re-assign it to a new network device.

[0069] Further, in the embodiments of the present invention, for newly networked network devices, the IP address of the network device that has newly joined the network may also be extracted in response to the network access event of the network device; it is determined whether there is a corresponding registration record for this IP address; wherein, the registration record in the embodiments of the present invention is used to record the IP address and the corresponding relationship between the IP address and the MAC address; if so, an MAC layer message is sent to the network device corresponding to the MAC address in the registration record and the network device corresponding to the network access event respectively; if response messages based on the MAC layer message are received respectively, an address conflict message is sent to the network device corresponding to the network access event.

[0070] That is, by monitoring the network access event, it is possible to detect that the MAC addresses conflict. For example, the DHCP service may send an ARP broadcast to the newly networked network device, and extract the IP address based on the ARP message responded by the newly networked network device to register the IP address of the newly networked network device. At this time, the registered content includes not only the IP address assigned by the DHCP server, but also the network devices that access the network with a static IP address. If it is found that the same IP address has been registered with different MAC addresses before, then the DHCP server may send MAC layer messages to the two conflicting network devices successively. If MAC layer response messages are received from the two conflicting network devices, an address conflict message is sent to the newly networked network device. At this time, after the newly networked network device receives the address conflict message, an address conflict warning can be popped up, so that the address conflict risk can be timely fed back to the newly networked network device. The reason for using the MAC layer message is that the MAC layer message is a layer-2 message, and the IP layer message is a layer-3 message. The layer-2 message is not affected by the IP address and can be accurately used for conflict detection.

[0071] Further, if there is no corresponding registration record for the above IP address, or the response message from the network device corresponding to the MAC address in the registration record is not received, the network device corresponding to the network access event at this time is allowed to access the network; and the network device that has accessed the network is registered to generate a registration record of the network device.

[0072] Further, for the monitoring process of the above MAC address conflict, the router monitoring function may also be added, that is, the MAC address of the network device that has accessed the network is monitored at the router level; if it is monitored that there are the same MAC addresses on multiple routing ports within the same time period, it is determined that a MAC conflict event occurs; the MAC address corresponding to the conflict event at this time is recorded, and the MAC address corresponding to the conflict event is sent to the network device.

[0073] In actual use, the monitoring function of this router can be used to monitor network attack events. Generally, in multiple ports during the same period, or among multiple MAC addresses of the same port, the same MAC address will not appear. At the same time, the corresponding information of ports and MAC addresses is recorded in the routing table of the router. If there are the same MAC addresses in multiple routing ports during the same period, the router can record the conflicting MAC addresses at this time and report the conflicting MAC addresses to the network devices related to the MAC address. In this way, this network device can not only sense the IP address conflict, but also sense the MAC address conflict, and can also prevent network attack events such as ARP attacks (or ARP spoofing) and ARP viruses from causing events where the same MAC address appears, providing strong guarantee for a secure and reliable network environment. At the same time, in the case of detecting a MAC address conflict, it can try to retain the communication of the network device with a longer online time, block the communication of the network device with a conflicting MAC address that joins later, and send a "MAC conflict warning" to the blocked network device.

[0074] Furthermore, the above-mentioned monitoring function of the router can also be extended down to the use of switches, that is, the switches in the network system can also be configured to cooperate with the router, and generate the full-intranet MAC address topology of the router + multi-level switches. This topological relationship can be recorded in the reason table. After recording the full-intranet MAC address topology of the router in this way, the router can not only detect MAC address conflicts in a timely manner, but also give early warnings to avoid network storms caused by intranet loopbacks.

[0075] Moreover, the switch can also recognize and cooperate with forwarding the command of "conflicting MAC address port blocking" issued by the router, as well as forwarding the "MAC conflict warning". Among them, a network storm is a communication storm caused by a path loop, and the monitoring function of the router in the embodiment of the present invention can recognize the appearance of this repeated MAC address in different ports, so as to cut off the redundant ports in conflict in a timely manner, and thus can perform link blocking and storm warning on the ports that may cause network storms, realizing the intelligent repair of network storms.

[0076] In specific implementation, for network devices that use link blocking to solve MAC address conflicts, it is also necessary to distinguish between simple MAC address conflicts and network storms. If a broadcast packet burst occurs on the basis of a MAC address conflict, it is determined as a network storm. For network devices with simple MAC address conflicts, only the packets with this MAC address as the source MAC address need to be discarded on specific ports, while for network storms, all communications on specific ports should be cut off, which can be set according to actual use situations, and the embodiments of the present invention do not limit this.

[0077] In summary, the method for detecting network address conflicts provided by the embodiments of the present invention can detect IP address conflicts, and fully considers sleeping network devices and network devices with disconnected networks, enabling the detection of various conflicts of IP addresses assigned or statically specified by the DHCP server.

[0078] Further, in the embodiments of the present invention, the conflicting network addresses can also be prompted and automatically avoided by querying whether the network address to be assigned is occupied.

[0079] In addition, in the embodiments of the present invention, a method for resolving MAC address conflicts with the help of routers and switches, as well as a method for automatically detecting and automatically repairing network storms, are also provided, which can perform a more comprehensive detection of network address conflicts, as well as more intelligent prompting and self-repair, making network devices more intelligent and thus improving the user experience.

[0080] Further, on the basis of the above embodiments, the embodiments of the present invention also provide a device for detecting network address conflicts, such as Figure 4 a schematic structural diagram of a device for detecting network address conflicts shown, the device includes:

[0081] A response module 40, configured to respond to an access request sent by a network device and obtain a network address to be assigned; wherein, the network address to be assigned is an available network address;

[0082] A query module 42, configured to query whether the network address to be assigned is occupied;

[0083] An allocation module 44, configured to, when the query result of the query module is negative, assign the network address to be assigned to the network device.

[0084] The device for detecting network address conflicts provided by the embodiments of the present invention has the same technical features as the method for detecting network address conflicts provided by the above embodiments, so it can also solve the same technical problems and achieve the same technical effects.

[0085] Further, the embodiments of the present invention also provide an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor implements the steps of the above method when executing the computer program.

[0086] The embodiments of the present invention also provide a computer-readable storage medium, on which a computer program is stored, and the computer program implements the steps of the above method when being run by a processor.

[0087] Further, the embodiments of the present invention also provide a schematic structural diagram of an electronic device, such asFigure 5 As shown, it is a schematic structural diagram of the electronic device. Among them, the electronic device includes a processor 51 and a memory 50. The memory 50 stores computer-executable instructions that can be executed by the processor 51, and the processor 51 executes the computer-executable instructions to implement the above method.

[0088] In Figure 5 In the illustrated embodiment, the electronic device further includes a bus 52 and a communication interface 53. Among them, the processor 51, the communication interface 53, and the memory 50 are connected through the bus 52.

[0089] Among them, the memory 50 may include a high-speed random access memory (RAM, Random Access Memory), and may also include a non-volatile memory, such as at least one disk memory. Through at least one communication interface 53 (which can be wired or wireless), a communication connection is established between the system network element and at least one other network element. The Internet, wide area network, local area network, metropolitan area network, etc. can be used. The bus 52 can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, etc. The bus 52 can be divided into an address bus, a data bus, a control bus, etc. For the sake of representation, Figure 5 only a bidirectional arrow is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0090] The processor 51 may be an integrated circuit chip with the ability to process signals. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in the processor 51 or the instructions in the form of software. The above-mentioned processor 51 may be a general-purpose processor, including a central processing unit (CPU for short), a network processor (NP for short), etc.; it may also be a digital signal processor (DSP for short), an application specific integrated circuit (ASIC for short), a field-programmable gate array (FPGA for short), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present invention can be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of the hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory, and the processor 51 reads the information in the memory and combines its hardware to complete the foregoing method.

[0091] The computer program product of the method and device for detecting network address conflicts provided by the embodiments of the present invention includes a computer-readable storage medium storing program codes, and the instructions included in the program codes can be used to execute the method described in the foregoing method embodiments. For the specific implementation, reference can be made to the method embodiments and will not be elaborated here.

[0092] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working process of the above-described device can refer to the corresponding process in the foregoing method embodiments and will not be elaborated here.

[0093] In addition, in the description of the embodiments of the present invention, unless otherwise clearly defined and limited, the terms "installation", "connection", and "connection" shall be understood in a broad sense. For example, it may be a fixed connection, a detachable connection, or an integral connection; it may be a mechanical connection or an electrical connection; it may be a direct connection or an indirect connection through an intermediate medium, and it may be the communication inside two elements. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific situations.

[0094] When the above-mentioned functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or a part of this technical solution can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: various media that can store program codes such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs.

[0095] In the description of the present invention, it should be noted that the orientation or positional relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. is based on the orientation or positional relationship shown in the drawings. It is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation. Therefore, it should not be construed as a limitation to the present invention. In addition, the terms "first", "second", "third" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance.

[0096] Finally, it should be noted that the above embodiments are only specific embodiments of the present invention, used to illustrate the technical solutions of the present invention, rather than limiting them. The protection scope of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art within the technical scope disclosed by the present invention can still modify the technical solutions recorded in the foregoing embodiments or can easily think of changes, or perform equivalent replacements on some of the technical features; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention and should all be covered by the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.

Claims

1. A method for detecting network address conflicts, characterized in that, Applied to a server, the method includes: Responding to an access request sent by a network device to obtain an unallocated network address; wherein, the unallocated network address is an available network address; Querying whether the unallocated network address is occupied; If not, allocating the unallocated network address to the network device; If it is queried that the unallocated network address is occupied, obtaining the configuration status of the network device and the network device occupying the unallocated network address; wherein, the configuration status includes whether the network device is configured to allow modification of the network address, and a dynamic modification priority; wherein, the dynamic modification priority is used to characterize the willingness of the network device to allow modification of the network address, and the dynamic modification priority of a network device entering the sleep state is relatively low; Modifying the network address of the network device based on the configuration status; Among them, the step of modifying the network address of the network device based on the configuration status includes: If both the network device and the network device occupying the unallocated network address are configured to allow modification of the network address, obtaining the dynamic modification priority; Based on the dynamic modification priority, selecting the network device with a high willingness to modify the network address to modify the network address; If only one of the network device and the network device occupying the unallocated network address is configured to allow modification of the network address, modifying the network address of the network device that allows modification of the network address.

2. The method according to claim 1, wherein The unallocated network address is an IP address; The step of querying whether the unallocated network address is occupied includes: Performing an ARP query operation on the unallocated network address; Monitoring whether an ARP response message is received; If so, determining that the unallocated network address is occupied; If not, determining that the unallocated network address is not occupied.

3. The method according to claim 1, wherein The method further includes: Responding to the fact that the allocated network address meets the marking condition, marking the allocated network address; Recording the marking duration of the allocated network address, and if the marking duration reaches a preset duration threshold, determining the allocated network address as an unallocated network address; If the marking duration of the network address does not reach the preset duration threshold, and the response information of the network device corresponding to the allocated network address is monitored, reallocating the marked network address to the network device and restoring the recorded marking duration to the initial value.

4. The method according to claim 3, wherein The step of responding to the fact that the allocated network address meets the marking condition includes: Responding to receiving a sleep broadcast message, wherein the sleep broadcast message is sent when a network device enters the sleep state; determining that the network address of the network device sending the sleep broadcast message meets the marking condition; Or, Detecting the network connection status of the network device at a preset time interval, and if it is detected that the network device disconnects from the network, determining that the network address of the network device that disconnects from the network meets the marking condition.

5. The method according to claim 2, wherein The method further includes: Responding to an access event of a network device, extracting the IP address of the network device; Determine whether there is a corresponding registration record for the IP address; the registration record is used to record the IP address and the corresponding relationship between the IP address and the MAC address; If so, send MAC layer messages to the network device corresponding to the MAC address in the registration record and the network device corresponding to the network access event respectively; If response messages based on the MAC layer messages are received respectively, send an address conflict message to the network device corresponding to the network access event.

6. The method according to claim 5, wherein The method further includes: If there is no corresponding registration record for the IP address, or if no response message is received from the network device corresponding to the MAC address in the registration record, allow the network device corresponding to the network access event to access the network; Register the network device that has accessed the network to generate a registration record of the network device.

7. The method according to claim 6, wherein The method further includes: Monitor the MAC address of the network device that has accessed the network; If it is detected that multiple routing ports have the same MAC address within the same time period, determine that a MAC conflict event has occurred; Record the MAC address corresponding to the conflict event and send the MAC address corresponding to the conflict event to the network device.

8. An apparatus for detecting network address conflicts, characterized in that, Applied to a server, the device includes: A response module, configured to respond to a network access request sent by a network device and obtain an available network address to be allocated; wherein, the network address to be allocated is an available network address; A query module, configured to query whether the network address to be allocated is occupied; An allocation module, when the query result of the query module is negative, allocate the network address to be allocated to the network device; and, if it is queried that the network address to be allocated is occupied, obtain the configuration status of the network device and the network device that occupies the network address to be allocated; wherein, the configuration status includes whether the network device is configured to allow modification of the network address, and a dynamic modification priority; wherein, the dynamic modification priority is used to represent the willingness of the network device to allow modification of the network address, and the dynamic modification priority of a network device that has entered the sleep state is lower; modify the network address of the network device based on the configuration status; Wherein, the step of modifying the network address of the network device based on the configuration status includes: If both the network device and the network device that occupies the network address to be allocated are configured to allow modification of the network address, obtain the dynamic modification priority; Based on the dynamic modification priority, select the network device with a high willingness to modify the network address to modify the network address; If only one of the network device and the network device that occupies the network address to be allocated is configured to allow modification of the network address, modify the network address of the network device that allows modification of the network address.

Citation Information

Patent Citations

  • Host and IP address conflict prevention method thereof

    CN105245639A

  • Network protocol address acquisition method and device, and computer readable storage medium

    CN107257393A

  • Address conflict detection method and device based on DHCP (Dynamic Host Configuration Protocol) server and medium

    CN117376317A

  • Method and system for managing ip address assigned to mobile station

    CN1770779A