CN112003965A - Method for detecting IP conflict of equipment in local area network based on ARP protocol - Google Patents

Method for detecting IP conflict of equipment in local area network based on ARP protocol Download PDF

Info

Publication number
CN112003965A
CN112003965A CN202010968664.2A CN202010968664A CN112003965A CN 112003965 A CN112003965 A CN 112003965A CN 202010968664 A CN202010968664 A CN 202010968664A CN 112003965 A CN112003965 A CN 112003965A
Authority
CN
China
Prior art keywords
address
mac
area network
local area
equipment
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010968664.2A
Other languages
Chinese (zh)
Other versions
CN112003965B (en
Inventor
兰雨晴
叶慧兵
余丹
王丹星
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhongbiao Huian Information Technology Co Ltd
Original Assignee
Zhongbiao Huian Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhongbiao Huian Information Technology Co Ltd filed Critical Zhongbiao Huian Information Technology Co Ltd
Priority to CN202010968664.2A priority Critical patent/CN112003965B/en
Publication of CN112003965A publication Critical patent/CN112003965A/en
Application granted granted Critical
Publication of CN112003965B publication Critical patent/CN112003965B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/10Mapping addresses of different types
    • H04L61/103Mapping addresses of different types across network layers, e.g. resolution of network layer into physical layer addresses or address resolution protocol [ARP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5046Resolving address allocation conflicts; Testing of addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/618Details of network addresses
    • H04L2101/622Layer-2 addresses, e.g. medium access control [MAC] addresses

Landscapes

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

Abstract

The invention provides a method for detecting IP conflict of equipment in a local area network based on an ARP protocol, which comprises the following steps: step 1: the local device sends ARP request message to other host devices in the local area network; step 2: and detecting whether the IP address or the MAC address identical to the local equipment exists in the local area network or not according to the response condition of other host equipment in the local area network to the ARP request message so as to determine whether the network equipment with IP address conflict exists in the local area network or not. According to the method, whether the IP address or the MAC address identical to that of the local equipment exists in the local area network or not is detected according to the response condition of other host equipment in the local area network to the ARP request message so as to determine whether the network equipment with the IP address conflict exists in the local area network or not, the ARP protocol is utilized to detect the IP conflict in real time, the condition whether the equipment IP address or the MAC address conflict exists in the local area network or not can be obtained in time, the problem can be eliminated in time, and the working stability of the equipment network is improved.

Description

Method for detecting IP conflict of equipment in local area network based on ARP protocol
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method for detecting an IP collision of a device in a local area network based on an ARP (Address Resolution Protocol) Protocol.
Background
Multiple devices can work simultaneously in the same local area network, if IP (Internet Protocol) conflict occurs, the functions of the devices can be influenced, and the problems need to be solved in time.
At present, the network address Configuration mode of the devices in the local area network is usually DHCP (Dynamic Host Configuration Protocol) or manually specifies an IP address, and there may be situations where IP is duplicated, which causes IP collision and affects the networking function of the devices.
Disclosure of Invention
The invention provides a method for detecting equipment IP conflict in a local area network based on an ARP protocol, which is used for detecting the IP conflict in real time by utilizing the ARP protocol, acquiring the condition that the equipment IP or MAC address in the local area network has conflict in time and improving the working stability of the equipment network.
The invention provides a method for detecting IP conflict of equipment in a local area network based on an ARP protocol, which comprises the following steps:
step 1: the local device sends ARP request message to other host devices in the local area network;
step 2: and detecting whether the IP address or the MAC address identical to the local equipment exists in the local area network or not according to the response condition of other host equipment in the local area network to the ARP request message so as to determine whether the network equipment with IP address conflict exists in the local area network or not.
Further, in step 1, the ARP protocol request packet at least includes a source IP address field and/or a MAC address field, where the source IP address field is used to record a source IP address in the ARP request packet, and the MAC address field is used to record a source MAC address in the ARP request packet.
Further, the step 2: according to the response condition of other host devices in the local area network to the ARP protocol request message, detecting whether the local area network has the same IP address or MAC address as the local device so as to determine whether the network device with IP address conflict in the local area network executes the following steps:
step S21: sequentially detecting the IP addresses of other host devices in the local area network to obtain an IP-MAC relation table, wherein the IP addresses correspond to the MAC addresses one to one in the IP-MAC relation table;
step S22: searching the MAC corresponding to the IP address in the IP-MAC relation table according to the source IP address in the ARP message received by other host equipment;
step S23: and if other host equipment with the same IP address or MAC address as the local equipment exists in the local area network except the local equipment, judging that the IP address conflict occurs in the local area network.
Further, the step S22: according to the source IP address in the ARP message received by other host equipment, searching the MAC corresponding to the IP address in the IP-MAC relation table, and executing the following steps:
step S221: establishing a standby IP address base for recording unused IP addresses, wherein the standby IP address base and the IP in the IP-MAC relational table form a complete IP base, and when a certain IP in the standby IP address base is used, the used IP is moved into the IP-MAC relational table; correspondingly, when a certain IP in the IP-MAC relation table stops using, the IP which stops using is moved into the standby IP address base;
step S222: the IP is converted to a unique digital representation,
F(k)=109k1+106k2+103k3+100k1
wherein the representation form of the IP is k1: k2: k3: k4, k1, k2, k3 and k4 are integers from 0 to 255, and F (k) is a unique digital representation form converted from the IP;
step S223: according to the size relationship between the IP number in the IP-MAC relational table and the IP number in the standby IP address base, determining which one of the standby IP address base or the IP-MAC relational table is inquired when the source IP address in the ARP message received by other host equipment is inquired:
when the IP number L1 in the IP-MAC relation table is greater than the IP number L2 in the standby IP address base, when inquiring the source IP address in the ARP message received by other host equipment, inquiring the standby IP address base, and inquiring the standby IP address base in the following way:
Figure BDA0002683276410000031
wherein F (k) is a query result function, max (F (k1)) is the maximum value of F (k) in the standby IP address library, min (F (k1)) is the minimum value of F (k) in the standby IP address library, and when the value of F (k) corresponding to the searched IP is greater than max (F (k1)) or less than min (F (k1)) during searching in the standby IP address library, F (k) is 0, which indicates that the IP is not in the standby IP address library, that is, there are other host devices with the same IP address or MAC address as the local device in the local area network, and it is determined that an IP address conflict occurs in the local area network; if the value of F (k) corresponding to the IP is less than or equal to max (F (k1)) and greater than or equal to min (F (k1)), then only the lookup is needed
Figure BDA0002683276410000032
The value of the internal value is only needed,
when the IP number L1 in the IP-MAC relation table is less than or equal to the IP number L2 in the standby IP address base, when inquiring the source IP address in the ARP message received by other host equipment, inquiring the IP-MAC relation table, and inquiring the IP-MAC relation table in the following way:
Figure BDA0002683276410000033
wherein F (k) is a query result function, max (F (k2)) is the maximum value of F (k) in the IP-MAC, min (F (k2)) is the maximum value of F (k) in the IP-MAC, and if the value of F (k) corresponding to the searched IP is greater than max (F (k2)) or less than min (F (k2)), F (k) is 0, which indicates that the IP is not in the IP-MAC relationship table, that is, no other host device with the same IP address or MAC address as the local device exists in the local area network, and no IP address collision occurs; if the value of F (k) corresponding to the IP is less than or equal to max (F (k2)) and greater than or equal to min (F (k2)), then only the lookup is needed
Figure BDA0002683276410000041
And (4) inner value.
Further, after the step S23, the method further includes the steps of:
step S24: and if the same IP address or MAC address as the local equipment does not exist in the local area network, recording the information in the ARP request message in an IP-MAC relation table.
Further, the step S23: if there are other host devices with the same IP address or MAC address as the local device in the local area network except the local device, determining that an IP address conflict occurs in the local area network, including:
the local device sends ARP request messages to other host devices, and if the host devices receive ARP response information sent by other host devices, the IP address conflict in the local area network is judged.
Further, the step S24: if the same IP address or MAC address as the local equipment does not exist in the local area network, recording the information in the ARP request message in an IP-MAC relation table, wherein the information comprises the following steps:
step S241: the local equipment sends ARP request messages to other host equipment, and if the local equipment does not receive ARP response information sent by other host equipment, the local equipment judges that no IP address conflict occurs in the local area network;
step S242: and updating the IP address and the MAC address in the IP-MAC relation table by using the IP address and the MAC address of the ARP request message sent by the local equipment.
Further, after the step 2, the method further comprises the steps of:
and step 3: and alarming the conflicted IP address to prompt the user that the IP address confliction exists.
Further, after the step 3, the method further comprises the steps of:
and 4, step 4: the IP address of the conflicting device is changed.
The method for detecting the IP conflict of the equipment in the local area network based on the ARP protocol has the following beneficial effects that: according to the response condition of other host devices in the local area network to the ARP request message, whether the IP address or the MAC address identical to that of the local device exists in the local area network is detected, so that whether the network device with the IP address conflict exists in the local area network is determined, the ARP protocol is used for detecting the IP conflict in real time, the condition whether the IP address or the MAC address of the device in the local area network conflicts can be obtained in time, the problem can be eliminated in time, and the working stability of the device network is improved.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
The technical solution of the present invention is further described in detail by the accompanying drawings and embodiments.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the principles of the invention and not to limit the invention. In the drawings:
fig. 1 is a schematic flowchart of a method for detecting an IP collision of a device in a local area network based on an ARP protocol in an embodiment of the present invention.
Detailed Description
The preferred embodiments of the present invention will be described in conjunction with the accompanying drawings, and it will be understood that they are described herein for the purpose of illustration and explanation and not limitation.
The embodiment of the invention provides a method for detecting IP conflict of equipment in a local area network based on an ARP protocol, which comprises the following steps of:
step 1: the local device sends ARP request message to other host devices in the local area network;
step 2: and detecting whether the IP address or the MAC address identical to the local equipment exists in the local area network or not according to the response condition of other host equipment in the local area network to the ARP request message so as to determine whether the network equipment with IP address conflict exists in the local area network or not.
The working principle of the technical scheme is as follows: the ARP (Address Resolution Protocol) Protocol is a TCP/IP Protocol that acquires a physical Address from an IP Address. There are a wide variety of network devices in networks today, and the TCP/IP suite of transmission control protocols/internet protocols allows them to communicate with each other, although they run different operating systems. The TCP/IP protocol suite, which is a combination of multiple protocols at different levels, each layer responsible for different functions, where the data link layer typically includes device drivers in the operating system and corresponding network interface cards in the computer, which together handle the physical interface details with the cable or any other transmission medium. The data link layer has a physical address, i.e., a Media Access Control (MAC) address, which is globally unique. When there is data to be transmitted, the source network device inquires the MAC address of the peer device and then transmits the data. The network layer handles the activity of packets in the network. Since MAC addresses usually exist in a flat address space, there is no clear address hierarchy, and MAC addresses are fixed in hardware and have poor flexibility, for inter-connection communication between different networks, we usually use network layer addresses based on software implementation, i.e. IP addresses for communication. If two different hosts or devices use the same IP address in an internet network, the two hosts or devices will collide with each other, and once the IP address collision occurs in the network, the service running on the network will be seriously affected. Therefore, how to detect the IP address conflict is very important.
In the invention, the local device sends an ARP request message to other host devices in the local area network, then detects whether the IP address or the MAC address identical to the local device exists in the local area network according to the response condition of the other host devices in the local area network to the ARP request message, thereby determining whether the network device with IP address conflict exists in the local area network, and the ARP protocol is used for detecting the IP conflict in real time, thereby being capable of timely acquiring whether the IP address or the MAC address of the device in the local area network conflicts, being convenient for eliminating the problem in time and improving the working stability of the device network.
Specifically, in step 1, the ARP protocol request message at least includes a source IP address field and/or a MAC address field, in one embodiment, the ARP protocol request message includes the source IP address field, in another embodiment, the ARP protocol request message includes the MAC address field, and in yet another embodiment, the ARP protocol request message includes both the source IP address field and the MAC address field. The source IP address field is used to record a source IP address in the ARP request message, the IP address field is 192.168.0.2, the MAC address field is used to record a source MAC address in the ARP request message, and the MAC address field is BB-BB.
The beneficial effects of the above technical scheme are: according to the response condition of other host devices in the local area network to the ARP request message, whether the IP address or the MAC address identical to that of the local device exists in the local area network is detected, so that whether the network device with the IP address conflict exists in the local area network is determined, the ARP protocol is used for detecting the IP conflict in real time, the condition whether the IP address or the MAC address of the device in the local area network conflicts can be obtained in time, the problem can be eliminated in time, and the working stability of the device network is improved.
In one embodiment, the step 2: according to the response condition of other host devices in the local area network to the ARP protocol request message, detecting whether the local area network has the same IP address or MAC address as the local device so as to determine whether the network device with IP address conflict in the local area network executes the following steps:
step S21: sequentially detecting the IP addresses of other host devices in the local area network to obtain an IP-MAC relation table, wherein the IP addresses correspond to the MAC addresses one to one in the IP-MAC relation table;
step S22: searching the MAC corresponding to the IP address in the IP-MAC relation table according to the source IP address in the ARP message received by other host equipment;
step S23: and if other host equipment with the same IP address or MAC address as the local equipment exists in the local area network except the local equipment, judging that the IP address conflict occurs in the local area network.
The working principle of the technical scheme is as follows: since the same IP in the lan may correspond to different MAC addresses, i.e. different devices share the same IP address. At this time, the conflict of the IP address often causes an internet access obstacle, the IP address and the MAC address are in one-to-one correspondence in the IP-MAC relationship table, the MAC corresponding to the IP address is searched in the IP-MAC relationship table in which the IP address and the MAC address are in one-to-one correspondence, the source IP and the MAC therein are taken out and searched in the relationship table, the searched keyword may be the source IP or the corresponding domain name, and under the condition that the MAC corresponding to the IP address is found, step S23 is executed, whether the IP address conflict occurs in the local area network is determined according to whether other host devices having the same IP address or the same MAC address as the local device exist in the local area network except the local device, so that when the IP of the IP conflict device is subsequently changed, the conflict IP is definitely changed in a targeted manner, and the conflict between the changed IP and the IP of other devices in the local area network is avoided.
The beneficial effects of the above technical scheme are: the specific steps of determining whether the network equipment with IP address conflict exists in the local area network according to the response condition of other host equipment in the local area network to the ARP protocol request message are provided.
In one embodiment, the step S22: according to the source IP address in the ARP message received by other host equipment, searching the MAC corresponding to the IP address in the IP-MAC relation table, and executing the following steps:
step S221: establishing a standby IP address base for recording unused IP addresses, wherein the standby IP address base and the IP in the IP-MAC relational table form a complete IP base, and when a certain IP in the standby IP address base is used, the used IP is moved into the IP-MAC relational table; correspondingly, when a certain IP in the IP-MAC relation table stops using, the IP which stops using is moved into the standby IP address base;
step S222: the IP is converted to a unique digital representation,
F(k)=109k1+106k2+103k3+100k1
wherein the representation form of the IP is k1: k2: k3: k4, k1, k2, k3 and k4 are integers from 0 to 255, and F (k) is a unique digital representation form converted from the IP;
step S223: according to the size relationship between the IP number in the IP-MAC relational table and the IP number in the standby IP address base, determining which one of the standby IP address base or the IP-MAC relational table is inquired when the source IP address in the ARP message received by other host equipment is inquired:
when the IP number L1 in the IP-MAC relation table is greater than the IP number L2 in the standby IP address base, when inquiring the source IP address in the ARP message received by other host equipment, inquiring the standby IP address base, and inquiring the standby IP address base in the following way:
Figure BDA0002683276410000081
wherein F (k) is a query result function, max (F (k1)) is the maximum value of F (k) in the standby IP address library, min (F (k1)) is the minimum value of F (k) in the standby IP address library, and when the value of F (k) corresponding to the searched IP is greater than max (F (k1)) or less than min (F (k1)) during searching in the standby IP address library, F (k) is 0, which indicates that the IP is not in the standby IP address library, that is, there are other host devices with the same IP address or MAC address as the local device in the local area network, and it is determined that an IP address conflict occurs in the local area network; if the value of F (k) corresponding to the IP is less than or equal to max (F (k1)) and greater than or equal to min (F (k1)), then only the lookup is needed
Figure BDA0002683276410000091
The value of the internal value is only needed,
when the IP number L1 in the IP-MAC relation table is less than or equal to the IP number L2 in the standby IP address base, when inquiring the source IP address in the ARP message received by other host equipment, inquiring the IP-MAC relation table, and inquiring the IP-MAC relation table in the following way:
Figure BDA0002683276410000092
wherein F (k) is a query result function, max (F (k2)) is the maximum value of F (k) in the IP-MAC, min (F (k2)) is the maximum value of F (k) in the IP-MAC, and if the value of F (k) corresponding to the searched IP is greater than max (F (k2)) or less than min (F (k2)), F (k) is 0, which indicates that the IP is not in the IP-MAC relationship table, that is, no other host device with the same IP address or MAC address as the local device exists in the local area network, and no IP address collision occurs; if the value of F (k) corresponding to the IP is less than or equal to max (F (k2)) and greater than or equal to min (F (k2)), then only the lookup is needed
Figure BDA0002683276410000093
The value of inner is.
The working principle of the technical scheme is as follows: considering that the number of IP addresses is billion, a standby IP address base is established, unused IP addresses are recorded, and the standby IP address base and the IP of the IP-MAC relation table form a complete IP base. Moreover, for any IP needing to be searched, the IP has a unique natural number FkCorresponding thereto.
The beneficial effects of the above technical scheme are: compared with full-table scanning, the searching method greatly shortens the query time, shortens the comprehensive query time by at least 10 times, and is quicker to query under the condition of special values, so that the system can realize millisecond-level response.
In one embodiment, after the step S23, the method further includes the steps of:
step S24: and if the same IP address or MAC address as the local equipment does not exist in the local area network, recording the information in the ARP request message in an IP-MAC relation table.
The working principle of the technical scheme is as follows: the purpose of step S24 is to record the information in the ARP request message for which no conflict occurs in the IP-MAC relationship table as a new ARP entry. Here, the information in the ARP request message includes a source IP address field and/or a MAC address field. If the IP-MAC relation table records that the address of a certain host device is the same as the source IP address of the host device, the IP address conflict is judged to occur, and whether the IP address conflict occurs is further judged by utilizing the updated IP-MAC relation table.
The beneficial effects of the above technical scheme are: by recording the information in the ARP request message in the IP-MAC relationship table, it is convenient to determine whether an IP address conflict occurs using the updated IP-MAC relationship table.
In one embodiment, the step S23: if there are other host devices with the same IP address or MAC address as the local device in the local area network except the local device, determining that an IP address conflict occurs in the local area network, including:
the local device sends ARP request messages to other host devices, and if the host devices receive ARP response information sent by other host devices, the IP address conflict in the local area network is judged.
The working principle of the technical scheme is as follows: if the host equipment receives ARP response information sent by other host equipment, the IP address conflict is considered to occur in the local area network; on the contrary, if the host device does not receive the ARP response information sent by other host devices, it is determined that no IP address conflict occurs in the local area network, or the previously-occurring IP address conflict has disappeared.
The beneficial effects of the above technical scheme are: there is provided a specific step of determining whether an IP address conflict occurs in the local area network based on whether there is another host device having the same IP address or MAC address as the local device in the local area network, in addition to the local device.
In one embodiment, the step S24: if the same IP address or MAC address as the local equipment does not exist in the local area network, recording the information in the ARP request message in an IP-MAC relation table, wherein the information comprises the following steps:
step S241: the local equipment sends ARP request messages to other host equipment, and if the local equipment does not receive ARP response information sent by other host equipment, the local equipment judges that no IP address conflict occurs in the local area network;
step S242: and updating the IP address and the MAC address in the IP-MAC relation table by using the IP address and the MAC address of the ARP request message sent by the local equipment.
The working principle of the technical scheme is as follows: and updating the IP address and the MAC address in the IP-MAC relation table by using the IP address and the MAC address in the ARP request message sent by the local equipment without the IP address conflict, and then judging whether the IP address conflict occurs or not by using the updated IP-MAC relation table in the subsequent IP address conflict judgment.
The beneficial effects of the above technical scheme are: there is provided a specific step of recording information in the ARP request message in an IP-MAC relationship table.
In one embodiment, after the step 2, the method further comprises the steps of:
and step 3: and alarming the conflicted IP address to prompt the user that the IP address confliction exists.
The working principle of the technical scheme is as follows: by alarming the conflicted IP address, the IP address conflicted between the local device and the host device can be known, and then the alarm can be given to the user or the administrator to prompt the user or the administrator that the local device conflicts with the IP address of the host device (such as a third host device), and the user or the administrator takes corresponding treatment measures.
The beneficial effects of the above technical scheme are: by alarming the conflicted IP address, the user can be prompted to have IP address conflict, and processing measures can be taken conveniently.
In one embodiment, after the step 3, the method further comprises the steps of:
and 4, step 4: the IP address of the conflicting device is changed.
The working principle of the technical scheme is as follows: changing the IP address of the conflicting device may be accomplished by reconfiguring the IP address, etc.
The beneficial effects of the above technical scheme are: by changing the IP address of the conflict device, the problems of service terminal failure and the like caused by IP address conflict can be avoided, and the stability of the network is improved.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (9)

1. A method for detecting IP conflict of equipment in a local area network based on an ARP protocol is characterized by comprising the following steps:
step 1: the local device sends ARP request message to other host devices in the local area network;
step 2: and detecting whether the IP address or the MAC address identical to the local equipment exists in the local area network or not according to the response condition of other host equipment in the local area network to the ARP request message so as to determine whether the network equipment with IP address conflict exists in the local area network or not.
2. The method according to claim 1, wherein in step 1, the ARP protocol request message includes at least a source IP address field and/or a MAC address field, the source IP address field is used to record a source IP address in the ARP request message, and the MAC address field is used to record a source MAC address in the ARP request message.
3. The method of claim 1, wherein step 2: according to the response condition of other host devices in the local area network to the ARP protocol request message, detecting whether the local area network has the same IP address or MAC address as the local device so as to determine whether the network device with IP address conflict in the local area network executes the following steps:
step S21: sequentially detecting the IP addresses of other host devices in the local area network to obtain an IP-MAC relation table, wherein the IP addresses correspond to the MAC addresses one to one in the IP-MAC relation table;
step S22: searching the MAC corresponding to the IP address in the IP-MAC relation table according to the source IP address in the ARP message received by other host equipment;
step S23: and if other host equipment with the same IP address or MAC address as the local equipment exists in the local area network except the local equipment, judging that the IP address conflict occurs in the local area network.
4. The method of claim 3, wherein the step S22: according to the source IP address in the ARP message received by other host equipment, searching the MAC corresponding to the IP address in the IP-MAC relation table, and executing the following steps:
step S221: establishing a standby IP address base for recording unused IP addresses, wherein the standby IP address base and the IP in the IP-MAC relational table form a complete IP base, and when a certain IP in the standby IP address base is used, the used IP is moved into the IP-MAC relational table; correspondingly, when a certain IP in the IP-MAC relation table stops using, the IP which stops using is moved into the standby IP address base;
step S222: the IP is converted to a unique digital representation,
F(k)=109k1+106k2+103k3+100k1
wherein, the expression form of the IP is k1: k2: k3: k4, k1, k2, k3, k4 are integers from 0 to 255, and f (k) is the unique numerical representation to which IP is converted;
step S223: according to the size relationship between the IP number in the IP-MAC relational table and the IP number in the standby IP address base, determining which one of the standby IP address base or the IP-MAC relational table is inquired when the source IP address in the ARP message received by other host equipment is inquired:
when the IP number L1 in the IP-MAC relation table is greater than the IP number L2 in the standby IP address base, when inquiring the source IP address in the ARP message received by other host equipment, inquiring the standby IP address base, and inquiring the standby IP address base in the following way:
Figure FDA0002683276400000021
wherein F (k) is a query result function, max (F (k1)) is the maximum value of F (k) in the standby IP address library, min (F (k1)) is the minimum value of F (k) in the standby IP address library, and when the value of F (k) corresponding to the searched IP is greater than max (F (k1)) or less than min (F (k1)) during searching in the standby IP address library, F (k) is 0, which indicates that the IP is not in the standby IP address library, that is, there are other host devices with the same IP address or MAC address as the local device in the local area network, and it is determined that an IP address conflict occurs in the local area network; if the value of F (k) corresponding to the IP is less than or equal to max (F (k1)) and greater than or equal to min (F (k1)), then only the lookup is needed
Figure FDA0002683276400000022
Inner value is only required;
when the IP number L1 in the IP-MAC relation table is less than or equal to the IP number L2 in the standby IP address base, when inquiring the source IP address in the ARP message received by other host equipment, inquiring the IP-MAC relation table, and inquiring the IP-MAC relation table in the following way:
Figure FDA0002683276400000031
wherein F (k) is a query result function, max (F (k2)) is the maximum value of F (k) in the IP-MAC, min (F (k2)) is the maximum value of F (k) in the IP-MAC, and if the value of F (k) corresponding to the searched IP is greater than max (F (k2)) or less than min (F (k2)), F (k) is 0, which indicates that the IP is not in the IP-MAC relationship table, that is, no other host device with the same IP address or MAC address as the local device exists in the local area network, and no IP address collision occurs; if the value of F (k) corresponding to the IP is less than or equal to max (F (k2)) and greater than or equal to min (F (k2)), then only the lookup is needed
Figure FDA0002683276400000032
And (4) inner value.
5. The method of claim 3, wherein after the step S23, the method further comprises the steps of:
step S24: and if the same IP address or MAC address as the local equipment does not exist in the local area network, recording the information in the ARP request message in an IP-MAC relation table.
6. The method of claim 3, wherein the step S23: if there are other host devices with the same IP address or MAC address as the local device in the local area network except the local device, determining that an IP address conflict occurs in the local area network, including:
the local device sends ARP request messages to other host devices, and if the host devices receive ARP response information sent by other host devices, the IP address conflict in the local area network is judged.
7. The method of claim 5, wherein the step S24: if the same IP address or MAC address as the local equipment does not exist in the local area network, recording the information in the ARP request message in an IP-MAC relation table, wherein the information comprises the following steps:
step S241: the local equipment sends ARP request messages to other host equipment, and if the local equipment does not receive ARP response information sent by other host equipment, the local equipment judges that no IP address conflict occurs in the local area network;
step S242: and updating the IP address and the MAC address in the IP-MAC relation table by using the IP address and the MAC address of the ARP request message sent by the local equipment.
8. The method of claim 1, wherein after the step 2, the method further comprises the steps of:
and step 3: and alarming the conflicted IP address to prompt the user that the IP address confliction exists.
9. The method of claim 8, wherein after said step 3, said method further comprises the steps of:
and 4, step 4: the IP address of the conflicting device is changed.
CN202010968664.2A 2020-09-15 2020-09-15 Method for detecting IP conflict of equipment in local area network based on ARP protocol Active CN112003965B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010968664.2A CN112003965B (en) 2020-09-15 2020-09-15 Method for detecting IP conflict of equipment in local area network based on ARP protocol

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010968664.2A CN112003965B (en) 2020-09-15 2020-09-15 Method for detecting IP conflict of equipment in local area network based on ARP protocol

Publications (2)

Publication Number Publication Date
CN112003965A true CN112003965A (en) 2020-11-27
CN112003965B CN112003965B (en) 2021-07-27

Family

ID=73469300

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010968664.2A Active CN112003965B (en) 2020-09-15 2020-09-15 Method for detecting IP conflict of equipment in local area network based on ARP protocol

Country Status (1)

Country Link
CN (1) CN112003965B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112333300A (en) * 2021-01-07 2021-02-05 广东睿江云计算股份有限公司 Method and system for preventing IP conflict based on distribution
CN114500467A (en) * 2021-12-23 2022-05-13 云洲(盐城)创新科技有限公司 Address conflict detection method, address conflict detection device and electronic equipment
CN114727278A (en) * 2022-04-19 2022-07-08 广州爱浦路网络技术有限公司 Address changing method and device for single NRF network element
CN115150363A (en) * 2022-06-27 2022-10-04 中兴通讯股份有限公司 IP address updating method, gateway device, gateway drop device and storage medium
CN116827900A (en) * 2023-08-31 2023-09-29 青岛民航凯亚系统集成有限公司 Method and system for realizing intranet terminal traceability based on Python

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101175000A (en) * 2007-11-22 2008-05-07 华为技术有限公司 Method and device for automatic IP address detection
CN101656763A (en) * 2009-09-11 2010-02-24 华为技术有限公司 IP address automatic distribution method, client and server
CN102170484A (en) * 2011-04-08 2011-08-31 华为数字技术有限公司 A detection method a detection device of IP address conflict
US20130286854A1 (en) * 2010-12-30 2013-10-31 Huawei Technologies Co., Ltd. Method and network device for detecting ip address conflict
CN106790745A (en) * 2016-12-02 2017-05-31 互联网域名系统北京市工程研究中心有限公司 A kind of method and system based on IP conflicts and Real-time Alarm in ARP protocol real-time monitoring subnet
CN108810183A (en) * 2018-05-04 2018-11-13 新华三技术有限公司 Processing method, device and the machine readable storage medium of conflict MAC Address
CN110752998A (en) * 2019-09-10 2020-02-04 广州西麦科技股份有限公司 ARP message processing method and related device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101175000A (en) * 2007-11-22 2008-05-07 华为技术有限公司 Method and device for automatic IP address detection
CN101656763A (en) * 2009-09-11 2010-02-24 华为技术有限公司 IP address automatic distribution method, client and server
US20130286854A1 (en) * 2010-12-30 2013-10-31 Huawei Technologies Co., Ltd. Method and network device for detecting ip address conflict
CN102170484A (en) * 2011-04-08 2011-08-31 华为数字技术有限公司 A detection method a detection device of IP address conflict
CN106790745A (en) * 2016-12-02 2017-05-31 互联网域名系统北京市工程研究中心有限公司 A kind of method and system based on IP conflicts and Real-time Alarm in ARP protocol real-time monitoring subnet
CN108810183A (en) * 2018-05-04 2018-11-13 新华三技术有限公司 Processing method, device and the machine readable storage medium of conflict MAC Address
CN110752998A (en) * 2019-09-10 2020-02-04 广州西麦科技股份有限公司 ARP message processing method and related device

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112333300A (en) * 2021-01-07 2021-02-05 广东睿江云计算股份有限公司 Method and system for preventing IP conflict based on distribution
CN114500467A (en) * 2021-12-23 2022-05-13 云洲(盐城)创新科技有限公司 Address conflict detection method, address conflict detection device and electronic equipment
CN114727278A (en) * 2022-04-19 2022-07-08 广州爱浦路网络技术有限公司 Address changing method and device for single NRF network element
CN114727278B (en) * 2022-04-19 2023-07-28 广州爱浦路网络技术有限公司 Address changing method and device for single NRF network element
CN115150363A (en) * 2022-06-27 2022-10-04 中兴通讯股份有限公司 IP address updating method, gateway device, gateway drop device and storage medium
CN115150363B (en) * 2022-06-27 2024-05-10 中兴通讯股份有限公司 IP address updating method, gateway device, gateway down-hanging device and storage medium
CN116827900A (en) * 2023-08-31 2023-09-29 青岛民航凯亚系统集成有限公司 Method and system for realizing intranet terminal traceability based on Python
CN116827900B (en) * 2023-08-31 2023-12-05 青岛民航凯亚系统集成有限公司 Method and system for realizing intranet terminal traceability based on Python

Also Published As

Publication number Publication date
CN112003965B (en) 2021-07-27

Similar Documents

Publication Publication Date Title
CN112003965B (en) Method for detecting IP conflict of equipment in local area network based on ARP protocol
US5922049A (en) Method for using DHCP and marking to override learned IP addesseses in a network
US7339895B2 (en) Gateway device and control method for communication with IP and IPV6 protocols
US5668952A (en) Method for resolving network address by sending reresolve request to nodes at selected time period after establishing address table, and updating the table with received reply thereto
US5915119A (en) Proxy terminal for network controlling of power managed user terminals in suspend mode
US5835720A (en) IP discovery apparatus and method
US7516211B1 (en) Methods and apparatus to configure a communication port
JP3534305B2 (en) IP address duplication detection method using address resolution protocol
CN102281333B (en) Method and system for avoiding IP address conflict, DHCP server and DHCP client
JP5390798B2 (en) Method and apparatus for early warning of network equipment
CA2499296A1 (en) Method and apparatus for preventing spoofing of network addresses
US20070022211A1 (en) Packet transfer system, communication network, and packet transfer method
CN101883090A (en) Client access method, equipment and system
EP1119931A1 (en) System and method for providing a proxy farp for legacy storage devices
US20090034539A1 (en) Address assignment apparatus, address assignment method, and computer product
EP2654336A1 (en) Method, apparatus and system for access point (ap) to manage wireless repeater(s)
US7792949B2 (en) Method and system for video network discovery
CN111683162B (en) IP address management method based on flow identification
US20190245785A1 (en) Output device discovery using network switches
CN116170409B (en) SD-WAN network address planning system based on virtual domain name
CN101909007B (en) Production method, device and network equipment of binding table
JP3082686B2 (en) MAC bridge control method and device
US8170415B2 (en) Physical wiring control device, physical wiring control method, and computer product
KR20210119162A (en) Vehicle and controlling method of vehicle
CN115643268A (en) Method, device and system for realizing local area network master-slave computer communication protocol

Legal Events

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