CN117118950A - IP address allocation system and method - Google Patents

IP address allocation system and method Download PDF

Info

Publication number
CN117118950A
CN117118950A CN202311055851.1A CN202311055851A CN117118950A CN 117118950 A CN117118950 A CN 117118950A CN 202311055851 A CN202311055851 A CN 202311055851A CN 117118950 A CN117118950 A CN 117118950A
Authority
CN
China
Prior art keywords
address
dhcp
request message
terminal equipment
relay
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
CN202311055851.1A
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.)
Bnc Technologies Co ltd
Original Assignee
Bnc Technologies 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 Bnc Technologies Co ltd filed Critical Bnc Technologies Co ltd
Priority to CN202311055851.1A priority Critical patent/CN117118950A/en
Publication of CN117118950A publication Critical patent/CN117118950A/en
Pending legal-status Critical Current

Links

Classifications

    • 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/5007Internet protocol [IP] addresses
    • H04L61/5014Internet protocol [IP] addresses using dynamic host configuration protocol [DHCP] or bootstrap protocol [BOOTP]
    • 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/5007Internet protocol [IP] addresses
    • 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/5092Address allocation by self-assignment, e.g. picking addresses at random and testing if they are already in use

Abstract

The application discloses an IP address allocation system and method, and relates to the technical field of communication. The system comprises: terminal equipment, DHCP relay equipment and a DHCP server; the terminal equipment is used for sending a first request message to the DHCP relay equipment, wherein the first request message is used for acquiring the IP address of the terminal equipment; the DHCP relay device is configured to add a relay agent information option to the first request packet, and send the processed first request packet to the DHCP server, where the relay agent information option is used to indicate identification information of the terminal device; the DHCP server is used for determining the IP address of the terminal equipment according to the relay agent information option. The DHCP relay equipment forwards the request message of the terminal equipment, and adds the identification information of the terminal equipment in the request message, so that the combination of the DHCP function and the static IP address function can be realized, and the same IP address is allocated for different terminal equipment in some application scenes, thereby realizing the automatic configuration of the IP address.

Description

IP address allocation system and method
Technical Field
The present application relates to the field of communications technologies, and in particular, to an IP address allocation system and method.
Background
At present, a DHCP server is adopted to dynamically allocate IP addresses to terminal equipment of a current access network, so that the terminal equipment of the current access network receives network services through the allocated IP addresses. However, in some application scenarios, such as port machinery slings of ports and cameras on slings, the DHCP server randomly allocates IP addresses to the cameras when they are replaced, and a commissioning person is required to manually modify the IP addresses of the cameras when they are replaced. Therefore, how to automatically allocate the same IP address to different terminal devices is a problem that needs to be solved at present.
Disclosure of Invention
In view of the above problems, the present application provides an IP address allocation system and method, which solve the problem of how to automatically allocate the same IP address to different terminal devices.
In order to solve the technical problems, the application provides the following scheme:
in a first aspect, the present application provides an IP address allocation system comprising: terminal equipment, DHCP relay equipment and a DHCP server; the terminal equipment is used for sending a first request message to the DHCP relay equipment, wherein the first request message is used for acquiring the IP address of the terminal equipment; the DHCP relay equipment is used for adding a relay agent information option to the first request message, and sending the processed first request message to the DHCP server, wherein the relay agent information option is used for indicating the identification information of the terminal equipment; the DHCP server is configured to determine an IP address of the terminal device based on the relay agent information option.
With reference to the first aspect, in one possible implementation manner, the DHCP relay device is specifically configured to: determining an interface number of a DHCP relay device connected with the terminal device; and adding the physical address of the interface indicated by the interface number into the first request message through the relay agent information option.
With reference to the first aspect, in another possible implementation manner, a correspondence between a physical address and an address pool is stored in a DHCP server, where the DHCP server is specifically configured to: and determining an address pool corresponding to the physical address according to the corresponding relation, and acquiring the IP address from the address pool.
With reference to the first aspect, in another possible implementation manner, the DHCP server is further configured to: and generating a first response message according to the relay agent information option and the IP address, and sending the first response message to the terminal equipment through the DHCP relay equipment.
With reference to the first aspect, in another possible implementation manner, the terminal device is further configured to: and responding to the first response message sent by the DHCP server, and sending a second request message to the DHCP server through the DHCP relay equipment, wherein the second request message is used for indicating whether the terminal equipment uses the IP address or not.
With reference to the first aspect, in another possible implementation manner, the DHCP server is further configured to: and when the second request message indicates the terminal equipment to use the IP address, sending a second response message to the terminal equipment, wherein the second response message is used for indicating the terminal equipment to perform configuration according to the IP address.
In a second aspect, the present application provides an IP address allocation method, applied to a DHCP relay device, where the method includes: receiving a first request message sent by terminal equipment, wherein the first request message is used for acquiring an IP address of the terminal equipment; and adding the relay agent information option to the first request message, and sending the processed first request message to the DHCP server so that the DHCP server can determine the IP address of the terminal equipment according to the relay agent information option, wherein the relay agent information option is used for indicating the identification information of the terminal equipment.
With reference to the second aspect, in one possible implementation manner, an interface number of a DHCP relay device to which the terminal device is connected is determined; and adding the physical address of the interface indicated by the interface number into the first request message through the relay agent information option.
In a third aspect, the present application provides an IP address allocation method, applied to a DHCP server, where the method includes: and determining the IP address of the terminal equipment according to a first request message sent by the DHCP relay equipment, wherein the first request message comprises a relay agent information option for indicating the identification information of the terminal equipment.
With reference to the third aspect, in one possible implementation manner, a correspondence between a physical address and an address pool is stored in the DHCP server, the address pool corresponding to the physical address is determined according to the correspondence, and an IP address is obtained from the address pool.
With reference to the third aspect, in another possible implementation manner, a first response message is generated according to the relay agent information option and the IP address, and the first response message is sent to the terminal device through the DHCP relay device; the receiving terminal equipment sends a second request message through the DHCP relay equipment, wherein the second request message is used for indicating whether the terminal equipment uses the IP address or not.
With reference to the third aspect, in another possible implementation manner, when the second request packet indicates that the terminal device uses the IP address, the second response packet is sent to the terminal device, where the second response packet is used to instruct the terminal device to configure the terminal device according to the IP address.
In a fourth aspect, the present application provides an IP address allocation apparatus, including:
the receiving module is used for receiving a first request message sent by the terminal equipment, wherein the first request message is used for acquiring the IP address of the terminal equipment.
And the processing module is used for adding the relay agent information option to the first request message.
The sending module is used for sending the processed first request message to the DHCP server so that the DHCP server can determine the IP address of the terminal equipment according to the relay agent information option, wherein the relay agent information option is used for indicating the identification information of the terminal equipment.
With reference to the fourth aspect, in one possible implementation manner, the processing module is specifically configured to determine an interface number of a DHCP relay device to which the terminal device is connected; and adding the physical address of the interface indicated by the interface number into the first request message through the relay agent information option.
In a fifth aspect, the present application provides an IP address allocation apparatus, the apparatus comprising:
the processing module is used for determining the IP address of the terminal equipment according to a first request message sent by the DHCP relay equipment, wherein the first request message comprises a relay agent information option for indicating the identification information of the terminal equipment.
With reference to the fifth aspect, in one possible implementation manner, the processing module is specifically configured to store a correspondence between a physical address and an address pool in the DHCP server, determine the address pool corresponding to the physical address according to the correspondence, and obtain an IP address from the address pool.
With reference to the fifth aspect, in another possible implementation manner, the apparatus further includes a sending module and a receiving module.
The sending module is used for generating a first response message according to the relay agent information option and the IP address, and sending the first response message to the terminal equipment through the DHCP relay equipment.
The receiving module is used for receiving a second request message sent by the terminal equipment through the DHCP relay equipment, and the second request message is used for indicating whether the terminal equipment uses the IP address or not.
With reference to the fifth aspect, in another possible implementation manner, the sending module is further configured to send a second response packet to the terminal device when the second request packet indicates that the terminal device uses the IP address, where the second response packet is used to instruct the terminal device to configure the terminal device according to the IP address.
In order to achieve the above object, according to a sixth aspect of the present application, there is provided a storage medium including a stored program, wherein the device in which the storage medium is controlled to execute the IP address allocation method of the above second aspect when the program runs.
In order to achieve the above object, according to a seventh aspect of the present application, there is provided a storage medium including a stored program, wherein the device in which the storage medium is controlled to execute the IP address allocation method of the above third aspect when the program runs.
To achieve the above object, according to an eighth aspect of the present application, there is provided an electronic device including at least one processor, and at least one memory, bus connected to the processor; the processor and the memory complete communication with each other through a bus; the processor is configured to invoke program instructions in the memory to perform the IP address allocation method of the second aspect described above.
To achieve the above object, according to a ninth aspect of the present application, there is provided an electronic device including at least one processor, and at least one memory, bus connected to the processor; the processor and the memory complete communication with each other through a bus; the processor is configured to invoke program instructions in the memory to perform the IP address allocation method of the third aspect described above.
By means of the technical scheme, the technical scheme provided by the application has at least the following advantages:
according to the IP address distribution system and method provided by the application, the request message of the terminal equipment is forwarded through the DHCP relay equipment, and the identification information of the terminal equipment is added in the request message, so that the combination of the DHCP function and the static IP address function can be realized, the same IP address is distributed for different terminal equipment in some application scenes, and the automatic configuration of the IP address is further realized.
The foregoing description is only an overview of the present application, and is intended to be implemented in accordance with the teachings of the present application in order that the same may be more clearly understood and to make the same and other objects, features and advantages of the present application more readily apparent.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the application. Also, like reference numerals are used to designate like parts throughout the figures. In the drawings:
fig. 1 shows a schematic structural diagram of an IP address allocation system according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 3 is a schematic flow chart of an IP address allocation method according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an IP address allocation apparatus according to an embodiment of the present application;
fig. 5 shows a schematic structural diagram of another IP address allocation apparatus according to an embodiment of the present application.
Detailed Description
Exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the application to those skilled in the art.
In the embodiment of the application, the words of the terms of the first word, the second word and the like do not have a logical or time sequence dependency relationship, and the number and the execution sequence are not limited. It will be further understood that, although the following description uses the terms first, second, etc. to describe various elements, these elements should not be limited by the terms. These terms are only used to distinguish one element from another element.
The meaning of the term "at least one" in embodiments of the present application means one or more, and the meaning of the term "plurality" in embodiments of the present application means two or more.
It should also be understood that the term "if" may be interpreted as "when … …" ("white" or "upon") or "in response to a determination" or "in response to detection". Similarly, the phrase "if a [ stated condition or event ] is detected" may be interpreted as "when a [ stated condition or event ] is determined" or "in response to a determination" or "when a [ stated condition or event ] is detected" or "in response to a detection of a [ stated condition or event ] depending on the context.
To facilitate an understanding of the aspects of the present application, a brief description of the relevant concepts is first presented below.
Dynamic host configuration protocol (dynamic host configuration protocol, DHCP): is a dynamic address allocation scheme based on the transmission control protocol/internet protocol (Transmission Control Protocol/Internet Protocol, TCP/IP). DHCP has the advantage over manually configuring IP addresses that TCP/IP parameters (including IP address, subnet mask, default gateway, domain name system (Domain Name System, DNS), etc.) can be automatically configured, and assigned IP addresses have lease deadlines and can be recycled after lease. In this way, the configuration information of all TCP/IP protocols can be stored on the DHCP server in a centralized way, and the conflict of IP addresses can be avoided by centralized storage and management.
The foregoing is a description of technical terms related to the embodiments of the present application, and is not repeated herein.
As described in the background, the dynamic IP address assignment procedure performed by the DHCP server on the terminal device of the current access network generally includes five steps: the method comprises the steps that firstly, a terminal device sends a request message to find a DHCP server; secondly, the DHCP server replies the received inquiry message of the terminal equipment through the response message; thirdly, the terminal equipment receives replies of a plurality of DHCP servers and selects one of the DHCP servers according to a strategy; step four, the terminal equipment sends a request message to the selected DHCP server; and fifthly, the DHCP server sends a confirmation message to the terminal equipment. Thereby completing the address allocation process. The response message sent by the DHCP server to the terminal device in the second step is a pre-allocation message of the DHCP server, and generally includes information such as an IP address planned to be allocated, lease time, and the like. After the lease time expires, the terminal device needs to reinitiate the dynamic address allocation request.
However, in some application scenarios, such as port machinery slings of ports and cameras on slings, the DHCP server randomly allocates IP addresses to the cameras when they are replaced, and a commissioning person is required to manually modify the IP addresses of the cameras when they are replaced.
In view of this, an embodiment of the present application provides an IP address allocation method, which specifically includes: receiving a first request message sent by terminal equipment, wherein the first request message is used for acquiring an IP address of the terminal equipment; and adding the relay agent information option to the first request message, and sending the processed first request message to the DHCP server so that the DHCP server can determine the IP address of the terminal equipment according to the relay agent information option, wherein the relay agent information option is used for indicating the identification information of the terminal equipment.
The DHCP relay equipment forwards the request message of the terminal equipment, and adds the identification information of the terminal equipment in the request message, so that the combination of the DHCP function and the static IP address function can be realized, and the same IP address is allocated for different terminal equipment in some application scenes, thereby realizing the automatic configuration of the IP address.
The following describes in detail the implementation of the embodiment of the present application with reference to the drawings.
Fig. 1 is a schematic structural diagram of an IP address allocation system according to an embodiment of the present application. The IP address assignment system 100 includes a plurality of terminal devices 110, DHCP relay devices 120, and DHCP servers 130. The terminal device 110, the DHCP relay device 120, and the DHCP server 130 are connected through a network.
In an embodiment of the application, the network may be a virtual local area network (Virtual Local Area Network, VLAN). A virtual local area network is a set of logical devices (DHCP relay device 120 and DHCP server 130) and users (terminal device 110) that are not limited by physical location and can be divided according to management functions. In a shared network, a physical network segment is a broadcast domain, and in a switched network, the broadcast domain may be a VLAN segment consisting of a set of arbitrarily selected layer two network addresses. The VLAN network segments can limit the broadcasting range to form a virtual work group, and can also be used for controlling the mutual access between different departments and different stations in the network, thereby dynamically managing the network.
In a virtual local area network, the DHCP server may assign an IP address to the terminal device. The DHCP server may be a separate server device or may be integrated as a component in other network devices. The terminal device may be connected to the DHCP server through a DHCP relay device. The DHCP relay device is responsible for relaying the mutual information, such as DHCP messages, between the terminal device and the DHCP server.
In the embodiment of the present application, the terminal device 110 is configured to send a first request packet, where the first request packet is sent to the DHCP relay device 120 in a broadcast manner, and the first request packet is used to obtain the IP address of the terminal device 110 from the DHCP server.
Optionally, the Terminal device in the embodiment of the present application may refer to an access Terminal, a subscriber unit, a subscriber station, a mobile station, a relay station, a remote Terminal, a mobile device, a User Terminal (User Terminal), a UE, a Terminal (Terminal), a wireless communication device, a User agent, a User equipment, a cellular phone, a cordless phone, a session initiation protocol (Session Initiation Protocol, SIP) phone, a wireless local loop (Wireless Local Loop, WLL) station, a personal digital assistant (Personal Digital Assistant, PDA), a handheld device with a wireless communication function, a computing device, or other processing device connected to a wireless modem, a vehicle-mounted device, a wearable device, a Terminal device in a future 5G network, or a Terminal device in a future evolved PLMN, or a Terminal device in a future vehicle network, and the like, which is not limited by the embodiment of the present application.
The DHCP relay device is a device for forwarding a DHCP request message and a reply message between the terminal device and the DHCP server. One or more DHCP servers may be connected to the DHCP relay device. In the process of forwarding the DHCP acknowledgement message sent by the DHCP server, the DHCP relay device may record the address allocation situation through each address allocation, and specifically may record the address allocation situation of the DHCP server through the address status information (for example, the address status information may be the number of remaining addresses). When receiving the DHCP request message sent by the terminal device, the DHCP relay device may select a DHCP server according to the address status information, and forward the DHCP request message to the DHCP server for processing.
In the embodiment of the present application, the DHCP relay device 120 is connected to one DHCP server 130. After receiving the first request message sent by the terminal device 110, the DHCP relay device 120 adds the identification information of the terminal device 110 to the first request message through the relay agent information option, and sends the first request message including the identification information of the terminal device 110 to the DHCP server 130, so that the DHCP server 130 allocates an IP address to the terminal device 110 according to the first request message.
When there may be multiple DHCP servers in the network, since the request packet sent by the terminal device is in a broadcast form, the multiple DHCP servers can all receive the request packet, which may cause the terminal device to acquire the wrong IP address and network configuration parameters, so that normal communication cannot be performed, and in order to enable the terminal device to acquire the IP address through the legal DHCP server, the DHCP relay device 120 further has a DHCP Snooping function.
DHCP Snooping is a security feature of DHCP, and is mainly applied to switches to shield illegal DHCP servers in an access network. I.e. after starting the DHCP Snooping function, the terminal device in the network only obtains the IP address from the DHCP server specified by the administrator. Because the DHCP messages lack an authentication mechanism, if an illegal DHCP server exists in the network, an administrator cannot ensure that the terminal device obtains a legal address from the DHCP server specified by the administrator, and the terminal device may obtain configuration information such as an incorrect IP address from the illegal DHCP server, so that the terminal device cannot normally use the network. After starting the DHCP Snooping function, the interface on the switch must be set to be in a trusted state and an untrusted state, the switch only forwards the DHCP OFFER/ACK/NAK message of the trusted interface, discards the DHCP OFFER/ACK/NAK message of the untrusted interface, and therefore the purpose of blocking an illegal DHCP server is achieved.
In the embodiment of the present application, the interface of the DHCP relay device 120 connected to the DHCP server 130 is set as a trusted interface, and other interfaces are set as untrusted interfaces. Only the message sent by the DHCP server 130 will be forwarded to the terminal device, thereby ensuring that the DHCP client can only obtain an IP address from a legitimate DHCP server, and the privately installed pseudo-DHCP server cannot allocate an IP address to the DHCP client.
The DHCP server 130 is mainly applied to a local area network or a part of a wide area network, and can centrally manage and allocate IP addresses.
In the embodiment of the present application, the DHCP server 130 stores a plurality of address pools, each address pool includes one or more addresses, and also stores a correspondence between identification information of the terminal device and the address pool, and IP address. The DHCP server 130 determines a target address pool corresponding to the identification information of the terminal device included in the first request packet according to the correspondence relationship, and determines a corresponding IP address from the target address pool. And combines the identification information of the terminal device with the IP address in the form of relay proxy information option to form a first response report, and sends the first response report to the terminal device 110, so that the terminal device 110 can configure according to the IP address.
The following illustrates an application scenario of an IP address allocation system provided by the present application.
Port machines are devices used by ports and terminals for loading and unloading containers. The most important production operation process of the port machine in the working process of the control system of the port machine is to grasp and put the container by using a lifting appliance on the port machine. The lower frame of the lifting appliance of the port machine needs to be frequently replaced by the lower frame of a standby lifting appliance because the lifting appliance can collide in the process of grabbing and placing the container due to huge work amount of grabbing and placing the container in the port. Meanwhile, a camera is arranged on the lifting appliance and used for assisting an operator in grabbing and placing the container. When the lifting appliance lower frame of the port machine is replaced, the camera on the lifting appliance lower frame also needs to be replaced. The replaced video camera on the lower frame of the lifting appliance needs to be reassigned with an IP address and configured according to the IP address. The camera is automatically assigned an IP address by the IP address assignment system of the present application.
Under the application scene, the terminal equipment is a camera on a lower frame of the lifting appliance, the DHCP relay equipment is arranged in a box on the upper frame of the lifting appliance closest to the camera, the DHCP server is arranged in a cab, the DHCP server and the DHCP relay equipment are connected through an optical port, and the camera is connected to the DHCP relay equipment through a network port.
The camera sends a first request message in a broadcast mode to find a DHCP server capable of distributing an IP address to the camera, after receiving the first request message sent by the camera, the DHCP relay equipment adds a relay agent information option in the message, wherein the relay agent information option is a physical address of an interface indicated by an interface number of the DHCP relay equipment connected with the camera, namely, the identification information of the camera. The DHCP relay device transmits a first request message containing identification information of the camera to a DHCP server connected thereto. The DHCP server stores the correspondence between the physical addresses and the address pools, so that the address pool corresponding to the physical addresses can be determined according to the stored correspondence.
Under the application scene, as only one camera is configured on each lifting appliance, the IP address of the camera is unchanged when the lifting appliance and the camera are replaced, and therefore, only one IP address is arranged in the address pool. Taking 4 port machine lifting appliances as an example, 4 lifting appliance cameras divide 4 address pool groups, and as different devices inserted into the same interface are required to be always allocated with the same IP address, only 1 IP address is allocated in each address pool group, so that only 1 IP address in the camera address pool group can be always allocated to each camera inserted into the same DHCP relay device interface each time.
At this point, a corresponding address pool is determined, which also means that the IP address to which the camera corresponds is determined. The DHCP server sends the IP address to the camera through the DHCP relay equipment so that the camera can be configured according to the IP address.
It should be understood that fig. 1 is only an exemplary embodiment of an IP address allocation system provided in the present application, and the IP address allocation system is not limited to include only a plurality of terminal devices, a DHCP relay device, and a DHCP server. In other words, the IP address allocation system provided in the embodiment of the present application may include one terminal device or a plurality of DHCP relay devices, and a plurality of DHCP servers, which are collectively described herein, and will not be described in detail.
Fig. 2 is a hardware structure of an electronic device provided by the present application. The electronic device may be the above-mentioned terminal device, DHCP relay device or DHCP server.
As shown in fig. 2, the electronic device 200 includes a processor 210, a communication line 220, and a communication interface 230.
Optionally, the electronic device 200 may also include a memory 240. The processor 210, the memory 240, and the communication interface 230 may be connected by a communication line 220.
The processor 210 may be a central processing unit (Central Processing Unit, CPU), a general purpose processor network processor (Network Processor, NP), a digital signal processor (Digital Signal Processing, DSP), a microprocessor, a microcontroller, a programmable logic device (Programmable Logic Device, PLD), or any combination thereof. The processor 210 may also be any other apparatus having a processing function, such as a circuit, a device, or a software module, without limitation.
In one example, processor 210 may include one or more CPUs, such as CPU0 and CPU2 in fig. 2.
As an alternative implementation, electronic device 200 includes multiple processors, e.g., in addition to processor 210, may also include processor 270. A communication line 220 for communicating information between the components included in the electronic device 200.
A communication interface 230 for communicating with other devices or other communication networks. The other communication network may be an ethernet, a radio access network (Radio Access Network, RAN), a wireless local area network (Wireless Local Area Networks, WLAN), etc. The communication interface 230 may be a module, a circuit, a transceiver, or any device capable of enabling communication.
Memory 240 for storing instructions. Wherein the instructions may be computer programs.
The Memory 240 may be, but is not limited to, a Read-Only Memory (ROM) or other type of static storage device capable of storing static information and/or instructions, an access Memory (Random Access Memory, RAM) or other type of dynamic storage device capable of storing information and/or instructions, an electrically erasable programmable Read-Only Memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a compact disc Read-Only Memory (Compact Disc Read-Only Memory, CD-ROM) or other optical disc storage, an optical disc storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), a magnetic disc storage medium or other magnetic storage device, etc.
It should be noted that the memory 240 may exist separately from the processor 210 or may be integrated with the processor 210. Memory 240 may be used to store instructions or program code or some data, etc. The memory 240 may be located inside the electronic device 200 or outside the electronic device 200, without limitation.
The processor 210 is configured to execute instructions stored in the memory 240 to implement a communication method according to the following embodiments of the present application. For example, when the electronic device 200 is a terminal or a chip in a terminal, the processor 210 may execute instructions stored in the memory 240 to implement steps performed by a transmitting end in the embodiments of the present application described below.
As an alternative implementation, the electronic device 200 further comprises an output device 250 and an input device 260. The output device 250 may be a device capable of outputting data of the electronic apparatus 200 to a user, such as a display screen, a speaker, or the like. The input device 260 is a device capable of inputting data to the electronic apparatus 200, such as a keyboard, a mouse, a microphone, or a joystick.
It should be noted that the structure shown in fig. 2 is not limiting of the computing device, and the computing device may include more or less components than those shown in fig. 2, or may combine some components, or a different arrangement of components.
The IP address allocation system and the application scenario described in the embodiments of the present application are for more clearly describing the technical solution of the embodiments of the present application, and do not constitute a limitation on the technical solution provided by the embodiments of the present application, and as a person of ordinary skill in the art can know, with evolution of the IP address allocation system and occurrence of a new service scenario, the technical solution provided by the embodiments of the present application is equally applicable to similar technical problems.
Next, an IP address assignment method will be described in detail with reference to the drawings. Fig. 3 is a flow chart of an IP address allocation method provided by the present application. The method is applied to an IP address distribution system with a hardware structure shown in FIG. 1, and specifically comprises the following steps:
step 310, the terminal device sends a first request message to the DHCP relay device.
When the terminal equipment needs to acquire an IP address for configuration, the IP address sends a first request message to the DHCP relay equipment in a broadcast mode, wherein the first request message is used for searching a DHCP server which can be allocated with the IP address.
Step 320, the DHCP relay device adds the relay agent information option to the first request packet and sends the processed first request packet to the DHCP server.
After receiving a first request message sent by the terminal equipment, the DHCP relay equipment checks whether a relay agent information option exists in the first request message. If the relay agent information option exists in the first request message, the first request message is processed according to a preset strategy. For example, the relay agent information option in the first request message is discarded, and the DHCP relay device redetermines the relay agent information option, adds the redetermined relay agent information option to the first request message, and sends the redetermined relay agent information option to the DHCP server. For another example, the DHCP relay device does not process the relay agent information option in the first request message and sends the first request message to the DHCP server in between. If the relay agent information option does not exist in the first request message, the DHCP relay device determines an interface number of the DHCP relay device connected with the terminal device, adds a physical address of an interface indicated by the interface number into the first request message through the relay agent information option, and sends the processed first request message to the DHCP server. The first request message includes, but is not limited to, a physical address of an interface indicated by an interface number of the DHCP relay device connected to the terminal device, a network described by the DHCP relay device, and a physical address of the DHCP relay device itself.
Step 330, the DHCP server determines the IP address of the terminal device according to the relay agent information option.
In the embodiment of the application, the address pools in the DHCP server are divided according to the application scene, and the IP address in each address pool is configured according to the application scene.
Based on the above, after receiving the first request message sent by the DHCP relay device, the DHCP server may determine the corresponding address pool and the IP address in the address pool according to the identification information of the terminal device in the first request message. The DHCP server returns the identification information of the terminal equipment to the terminal equipment together with the IP address in the form of a relay agent information option, so that the terminal equipment can be configured according to the IP address.
Further, after receiving a first response message sent by the DHCP server through the DHCP relay device, the terminal device responds to the first response message, and sends a second request message to the DHCP server through the DHCP relay device, where the second request message is used to indicate whether the terminal device uses an IP address.
And when the second request message indicates the terminal equipment to use the IP address, sending a second response message to the terminal equipment, wherein the second response message is used for indicating the terminal equipment to perform configuration according to the IP address. When the second request message indicates that the terminal equipment does not use the IP address, a third response message is sent to the terminal equipment, and the terminal equipment cannot be configured according to the IP address.
In addition, the IP address allocated to the terminal device by the DHCP server has a certain lease period, and the server recovers the IP address after the lease expires. If the terminal device wants to continue using the address, the terminal device unicast-transmits a request message to the DHCP server to update the lease when the address lease expires by 50%. If the offer fails, the terminal device can broadcast a request message for sending again offer when the lease reaches 80%.
Under the application scene of the application, because the actual use condition in the field is that only one IP address is needed in each address group, if the lease time is longer, the DHCP server cannot allocate addresses to the replaced video camera because the lease time of the video camera before the replacement is not expired after the video camera is replaced. If the camera is required to quickly acquire the IP address after replacement, the DHCP lease time can be shortened according to the actual use condition.
In summary, the application can always allocate the same IP address to the terminal equipment inserted into the fixed interface of the DHCP relay equipment, combines the DHCP function and the static IP address function, can realize the dynamic allocation of the IP address, can always use 1 address for the fixed interface, does not change, and realizes the function of automatically configuring the IP address for the terminal equipment.
It will be appreciated that, in order to implement the functions of the above embodiments, the computer device includes corresponding hardware structures and/or software modules that perform the respective functions. Those of skill in the art will readily appreciate that the various illustrative elements and method steps described in connection with the embodiments disclosed herein may be implemented as hardware or combinations of hardware and computer software. Whether a function is implemented as a piece or as computer software driven hardware depends upon the particular application scenario and design constraints imposed on the solution.
Further, as an implementation of the method embodiment shown in fig. 3, an embodiment of the present application provides an IP address allocation apparatus. The embodiment of the device corresponds to the foregoing method embodiment, and for convenience of reading, details of the foregoing method embodiment are not described one by one in this embodiment, but it should be clear that the device in this embodiment can correspondingly implement all the details of the foregoing method embodiment. As shown in fig. 4, the IP address assignment apparatus 400 includes:
the receiving module 410 is configured to receive a first request packet sent by a terminal device, where the first request packet is used to obtain an IP address of the terminal device.
The processing module 420 is configured to add a relay agent information option to the first request message.
And a sending module 430, configured to send the processed first request packet to the DHCP server, so that the DHCP server determines the IP address of the terminal device according to a relay agent information option, where the relay agent information option is used to indicate identification information of the terminal device.
Further, as shown in fig. 4, the processing module 420 is specifically configured to determine an interface number of the DHCP relay device to which the terminal device is connected; and adding the physical address of the interface indicated by the interface number into the first request message through the relay agent information option.
Further, as an implementation of the method embodiment shown in fig. 3, another IP address allocation apparatus is provided in the embodiment of the present application. The embodiment of the device corresponds to the foregoing method embodiment, and for convenience of reading, details of the foregoing method embodiment are not described one by one in this embodiment, but it should be clear that the device in this embodiment can correspondingly implement all the details of the foregoing method embodiment. As shown in fig. 5, the IP address assignment apparatus 500 includes:
a processing module 510, configured to determine an IP address of the terminal device according to a first request packet sent by the DHCP relay device, where the first request packet includes a relay agent information option for indicating identification information of the terminal device.
Further, as shown in fig. 5, the processing module 510 is specifically configured to store a correspondence between a physical address and an address pool in the DHCP server, determine the address pool corresponding to the physical address according to the correspondence, and obtain an IP address from the address pool.
Further, as shown in fig. 5, the apparatus further includes a transmitting module 520 and a receiving module 530.
The sending module 520 is configured to generate a first response message according to the relay agent information option and the IP address, and send the first response message to the terminal device through the DHCP relay device.
The receiving module 530 is configured to receive a second request packet sent by the terminal device through the DHCP relay device, where the second request packet is used to indicate whether the terminal device uses an IP address.
Further, as shown in fig. 5, the sending module 520 is further configured to send a second response message to the terminal device when the second request message indicates that the terminal device uses the IP address, where the second response message is used to instruct the terminal device to configure the terminal device according to the IP address.
Further, the embodiment of the present application further provides an electronic device, where the electronic device includes a processor and a memory, where the receiving module 410, the processing module 420, the sending module 430, and the like are all stored as program units, and the processor executes the program units stored in the memory to implement corresponding functions. The processor includes a kernel, and the kernel fetches the corresponding program unit from the memory.
Further, the embodiment of the present application further provides an electronic device, where the electronic device includes a processor and a memory, where the processing module 510, the receiving module 520, the sending module 530, and the like are all stored as program units, and the processor executes the program units stored in the memory to implement corresponding functions. The processor includes a kernel, and the kernel fetches the corresponding program unit from the memory.
The embodiment of the application provides a storage medium, on which a program is stored, which when executed by a processor, implements the IP address allocation method.
The embodiment of the application provides a processor which is used for running a program, wherein the IP address allocation method is executed when the program runs.
The application also provides a computer program product adapted to perform, when executed on a data processing device, a program initialized with the method steps of: receiving a first request message sent by terminal equipment, wherein the first request message is used for acquiring an IP address of the terminal equipment; and adding the relay agent information option to the first request message, and sending the processed first request message to the DHCP server so that the DHCP server can determine the IP address of the terminal equipment according to the relay agent information option, wherein the relay agent information option is used for indicating the identification information of the terminal equipment.
Further, determining an interface number of the DHCP relay device connected with the terminal device; and adding the physical address of the interface indicated by the interface number into the first request message through the relay agent information option.
The application also provides another computer program product adapted to perform, when executed on a data processing device, a program initialized with the method steps of: and determining the IP address of the terminal equipment according to a first request message sent by the DHCP relay equipment, wherein the first request message comprises a relay agent information option for indicating the identification information of the terminal equipment.
Further, the DHCP server stores a correspondence between the physical address and the address pool, determines the address pool corresponding to the physical address according to the correspondence, and obtains the IP address from the address pool.
Further, a first response message is generated according to the relay agent information option and the IP address, and the first response message is sent to the terminal equipment through the DHCP relay equipment; the receiving terminal equipment sends a second request message through the DHCP relay equipment, wherein the second request message is used for indicating whether the terminal equipment uses the IP address or not.
Further, when the second request message indicates that the terminal device uses the IP address, a second response message is sent to the terminal device, where the second response message is used to indicate the terminal device to configure the terminal device according to the IP address.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations 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.
In one typical configuration, the device includes one or more processors (CPUs), memory, and a bus. The device may also include input/output interfaces, network interfaces, and the like.
The memory may include volatile memory, random Access Memory (RAM), and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM), among other forms in computer readable media, the memory including at least one memory chip. 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 storage media for a computer 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, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
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 one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises an element.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application 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 foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and variations of the present application will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. which come within the spirit and principles of the application are to be included in the scope of the claims of the present application.

Claims (10)

1. An IP address assignment system, the system comprising: terminal equipment, DHCP relay equipment and a DHCP server;
the terminal equipment is used for sending a first request message to the DHCP relay equipment, and the first request message is used for acquiring the IP address of the terminal equipment;
the DHCP relay device is configured to add a relay agent information option to the first request packet, and send the processed first request packet to the DHCP server, where the relay agent information option is used to indicate identification information of the terminal device;
The DHCP server is used for determining the IP address of the terminal equipment according to the relay agent information option.
2. The system according to claim 1, wherein the DHCP relay device is specifically configured to:
determining an interface number of the DHCP relay device connected with the terminal device;
and adding the physical address of the interface indicated by the interface number into the first request message through the relay agent information option.
3. The system according to claim 2, characterized in that the DHCP server has stored therein a correspondence of physical addresses to address pools, the DHCP server being specifically adapted to:
and determining an address pool corresponding to the physical address according to the corresponding relation, and acquiring an IP address from the address pool.
4. The system of claim 1, wherein the DHCP server is further configured to:
and generating a first response message according to the relay agent information option and the IP address, and sending the first response message to the terminal equipment through the DHCP relay equipment.
5. The system of claim 4, wherein the terminal device is further configured to:
and responding to the first response message sent by the DHCP server, and sending a second request message to the DHCP server through the DHCP relay equipment, wherein the second request message is used for indicating whether the terminal equipment uses the IP address.
6. The system of claim 5, wherein the DHCP server is further configured to:
and when the second request message indicates that the terminal equipment uses the IP address, sending a second response message to the terminal equipment, wherein the second response message is used for indicating the terminal equipment to perform configuration according to the IP address.
7. An IP address allocation method, applied to a DHCP relay device in an IP address allocation system according to any one of claims 1 to 6, comprising:
receiving a first request message sent by terminal equipment, wherein the first request message is used for acquiring an IP address of the terminal equipment;
and adding a relay agent information option to the first request message, and sending the processed first request message to the DHCP server so that the DHCP server can determine the IP address of the terminal equipment according to the relay agent information option, wherein the relay agent information option is used for indicating the identification information of the terminal equipment.
8. The method of claim 7, wherein adding a relay agent information option to the first request message comprises:
determining an interface number of the DHCP relay device connected with the terminal device;
And adding the physical address of the interface indicated by the interface number into the first request message through the relay agent information option.
9. An IP address allocation method applied to a DHCP server in an IP address allocation system according to any one of claims 1 to 6, the method comprising:
and determining the IP address of the terminal equipment according to a first request message sent by the DHCP relay equipment, wherein the first request message comprises a relay agent information option for indicating the identification information of the terminal equipment.
10. The method according to claim 9, wherein the DHCP server stores a correspondence between a physical address and an address pool, and determining the IP address of the terminal device according to the first request message sent by the DHCP relay device includes:
and determining a target address pool according to the terminal equipment identification information, and determining an IP address corresponding to the target address pool according to the corresponding relation.
CN202311055851.1A 2023-08-21 2023-08-21 IP address allocation system and method Pending CN117118950A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311055851.1A CN117118950A (en) 2023-08-21 2023-08-21 IP address allocation system and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311055851.1A CN117118950A (en) 2023-08-21 2023-08-21 IP address allocation system and method

Publications (1)

Publication Number Publication Date
CN117118950A true CN117118950A (en) 2023-11-24

Family

ID=88804912

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311055851.1A Pending CN117118950A (en) 2023-08-21 2023-08-21 IP address allocation system and method

Country Status (1)

Country Link
CN (1) CN117118950A (en)

Similar Documents

Publication Publication Date Title
US20220124147A1 (en) Application relocation method and apparatus
US8228848B2 (en) Method and apparatus for facilitating push communication across a network boundary
US11102170B2 (en) Route delivery method and device
US8103784B2 (en) Communication device and communication control method using efficient echonet address determination scheme
US20190166210A1 (en) Method for accessing a content hosted on a server selected as a function of the location of the user terminal
RU2679345C1 (en) Method and device for automatic network interaction of gateway device
EP3742785B1 (en) Session management method and device
CN102833732A (en) IPv6 (Internet Protocol Version 6) address stateless autoconfiguration system, data card and implementation method thereof
CN112654049B (en) Method, system, node and medium for configuring a wireless communication coverage extension system
CN102413203A (en) IP (Internet Protocol) address allocation method and device
CN116886588A (en) Communication method, device and system
CN107615723B (en) Internet protocol address allocation method and relay equipment
EP3503484B1 (en) Message transmission methods and devices
EP3703343A1 (en) Method and device for configuring service flow
US20160241427A1 (en) Service Sending, Receiving Methods and Devices
CN111669309B (en) VxLAN establishing method, wireless controller and switch
CN117118950A (en) IP address allocation system and method
CN115174310B (en) PDN dialing and configuration method, system, device, equipment and storage medium
CN104243626B (en) Information processing apparatus
US7590742B2 (en) IP address management
KR102211187B1 (en) Method and apparatus for IP address preservation in heterogeneous wireless networks
CN112543386B (en) Address acquisition method and related equipment
US20220086048A1 (en) Communication management system, management server, vpn server, terminal, communication management method, and program
JP5213070B2 (en) Wireless communication network connection system and wireless communication network connection method
CN114765601A (en) Address prefix obtaining method and 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