CN114513492A - Method and device for configuring IP address - Google Patents

Method and device for configuring IP address Download PDF

Info

Publication number
CN114513492A
CN114513492A CN202210404053.4A CN202210404053A CN114513492A CN 114513492 A CN114513492 A CN 114513492A CN 202210404053 A CN202210404053 A CN 202210404053A CN 114513492 A CN114513492 A CN 114513492A
Authority
CN
China
Prior art keywords
address
network
message
range
determining
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.)
Pending
Application number
CN202210404053.4A
Other languages
Chinese (zh)
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.)
Zhejiang Guoli Network Security Technology Co ltd
Original Assignee
Zhejiang Guoli Network Security 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 Zhejiang Guoli Network Security Technology Co ltd filed Critical Zhejiang Guoli Network Security Technology Co ltd
Priority to CN202210404053.4A priority Critical patent/CN114513492A/en
Publication of CN114513492A publication Critical patent/CN114513492A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Small-Scale Networks (AREA)

Abstract

The present specification discloses a method and a device for configuring an IP address, which first obtain a message broadcasted by each other device in a network to which a device to be configured belongs, and analyze the message, and determine an IP address used by each other device in the network. And determining the IP address range which can be used by the equipment to be configured in the network according to the obtained IP addresses used by the other equipment in the network. And determining a target IP address according to the IP address range, and configuring the target IP address as an IP address used by the device to be configured in the network.

Description

Method and device for configuring IP address
Technical Field
The present disclosure relates to the field of network technologies, and in particular, to a method and an apparatus for configuring an IP address.
Background
Currently, a Configuration mode for Internet Protocol (IP) mainly uses a Dynamic Host Configuration Protocol (DHCP) to implement automatic Configuration of IP. The use of DHCP technology to implement IP configuration requires the use of a DHCP server (typically using a router to act as a DHCP server), and in industrial control networks there are sometimes situations where there is no DHCP server.
The method mainly aims at manually configuring the IP under the condition that the DHCP server does not exist in the industrial control network, so that the configuration efficiency is low, and the problem of IP conflict can be met. For example, during manual configuration, the device a is just powered off, so that during detection of an IP collision, the IP address used by the device a cannot be detected, which may cause that the IP address configured for a new device is the same as the IP address used by the device a, and thus after the device a is powered on, an IP collision occurs, resulting in service interruption.
Therefore, how to improve the efficiency of IP configuration and avoid IP collision without a DHCP server is an urgent problem to be solved.
Disclosure of Invention
The present specification provides a method and an apparatus for configuring an IP address, so as to partially solve the above problems in the prior art.
The technical scheme adopted by the specification is as follows:
the present specification provides a method of configuring an IP address, comprising:
acquiring message information broadcast by other equipment in a network to which the equipment to be configured belongs;
analyzing the message and determining the IP addresses used by the other devices in the network;
determining an IP address range which can be used by the equipment to be configured in the network according to the IP addresses used by the other equipment in the network;
and determining a target IP address according to the IP address range, and taking the target IP address as the IP address of the device to be configured in the network.
Optionally, analyzing the message to determine the IP addresses used by the other devices in the network includes:
determining the protocol type based on each acquired message;
determining a byte segment recorded with an IP address from the message according to the protocol type;
an IP address is parsed from the field.
Optionally, determining, according to the IP address used by each other device in the network, an IP address range that can be used by the device to be configured in the network includes:
and for each acquired message, if the IP address analyzed from the message is determined not to fall into the IP address range determined before the message is acquired, updating the IP address range determined before the message is acquired according to the IP address analyzed from the message, and taking the updated IP address range as the IP address range which can be used by the equipment to be configured and is determined after the message is acquired in the network.
Optionally, determining a target IP address according to the IP address range, and using the target IP address as an IP address used by the device to be configured in the network, specifically including:
determining an unoccupied IP address in the IP address range as a pre-configured IP address according to the IP addresses used by the other devices in the network;
broadcasting a message carrying the pre-configured IP address to equipment belonging to the network so as to detect whether the pre-configured IP address is occupied;
if the pre-configured IP address is detected to be unoccupied, the pre-configured IP address is used as the target IP address, otherwise, the pre-configured IP address is re-determined based on the determined IP address range.
Optionally, the method further comprises:
and if the IP addresses in the IP address range are all occupied according to the IP addresses used by the other devices in the network, determining the IP addresses which do not fall into the IP address range but are positioned in the subnet range to which the IP address range belongs as the pre-configured IP addresses.
Optionally, the method further comprises:
and updating the IP address range according to the determined IP address which does not fall into the IP address range but is positioned in the subnet range to which the IP address range belongs.
Optionally, determining a target IP address according to the IP address range, and using the target IP address as an IP address used by the device to be configured in the network, specifically including:
determining unoccupied IP addresses in the IP address range as pre-configured IP addresses according to the IP addresses used by the other devices in the network through a preset IP decision module;
broadcasting a message carrying the pre-configured IP address to equipment belonging to the network, detecting whether the pre-configured IP address is occupied through a preset conflict detection module, if the pre-configured IP address is detected to be unoccupied, taking the pre-configured IP address as the target IP address, and otherwise, re-determining the pre-configured IP address based on the determined IP address range.
Optionally, the method further comprises:
and after the IP address is configured for the device to be configured, if other devices using the target IP address exist in the network, the IP address is re-allocated for the device to be configured.
The present specification provides an apparatus for configuring an IP address, comprising:
the acquisition module is used for acquiring message messages broadcast by other equipment in a network to which the equipment to be configured belongs;
the analysis module is used for analyzing the message and determining the IP addresses used by the other devices in the network;
a determining module, configured to determine, according to the IP addresses used by the other devices in the network, an IP address range that can be used by the device to be configured in the network;
and the configuration module is used for determining a target IP address according to the IP address range and taking the target IP address as the IP address of the equipment to be configured in the network.
The present specification provides a computer-readable storage medium storing a computer program which, when executed by a processor, implements the above-described method of configuring an IP address.
The present specification provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the above method of configuring an IP address when executing the program.
The technical scheme adopted by the specification can achieve the following beneficial effects:
in the method for configuring an IP address provided in this specification, a message broadcasted by each other device in a network to which a device to be configured belongs is first acquired, and the message is analyzed to determine an IP address used by each other device in the network. And determining the IP address range which can be used by the equipment to be configured in the network according to the obtained IP addresses used by the other equipment in the network. And determining a target IP address according to the IP address range, and configuring the target IP address as an IP address used by the device to be configured in the network.
The method for configuring the IP address can obtain the range of the IP address of other equipment in the network by receiving the message broadcast by other equipment in the network, thereby determining the range of the IP address which can be used in the network, further determining the target IP address which can be used by the equipment to be configured based on the IP address, and realizing the automatic configuration of the IP address of the equipment to be configured under the condition that a DHCP server is not available.
Drawings
The accompanying drawings, which are included to provide a further understanding of the specification and are incorporated in and constitute a part of this specification, illustrate embodiments of the specification and together with the description serve to explain the specification and not to limit the specification in a non-limiting sense. In the drawings:
fig. 1 is a schematic flow chart of a method for configuring an IP address provided in the present specification;
fig. 2 is a schematic diagram of an apparatus for performing configuration of an IP address provided in the present specification;
fig. 3 is a schematic diagram illustrating a flow of a method for configuring an IP address provided by the present description;
fig. 4 is a schematic diagram of an apparatus for configuring an IP address provided in the present specification;
fig. 5 is a schematic diagram of an electronic device corresponding to fig. 1 provided in the present specification.
Detailed Description
In order to make the objects, technical solutions and advantages of the present disclosure more clear, the technical solutions of the present disclosure will be clearly and completely described below with reference to the specific embodiments of the present disclosure and the accompanying drawings. It is to be understood that the embodiments described are only a few embodiments of the present disclosure, and not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present specification without any creative effort belong to the protection scope of the present specification.
The technical solutions provided by the embodiments of the present description are described in detail below with reference to the accompanying drawings.
Fig. 1 is a schematic flowchart of a method for configuring an IP address provided in this specification, including the following steps:
s101: and acquiring message information broadcast by other equipment in a network to which the equipment to be configured belongs.
In this specification, the execution subject of the method for configuring an IP address may be a device to be configured, such as a desktop computer, a notebook computer, and the like, that needs to configure the IP address. For convenience of description, the method for configuring an IP address provided in this specification is described below by taking only an example of a device to be configured.
Currently, a Configuration mode for Internet Protocol (IP) mainly uses a Dynamic Host Configuration Protocol (DHCP) to implement automatic Configuration of IP. While the use of DHCP technology to implement IP configuration requires the use of a DHCP server (typically a router acting as a DHCP server), in an industrial control network there are sometimes situations where there is no DHCP server.
Aiming at the situation that a DHCP server does not exist in an industrial control network, the IP is configured mainly by manual configuration, so that the configuration efficiency is low, and the problem of IP conflict can be met.
In order to solve the above-mentioned problem of how to improve the efficiency of IP configuration and solve IP conflicts in the case of a DHCP server, the present specification provides a method of configuring an IP address.
Firstly, after determining that a network card corresponding to a device to be configured can receive message messages broadcasted by other devices in a network, the device to be configured can obtain the message messages broadcasted by each other device in the network to which the device to be configured belongs from the corresponding network card. The network to which the device to be configured belongs may be a network connected through a network switch, or may be a network connected by a router.
In practical application, after it is determined that the time for the device to be configured to acquire the message information broadcast by other devices reaches a certain time, the next process of analyzing the message is performed. For example, after it is determined that the time for the device to be configured to acquire the message broadcast by the other device reaches ten minutes, the message acquired within the ten minutes may be analyzed. The specific time length may be determined according to actual requirements, and is not specifically limited herein.
S102: and analyzing the message and determining the IP addresses used by the other devices in the network.
After the device to be configured receives the message messages broadcast by other devices, the device to be configured analyzes the obtained message messages, and determines the protocol type based on each obtained message. The Protocol type based on which the message is based may be an Address Resolution Protocol (ARP), a Link-Local Multicast Name Resolution (LLMNR), a Simple Service Discovery Protocol (SSDP), and other protocols.
After determining the protocol type based on the message, the device to be configured may determine, according to the protocol type based on which the message is acquired, a byte segment in which an IP address is recorded from the message, so as to resolve the IP address of the device that sends the message from the determined byte segment.
For example, if the protocol type based on the message is ARP, the IP address of the device that sends the message may be obtained from the 29 th to 32 th bytes of the message. For another example, if the protocol type based on the message is LLMNR, the IP address of the device sending the message may be obtained from 27 th to 30 th bytes of the message. For another example, if the protocol type based on the message is SSDP, the IP address of the device sending the message may be obtained from 27 th to 30 th bytes of the message. There are many types of protocols, not all of which are listed here.
In this specification, the device to be configured may maintain a storage space responsible for collecting IP addresses, and this storage space may be regarded as an IP pool for managing IP addresses. Therefore, after the device to be configured analyzes each IP address from each message, the IP addresses can be added into the IP pool.
S103: and determining the IP address range which can be used by the equipment to be configured in the network according to the IP addresses used by the other equipment in the network.
After acquiring the IP address analyzed from the message, the device to be configured may determine an IP address range that the device to be configured may use in the network, for example, if the determined IP addresses are 192.168.0.10 and 192.168.3.200, it may be determined that the IP address range that the device to be configured may use in the network is 192.168.0.10 to 192.168.3.200.
It should be noted that, for each acquired message, if it is determined that the IP address parsed from the message does not fall within the IP address range determined before the message is acquired, the IP address range determined before the message is acquired may be updated according to the IP address parsed from the message.
For example, if the IP address range determined before the message is acquired is 192.168.0.10 to 192.168.3.199, and the IP address analyzed from the message is 192.168.3.200, the device to be configured finds, by comparison, that 192.168.3.200 is greater than the maximum IP address of the previously determined IP address range: 192.168.3.199, the usable IP address range is updated to 192.168.0.10 to 192.168.3.200.
That is, each time an IP address is resolved, the resolved IP address may be compared with the maximum IP address and the minimum IP address in the previously determined IP address range, and if the resolved IP address is greater than the maximum IP address in the previously determined IP address range, the resolved IP address may be used as the maximum IP address in the updated IP address range. Similarly, if the analyzed IP address is smaller than the minimum IP address in the previously determined IP address range, the analyzed IP address is used as the minimum IP address in the updated IP address range.
S104: and determining a target IP address according to the IP address range, and using the target IP address as the IP address used by the equipment to be configured in the network.
After the device to be configured acquires the usable IP address range in the network, it may determine an unoccupied IP address in the IP address range as a preconfigured IP address according to the IP address range and the IP addresses of other devices obtained by previous resolution.
For example, assuming that the determined IP addresses range from 192.168.0.10 to 192.168.3.200, it is found that 192.168.3.199 is unoccupied from among the previously resolved IP addresses of the other devices, 192.168.3.199 may be used as the preconfigured IP address.
In this specification, the device to be configured may store the IP address obtained by the analysis in an IP linked list, compare the IP address obtained by the analysis with the IP address in the IP linked list each time the device to be configured obtains the IP address of another device by the analysis, and write the IP address into the IP linked list if it is determined that the IP address obtained by the analysis is not recorded in the IP linked list.
It should be noted that, if the device to be configured determines that all the IP addresses in the usable IP address range are occupied according to the IP addresses used by each other device in the network, the subnet range to which the IP address range belongs may be determined according to the usable IP address range, for example, if the usable IP address range is determined to be 192.168.0.10 to 192.168.3.200, the subnet mask corresponding to the usable IP address range may be determined to be 255.255.252.0, and the subnet corresponding to the IP address range may be determined according to the subnet mask.
After determining the subnet, the device to be configured may select an IP address beyond the usable IP address range but within the subnet range as the preconfigured IP, for example, if the selectable IP address range is 192.168.0.10 to 192.168.3.200 and all IP addresses within the range are occupied, the value of the fourth segment (i.e. 200) of 192.168.3.200 may be added by 1 to obtain 192.168.3.201, and if 192.168.3.201 is determined to be within the subnet range, 192.168.3.201 may be further used as the preconfigured IP address.
Similarly, if the selectable IP address range is 192.168.0.10 to 192.168.3.200 and all IP addresses in the range are occupied, the value of the fourth segment (i.e., 10) of 192.168.0.10 may be subtracted by 1 to obtain 192.168.0.9, and if 192.168.0.9 is determined to be in the subnet range, 192.168.0.9 may be further used as the preconfigured IP address.
In this specification, the step size of increase or decrease may be set according to actual needs when selecting a preconfigured IP address. For example, if the selectable IP address range is 192.168.0.10 to 192.168.3.200, and all IP addresses in the range are occupied, which may be 3 steps, the value of the fourth segment of 192.168.3.200 (i.e., 200) is added by 3 to obtain 192.168.3.203, and if 192.168.3.203 is determined to be in the subnet range, 192.168.3.203 may be used as the preconfigured IP address. Similarly, the value of the fourth segment of 192.168.0.10 (i.e., 10) may be decremented by 3 to obtain 192.168.0.7, and 192.168.0.7 may be used as the preconfigured IP address if 192.168.0.7 is determined to be within the subnet range.
And after the IP address beyond the usable IP address range but within the subnet range is selected as the pre-configured IP address by the device to be configured, updating the usable IP address range according to the pre-configured IP address. For example, if the selectable IP address range is 192.168.0.10 to 192.168.3.200 and the preconfigured IP address is 192.168.3.201, the usable IP address is updated to 192.168.0.10 to 192.168.3.201.
And if the device to be configured determines that all the IP addresses in the subnet range are occupied, returning information of failure in configuring the IP addresses to the user.
After the device to be configured acquires the pre-configured IP address, a message carrying the pre-configured IP address is further broadcasted to the device belonging to the network, so as to detect whether the pre-configured IP address is occupied. For example, an ARP active detection method is used to detect whether a pre-configured IP Address is occupied, that is, a device to be configured broadcasts an ARP data request in the network, and after other devices analyze the data request and recognize that the data request requests to obtain their own physical addresses (Media Access Control addresses, MACs), a response message is sent, where the response message includes IP addresses of other devices and MAC addresses of other devices. And the equipment to be configured determines which MAC addresses corresponding to the pre-configured IP addresses exist by analyzing the obtained response message. If it is determined that a MAC address corresponding to the preconfigured IP address is not found in each of the other devices (i.e., no devices in the network use the preconfigured IP address), then it is determined that the preconfigured IP address is unoccupied. If it is determined that there are other devices using the preconfigured IP address, it is determined that the preconfigured IP address is occupied.
This process may be understood as the device to be configured sending information to the other device requesting the other device to return the MAC of the device with the preconfigured IP address, and if it is determined that the other device does not return the MAC of the device with the preconfigured IP address, determining that the preconfigured IP address is not occupied.
And if the device to be configured detects that the pre-configured IP address is not occupied, taking the pre-configured IP address as a target IP address. If the device to be configured detects that the pre-configured IP address is occupied, the pre-configured IP address is re-determined from the determined usable IP address range until the target IP address is determined.
And after the device to be configured acquires the target IP address, taking the target IP address as the IP address used by the device to be configured in the network.
After the device to be configured has configured the IP address, it will also continuously detect whether there is an IP conflict between the device to be configured and other devices in the network, and if it is detected that there are other devices using the target IP address in the network, the device to be configured reconfigures the IP address for the device to be configured using the method for configuring the IP address.
In this specification, the above-described method of configuring an IP address may be performed by using a plurality of modules deployed in a device to be configured. This is explained below with reference to fig. 2.
Fig. 2 is a schematic diagram of an apparatus for performing configuration of an IP address provided in this specification.
The device to be configured is provided with a message analysis module, an IP decision module, a conflict detection module and an IP display module. The message analysis module is used for analyzing message messages broadcast by other devices in a network to which the device to be configured belongs, and acquired by the device to be configured. The IP decision module is used for determining an available IP address range and determining a pre-configured IP address from the IP address range. The conflict detection module is used for detecting whether the pre-configured IP address is occupied or not. The IP display module is used for prompting the process of IP configuration of the user and displaying the result of whether the configuration is successful or not.
In this specification, after the message analysis module analyzes and acquires an IP address of another device, the acquired IP address is sent to the IP decision module, and the IP decision module determines a range of usable IP addresses according to the acquired IP address, and determines an unoccupied IP address within the range of usable IP addresses as a preconfigured IP address according to the range of usable IP addresses. The IP decision module sends the pre-configured IP address to a conflict detection module after acquiring the pre-configured IP address, the conflict detection module is used for detecting whether the pre-configured IP address is occupied or not, and if the pre-configured IP address is detected not to be occupied, the pre-configured IP address is used as a target IP address. And if the pre-configured IP address is detected to be occupied, returning the information that the pre-configured IP address is occupied to the IP decision module, and reselecting the pre-configured IP address by the IP decision module according to the usable IP address range.
In the subsequent process, the conflict detection module also continuously detects whether the IP used by the device to be configured conflicts with other devices in the network, and selects the IP address which can be used in the network again for the device to be configured after determining that the IP conflict exists.
A method for configuring an IP address provided in this specification is described below with reference to fig. 3.
Fig. 3 is a schematic diagram illustrating a flow of a method for configuring an IP address according to the present disclosure.
S1: the device to be configured obtains the message information broadcast by other devices in the network to which the device to be configured belongs.
S2: and the equipment to be configured analyzes the acquired message and determines the IP addresses used by other equipment in the network.
S3: after ten minutes, the device to be configured determines the IP address range that can be used by the device to be configured in the network according to the IP address obtained by the analysis.
S4: and the device to be configured determines a pre-configured IP address according to the determined usable IP address range.
S5: and the device to be configured performs conflict detection on the pre-configured IP address, if the pre-configured IP address is detected to be occupied, the step S6 is performed, and if the pre-configured IP address is detected to be unoccupied, the step S7 is performed.
S6: the pre-configured IP address is re-selected according to the range of available IP addresses.
S7: and taking the pre-configured IP address as a target IP address, and taking the target IP address as an IP address of the device to be configured in the network.
S8: and displaying the configured IP address to the user.
According to the method, the IP addresses of other devices in the network can be obtained by receiving the message messages broadcast by the other devices in the network, so that the IP address range which can be used in the network is determined, the target IP address is determined from the usable IP address range, the IP address of the device to be configured can be automatically configured under the condition that a DHCP server is not available, and the IP address can be reconfigured under the condition that IP conflict occurs in the subsequent use process, so that the problem of IP conflict is solved.
It should be further noted that the method for configuring an IP address provided in this specification can be applied to various network environments, and particularly, can be applied to an industrial control network to allocate an appropriate IP address to various network devices that need to allocate and manage IP addresses in an industrial environment, thereby ensuring normal operation of the industrial control network.
Fig. 4 is a schematic diagram of an apparatus for configuring an IP address provided in this specification, including:
an obtaining module 401, configured to obtain a message broadcasted by each other device in a network to which a device to be configured belongs;
an analyzing module 402, configured to analyze the message and determine an IP address used by each of the other devices in the network;
a determining module 403, configured to determine, according to the IP addresses used by the other devices in the network, an IP address range that can be used by the device to be configured in the network;
a configuration module 404, configured to determine a target IP address according to the IP address range, and use the target IP address as an IP address of the device to be configured in the network.
Optionally, the parsing module 402 is specifically configured to, for each obtained message, determine a protocol type based on the message; determining a byte segment recorded with an IP address from the message according to the protocol type; an IP address is parsed from the field.
Optionally, the determining module 403 is specifically configured to, for each obtained message, if it is determined that the IP address analyzed from the message does not fall within the IP address range determined before the message is obtained, update the IP address range determined before the message is obtained according to the IP address analyzed from the message, and use the updated IP address range as the IP address range that can be used by the device to be configured in the network and is determined after the message is obtained.
Optionally, the configuration module 404 is specifically configured to determine, according to the IP address used by each other device in the network, an IP address that is not occupied in the IP address range, as a preconfigured IP address; broadcasting a message carrying the pre-configured IP address to equipment belonging to the network so as to detect whether the pre-configured IP address is occupied; if the pre-configured IP address is detected to be unoccupied, the pre-configured IP address is used as the target IP address, otherwise, the pre-configured IP address is re-determined based on the determined IP address range.
Optionally, the configuring module 404 is further configured to, if it is determined that all the IP addresses in the IP address range are occupied according to the IP addresses used by the other devices in the network, determine an IP address that does not fall within the IP address range but is located in a subnet range to which the IP address range belongs, as the preconfigured IP address.
Optionally, the configuring module 404 is further configured to update the IP address range according to the determined IP address, which is not in the IP address range but is in the subnet range to which the IP address range belongs.
Optionally, the configuration module 404 is specifically configured to determine, by using a preset IP decision module, an IP address that is not occupied in the IP address range according to the IP addresses used by the other devices in the network, as a preconfigured IP address; broadcasting a message carrying the pre-configured IP address to equipment belonging to the network, detecting whether the pre-configured IP address is occupied through a preset conflict detection module, if the pre-configured IP address is detected to be unoccupied, taking the pre-configured IP address as the target IP address, and otherwise, re-determining the pre-configured IP address based on the determined IP address range.
Optionally, the configuring module 404 is further configured to, after configuring the IP address for the device to be configured, if it is detected that there is another device using the target IP address in the network, reallocate the IP address for the device to be configured.
The present specification also provides a computer-readable storage medium storing a computer program operable to execute a method of configuring an IP address as provided in fig. 1 above.
This specification also provides a schematic block diagram of an electronic device corresponding to that of figure 1, shown in figure 5. As shown in fig. 5, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, but may also include hardware required for other services. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs the computer program to implement the method for configuring the IP address described in fig. 1. Of course, besides the software implementation, the present specification does not exclude other implementations, such as logic devices or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, and may be hardware or logic devices.
In the 90 s of the 20 th century, improvements in a technology could clearly distinguish between improvements in hardware (e.g., improvements in circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements in process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain the corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical modules. For example, a Programmable Logic Device (PLD), such as a Field Programmable Gate Array (FPGA), is an integrated circuit whose Logic functions are determined by programming the Device by a user. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Furthermore, nowadays, instead of manually making an Integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as abel (advanced Boolean Expression Language), ahdl (alternate Hardware Description Language), traffic, pl (core universal Programming Language), HDCal (jhdware Description Language), lang, Lola, HDL, laspam, hardward Description Language (vhr Description Language), vhal (Hardware Description Language), and vhigh-Language, which are currently used in most common. It will also be apparent to those skilled in the art that hardware circuitry for implementing the logical method flows can be readily obtained by a mere need to program the method flows with some of the hardware description languages described above and into an integrated circuit.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be considered a hardware component, and the means included therein for performing the various functions may also be considered as a structure within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the various elements may be implemented in the same one or more pieces of software and/or hardware in the practice of this description.
As will be appreciated by one skilled in the art, embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The description has been presented with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the description. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
This description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only an example of the present specification, and is not intended to limit the present specification. Various modifications and alterations to this description will become apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification should be included in the scope of the claims of the present specification.

Claims (11)

1. A method for configuring an IP address, comprising:
acquiring message information broadcast by other equipment in a network to which the equipment to be configured belongs;
analyzing the message and determining the IP addresses used by the other devices in the network;
determining an IP address range which can be used by the equipment to be configured in the network according to the IP addresses used by the other equipment in the network;
and determining a target IP address according to the IP address range, and taking the target IP address as the IP address of the device to be configured in the network.
2. The method according to claim 1, wherein analyzing the message and determining the IP addresses used by the other devices in the network specifically comprises:
determining the protocol type based on each acquired message;
determining a byte segment recorded with an IP address from the message according to the protocol type;
an IP address is parsed from the field.
3. The method according to claim 1, wherein determining, according to the IP addresses used by the other devices in the network, an IP address range that can be used by the device to be configured in the network specifically includes:
and for each acquired message, if the IP address analyzed from the message is determined not to fall into the IP address range determined before the message is acquired, updating the IP address range determined before the message is acquired according to the IP address analyzed from the message, and taking the updated IP address range as the IP address range which can be used by the equipment to be configured and is determined after the message is acquired in the network.
4. The method according to claim 1, wherein determining a target IP address according to the IP address range, and using the target IP address as an IP address of the device to be configured in the network specifically includes:
determining an unoccupied IP address in the IP address range as a pre-configured IP address according to the IP addresses used by the other devices in the network;
broadcasting a message carrying the pre-configured IP address to equipment belonging to the network so as to detect whether the pre-configured IP address is occupied;
if the pre-configured IP address is detected to be unoccupied, the pre-configured IP address is used as the target IP address, otherwise, the pre-configured IP address is re-determined based on the determined IP address range.
5. The method of claim 4, wherein the method further comprises:
and if the IP addresses in the IP address range are all occupied according to the IP addresses used by the other devices in the network, determining the IP addresses which do not fall into the IP address range but are positioned in the subnet range to which the IP address range belongs as the pre-configured IP addresses.
6. The method of claim 5, wherein the method further comprises:
and updating the IP address range according to the determined IP address which is not in the IP address range but is in the subnet range to which the IP address range belongs and is pre-configured.
7. The method according to claim 1, wherein determining a target IP address according to the IP address range, and using the target IP address as an IP address of the device to be configured in the network specifically includes:
determining unoccupied IP addresses in the IP address range as pre-configured IP addresses according to the IP addresses used by the other devices in the network through a preset IP decision module;
broadcasting a message carrying the pre-configured IP address to equipment belonging to the network, detecting whether the pre-configured IP address is occupied through a preset conflict detection module, if the pre-configured IP address is detected to be unoccupied, taking the pre-configured IP address as the target IP address, and otherwise, re-determining the pre-configured IP address based on the determined IP address range.
8. The method of any one of claims 1 to 7, further comprising:
and after the IP address is configured for the device to be configured, if other devices using the target IP address exist in the network, the IP address is re-allocated for the device to be configured.
9. An apparatus for configuring an IP address, comprising:
the acquisition module is used for acquiring message messages broadcast by other equipment in a network to which the equipment to be configured belongs;
the analysis module is used for analyzing the message and determining the IP addresses used by the other devices in the network;
a determining module, configured to determine, according to the IP addresses used by the other devices in the network, an IP address range that can be used by the device to be configured in the network;
and the configuration module is used for determining a target IP address according to the IP address range and taking the target IP address as the IP address of the equipment to be configured in the network.
10. A computer-readable storage medium, characterized in that the storage medium stores a computer program which, when executed by a processor, implements the method of any of claims 1 to 8.
11. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any of claims 1 to 8 when executing the program.
CN202210404053.4A 2022-04-18 2022-04-18 Method and device for configuring IP address Pending CN114513492A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210404053.4A CN114513492A (en) 2022-04-18 2022-04-18 Method and device for configuring IP address

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210404053.4A CN114513492A (en) 2022-04-18 2022-04-18 Method and device for configuring IP address

Publications (1)

Publication Number Publication Date
CN114513492A true CN114513492A (en) 2022-05-17

Family

ID=81555149

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210404053.4A Pending CN114513492A (en) 2022-04-18 2022-04-18 Method and device for configuring IP address

Country Status (1)

Country Link
CN (1) CN114513492A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116074285A (en) * 2022-12-30 2023-05-05 中国联合网络通信集团有限公司 Address conflict detection method and device

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5854901A (en) * 1996-07-23 1998-12-29 Cisco Systems, Inc. Method and apparatus for serverless internet protocol address discovery using source address of broadcast or unicast packet
EP1204260A2 (en) * 2000-09-30 2002-05-08 Fluke Networks, Inc. Apparatus and method for automatically obtaining a valid IP configuration in a local area network
US20070160051A1 (en) * 2006-01-06 2007-07-12 Huawei Technologies Co., Ltd. Method for assigning IP address to terminal device and communication system
CN101175000A (en) * 2007-11-22 2008-05-07 华为技术有限公司 Method and device for automatic IP address detection
US20080130646A1 (en) * 2006-12-04 2008-06-05 Nolterieke Michael H Method and system for configuring a device that has failed to obtain network address
CN101651722A (en) * 2009-08-28 2010-02-17 华为技术有限公司 Method, device and system for automatically allocating IP address
CN106506720A (en) * 2016-11-16 2017-03-15 西安诺瓦电子科技有限公司 Network ip address auto-allocation method

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5854901A (en) * 1996-07-23 1998-12-29 Cisco Systems, Inc. Method and apparatus for serverless internet protocol address discovery using source address of broadcast or unicast packet
EP1204260A2 (en) * 2000-09-30 2002-05-08 Fluke Networks, Inc. Apparatus and method for automatically obtaining a valid IP configuration in a local area network
US20070160051A1 (en) * 2006-01-06 2007-07-12 Huawei Technologies Co., Ltd. Method for assigning IP address to terminal device and communication system
US20080130646A1 (en) * 2006-12-04 2008-06-05 Nolterieke Michael H Method and system for configuring a device that has failed to obtain network address
CN101175000A (en) * 2007-11-22 2008-05-07 华为技术有限公司 Method and device for automatic IP address detection
CN101651722A (en) * 2009-08-28 2010-02-17 华为技术有限公司 Method, device and system for automatically allocating IP address
CN106506720A (en) * 2016-11-16 2017-03-15 西安诺瓦电子科技有限公司 Network ip address auto-allocation method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116074285A (en) * 2022-12-30 2023-05-05 中国联合网络通信集团有限公司 Address conflict detection method and device

Similar Documents

Publication Publication Date Title
CN107450981B (en) Block chain consensus method and equipment
CN110113744B (en) Communication method, device, equipment and storage medium
CN110875935B (en) Message publishing, processing and subscribing method, device and system
CN108268289B (en) Parameter configuration method, device and system for web application
CN115002143B (en) Node election method and device, storage medium and electronic equipment
CN110795192B (en) Language switching method and device and terminal equipment
CN112925718B (en) Call stack backtracking method, device, equipment and medium
CN111683359A (en) BLE communication method, device, equipment and storage medium
US20160218763A1 (en) Systems, methods, and computer-readable media for tracking updates and loading data
CN111355672A (en) Message forwarding method and device
CN114513492A (en) Method and device for configuring IP address
KR101821016B1 (en) Apparatus, system and method for allocating identifiers to components of a control system
CN110753040B (en) Request processing method and device
CN110955624A (en) Hot plug method, device and system of PCIE (peripheral component interface express) equipment
CN110162573B (en) Distributed sequence generation method, device and system
CN112559565A (en) Abnormity detection method, system and device
CN109582388B (en) Parameter configuration method, device and equipment
CN109976769B (en) Method, device and equipment for determining server identification corresponding to application installation package
CN107704502B (en) Routing method, device, equipment and system
WO2019100704A1 (en) Starting method for multi-mode iot device, multi-mode iot device, and storage medium
CN114615234A (en) Address allocation method and device
CN111221651A (en) Load balancing configuration method and device, server and readable storage medium
CN113761400A (en) Access request forwarding method, device and equipment
CN117041980B (en) Network element management method and device, storage medium and electronic equipment
US11757830B2 (en) Method and apparatus for allocating CTDB-based virtual IP address, and distributed storage device

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20220517