CN101795300B - IP (Internet Protocol) address recovery method and system, as well as DHCP (Dynamic Host Configuration Protocol) repeater and DHCP server - Google Patents
IP (Internet Protocol) address recovery method and system, as well as DHCP (Dynamic Host Configuration Protocol) repeater and DHCP server Download PDFInfo
- Publication number
- CN101795300B CN101795300B CN2009102216495A CN200910221649A CN101795300B CN 101795300 B CN101795300 B CN 101795300B CN 2009102216495 A CN2009102216495 A CN 2009102216495A CN 200910221649 A CN200910221649 A CN 200910221649A CN 101795300 B CN101795300 B CN 101795300B
- Authority
- CN
- China
- Prior art keywords
- address
- client
- dhcp
- arp
- allocation table
- 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.)
- Expired - Fee Related
Links
Images
Landscapes
- Small-Scale Networks (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention provides IP address recovery method and system, as well as a DHCP repeater and a DHCP server. The IP address recovery method comprises the following steps of: receiving an address distribution table sent by the DHCP server by using the DACP repeater, wherein the address distribution table comprises IP addresses distributed by the DHCP server through the DACP repeater, and client addresses corresponding to the IP addresses; determining whether clients corresponding to the IP addresses in the address distribution table are on line or not; recoding the IP addresses corresponding to the clients not on line, or the IP addresses and the client addresses corresponding to the IP addresses to generate an address release table; and sending the generated address release table to the DHCP server. Through adopting the invention, the load of the DHCP repeater can be lowered, and the invention can ensure that equipment can not be in a high-load state due to the simultaneous generation of a large number of messages when attached by DHCP.
Description
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method and a system for recovering an IP address, a DHCP relay, and a DHCP server.
Background
At present, with the increasing popularity of networks, internet users are growing, and Dynamic Host Configuration Protocol (DHCP) servers (servers) are increasingly used to allocate Dynamic IP addresses to network clients. When the DHCP server and the DHCP client are not in the same network segment, a DHCP Relay (Relay) device needs to be configured in the same network segment of the DHCP client, and the DHCP server allocates an IP address to the DHCP client through the Relay device. Besides dynamically allocating an IP address to the client, the DHCP server can also issue other parameter information such as lease information, a gateway, a Domain Name System (DNS), and the like.
When a client acquires an IP address through a DHCP server, if the client is directly powered off or a network cable is unplugged, the DHCP server cannot know that the IP address is released, and the IP address can be recovered and redistributed only after the lease time is over. Therefore, the allocated IP address in the DHCP address pool of the DHCP Server cannot be recovered in time, and finally, the allocable IP address in the DHCP address pool may be insufficient.
The Chinese patent application with the application number of 200610125734.8 and the publication number of CN1941722A discloses a method and a device for maintaining a DHCP security feature table by detecting a client, wherein the security feature table is created and maintained on a repeater by snooping a DHCP message between the DHCP client and a DHCP server, and the security feature table contains user information about acquiring an IP address by the DHCP server; the repeater periodically polls all the table entries of the security characteristic table, detects the online condition of the client, and informs the DHCP server to release the IP address of the client for the detected client which is not online actually. Although the above patent application can recover the IP address, the inventor finds out the defects of the prior art in the process of implementing the invention:
the relay device snoops the message between the DHCP client and the DHCP server and extracts the key field in the message to create the safety characteristic table, so that the relay device has larger load; in addition, the relay device needs to periodically detect corresponding entries in the security feature table, and therefore, when a large amount of user information exists in the security feature table, detecting all users in the table one by one further increases the load of the relay device.
When a large number of virtual users maliciously created by a client side are applied for DHCP, the relay equipment needs to detect each nonexistent DHCP user in the list and construct a DHCP Release message to notify a DHCP server, so that the load of the relay equipment is increased; moreover, constructing and sending a large number of DHCPRelease messages at the same time will make the device in a high load state.
Under the condition that the safety characteristic table entries are huge, the period of traversing the safety characteristic table by the relay equipment is too long, or a large number of user detections are triggered at one time, so that the pressure of the relay equipment is too high. If the traversal cycle is increased in order to slow down the pressure, the real-time performance of the security feature table is insufficient, and meanwhile, the real-time performance of the validity period of the DHCP address pool is insufficient.
Disclosure of Invention
The embodiment of the invention provides an IP address recovery method and system, a DHCP repeater and a DHCP server. The DHCP repeater determines the client which is not on line by receiving the address distribution table sent by the DHCP server to generate a corresponding address release table, so that the load of the DHCP repeater can be reduced, and the equipment can not be in a high-load state due to the simultaneous generation of a large number of messages when being attacked by DHCP.
The embodiment of the invention provides an IP address recovery method, which comprises the following steps: the method comprises the steps that a DHCP repeater receives an address allocation table sent by a DHCP server, wherein the address allocation table comprises an IP address allocated by the DHCP server through the DHCP repeater and a client address corresponding to the IP address; determining whether the client corresponding to the IP address in the address allocation table is online; recording an IP address corresponding to an offline client or the IP address and a client address corresponding to the IP address to generate an address release table; and sending the generated address release table to the DHCP server.
The embodiment of the invention provides an IP address recovery method, which comprises the following steps: the DHCP server generates an address allocation table corresponding to the DHCP repeater according to the identification information of the DHCP repeater to which the client applying for the IP address belongs; the address allocation table comprises an IP address allocated by the DHCP server through the DHCP repeater and a client address corresponding to the IP address; sending the address allocation table to the DHCP repeater; receiving an address release table generated according to an address allocation table returned by the DHCP repeater, wherein the address release table comprises an IP address to be released or the IP address to be released and a client address corresponding to the IP address to be released; and releasing the corresponding IP address according to the address release table.
An embodiment of the present invention provides a DHCP relay, which is characterized in that the DHCP relay includes:
the first receiving unit is used for receiving an address allocation table sent by a DHCP server, wherein the address allocation table comprises an IP address allocated by the DHCP server through the DHCP relay and a client address corresponding to the IP address;
an online determining unit, connected to the first receiving unit, for determining whether the client corresponding to the IP address in the address allocation table is online;
the address recording unit is connected with the online determining unit and is used for recording the IP address corresponding to the offline client determined by the online determining unit or the IP address and the client address corresponding to the IP address so as to generate an address release table;
and the first sending unit is connected with the address recording unit and used for sending the generated address release table to the DHCP server.
An embodiment of the present invention provides a DHCP server, including:
the information generating unit is used for generating an address allocation table corresponding to the DHCP repeater according to the identification information of the DHCP repeater to which the client applying for the IP address belongs; the address allocation table comprises an IP address allocated by the DHCP server through the DHCP repeater and a client address corresponding to the IP address;
a second sending unit connected to the information generating unit, for sending the address allocation table to the DHCP relay;
the second receiving unit is used for receiving an address release table which is returned by the DHCP repeater and generated according to the address allocation table, wherein the address release table comprises the IP address to be released or the IP address to be released and the client address corresponding to the IP address to be released;
and the address recovery unit is used for releasing the corresponding IP address according to the address release table received by the second receiving unit.
The embodiment of the invention has the advantages that the DHCP repeater determines the client which is not on line by receiving the address distribution table sent by the DHCP server to generate the corresponding address release table, so that the load of the DHCP repeater can be reduced, and the equipment can not be in a high-load state because a large number of messages are generated at the same time when the DHCP is attacked.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the principles of the invention. In the drawings:
fig. 1 is a flowchart of an IP address recovery method according to embodiment 1 of the present invention;
fig. 2 is a flowchart of an IP address recovery method according to embodiment 2 of the present invention;
fig. 3 is a flowchart of an IP address recovery method according to embodiment 3 of the present invention;
FIG. 4 is a flowchart of a method of determining whether to be online according to embodiment 3 of the present invention;
FIG. 5 is a topology composition diagram of an example of embodiment 3 of the present invention;
fig. 6 is a configuration diagram of a DHCP relay of embodiment 4 of the present invention;
FIG. 7 is a configuration diagram of an online determination unit of embodiment 5 of the present invention;
fig. 8 is a configuration diagram of a DHCP server of embodiment 6 of the present invention;
fig. 9 is a configuration diagram of a DHCP server of embodiment 7 of the present invention;
fig. 10 is a configuration diagram of an IP address recovery system according to embodiment 8 of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention are described in further detail below with reference to the accompanying drawings. The exemplary embodiments and descriptions of the present invention are provided to explain the present invention, but not to limit the present invention.
Example 1
An embodiment of the present invention provides an IP address recovery method, as shown in fig. 1, the method includes:
102, the DHCP repeater determines whether the client corresponding to the IP address in the address allocation table is online;
103, the DHCP repeater records the IP address corresponding to the client which is not on line or the IP address and the client address corresponding to the IP address to generate an address release table;
In this embodiment, the address allocation table may include one or more entries. The client address may be a Media Access Control (MAC) address of the client to identify the client.
In this embodiment, the DHCP relay may sequentially select one IP address in the address allocation table, and if it is determined that the client corresponding to the IP address is not online, the DHCP relay records the IP address or the IP address and the client address corresponding to the IP address to generate an address release table.
It can be known from the above embodiments that the DHCP relay determines the offline client to generate the corresponding address release table by receiving the address allocation table sent by the DHCP server, and does not need to snoop the messages between the DHCP client and the DHCP server and extract the key fields in the messages to create the corresponding entries, nor needs to periodically poll all the IP addresses, so that the load of the DHCP relay can be reduced, the real-time performance of the IP addresses can be increased, and the device is not in a high-load state due to the simultaneous generation of a large number of messages when being attacked by DHCP.
Example 2
An embodiment of the present invention provides an IP address recovery method, as shown in fig. 2, the method includes:
In this embodiment, when a client applies for an IP address to a DHCP server through a DHCP relay, the DHCP server allocates an IP address to the DHCP client through the DHCP relay, and records the allocated IP address, identification information of the DHCP relay applying for the IP address, and an address of the DHCP client.
In this way, in this embodiment, when the DHCP server receives an instruction to generate an address allocation table or the DHCP server determines that the preset address update time is reached, the IP address allocated by the DHCP relay and the client address corresponding to each IP address may be extracted according to the identification information of the DHCP relay to generate the address allocation table corresponding to the DHCP relay. Therefore, for the DHCP relay which does not apply for an IP address for the client in the area to which the DHCP relay belongs, it is not necessary to generate an address assignment table, and the load on the DHCP server can be reduced. In addition, under the condition that a large number of allocated IP addresses exist in the DHCP server, the IP addresses do not need to be detected simultaneously, and corresponding address allocation tables are generated aiming at different DHCP repeaters, so that the condition that the load of the DHCP server suddenly increases is avoided.
In this embodiment, after receiving the address release table returned by the DHCP relay, the DHCP server may release the corresponding IP address according to the address release table, and timely recover the unused IP address.
According to the embodiment, the address allocation table corresponding to the DHCP repeater is generated by the DHCP server, so that the load of the DHCP repeater can be reduced; by receiving the address release table returned by the DHCP repeater, unused IP addresses can be timely recovered according to the address release table, and the instantaneity of the IP addresses in the address pool of the DHCP server is improved.
Example 3
An embodiment of the present invention provides an IP address recovery method, and details of the process are described below with reference to fig. 3, 4, and 5.
As shown in fig. 3, the method includes:
in this embodiment, the identification information of the DHCP relay may be an IP address of the DHCP relay, or information such as a name of the DHCP relay; the address of the client may be a MAC address of the client, but is not limited thereto, and may also be other information identifying the client;
in this embodiment, the DHCP server may record other information, for example, information such as Lease duration (Lease Expiration), Client Identifier (Client Identifier), Type (Type), address update Time (Refresh Time) of the IP address, in addition to the allocated IP address, the Client address corresponding to the IP address, and the identification information of the DHCP relay, as shown in table 1. The type refers to a mode of allocating an address, and can include a static allocation mode and an automatic allocation mode; the address update time indicates a time that triggers the DHCP server to generate an address allocation table. As shown in table 1, the relevant information recorded for the DHCP server.
TABLE 1
IP address (IPAddress) | Hardware address (MacAddress) | Client identifier (ClientIdentifier) | Lease (LeaseExpiration) | Type (Type) | DHCP repeater identification information (DHCP Relay) | Address update time (RefreshTime) |
wherein the DHCP server may set the address update time by a timer, for example, to 15 minutes; in this embodiment, if there are an allocated IP address corresponding to the DHCP relay and a client address corresponding to the IP address to be recorded within the address update time, the address update time does not need to be set.
as shown in table 2, a table is allocated for the address corresponding to the DHCP relay.
TABLE 2
IP Address (IP Address) | Hardware Address (Mac Address) |
In this embodiment, because the time for setting the address update time corresponding to each DHCP relay is different, when there are IP addresses applied by different and numerous DHCP relays in the DHCP server, the address allocation tables corresponding to the DHCP relays are not generated at the same time, and a situation that the load of the DHCP server suddenly increases in the DHCP address update period is avoided. In addition, for the DHCP repeater which does not apply for the IP address for the client terminal of the area, the address allocation table does not need to be generated, and the load of the DHCP server can be reduced.
in this embodiment, the address assignment table may be sent via a DHCP information message.
in this embodiment, after receiving the DHCP information message, the DHCP relay may parse the DHCP information message and extract an address allocation table corresponding to the DHCP relay sent by the DHCP server.
Step 307, the DHCP relay determines whether the client corresponding to the IP address in the address allocation table is online;
in this embodiment, determining whether the client corresponding to the IP address is online may be performed in various ways, and may be implemented by comparing the address allocation table with an address resolution protocol ARP table of the DHCP relay. But is not limited to this, and other ways may be adopted according to the actual situation.
in this embodiment, each entry of the address release table includes an IP address to be released; or the IP address to be released and the client address corresponding to the IP address are included.
in this embodiment, the DHCP relay may send the DHCP server through a DHCP information response message.
in this embodiment, after receiving the DHCP information response message, the DHCP server may extract an address release table from the DHCP information response message, and release and reset the IP address recorded in the address release table to an allocable state.
In step 307, the DHCP relay may probe the entries in the address allocation table one by one to determine whether the client corresponding to the IP address is online. Step 307 will be described in detail below with reference to fig. 4, taking as an example a manner of comparing the address allocation table with the address resolution protocol ARP table of the DHCP relay.
As shown in fig. 4, the process includes:
in step 401, the DHCP relay selects an IP address from the address allocation table.
in this embodiment, the DHCP relay may send an ARP request message whose destination address is the IP address, but the present invention is not limited thereto, and other detection methods may be adopted according to the actual situation, for example, sending an ICMP request message for internet information control protocol to perform detection.
In step 407, the DHCP relay determines that the IP address is not online.
In this embodiment, after sending the ARP request message in step 404, if an ARP reply message returned according to the ARP request message is received within a preset time, the DHCP relay may store the client address corresponding to the IP address carried in the ARP reply message in the ARP table.
As can be seen from the above embodiments, when the DHCP server allocates an IP address to a client through a DHCP relay, the allocated IP address, the client address corresponding to the IP address, and the address of the DHCP relay may be recorded, and an address update time may be set through a timer, and when the DHCP server determines that the address update time is reached, an address allocation table may be generated.
In addition, the address allocation table can be generated manually, namely when the DHCP server receives an instruction for generating the address allocation table, the address allocation table can be generated, so that the generation of the address allocation table for the DHCP server is triggered as required, and the flexibility is improved.
The following describes the whole process of IP address recovery by using an example in which the timer sets the address update time to trigger generation of the address allocation table, with reference to fig. 5.
As shown in fig. 5, a DHCP Server is included in the network environment; three DHCP relays Relay1, Relay2, and Relay 3; eight client PCs 1-PC 8. Since the eight clients all obtain addresses through the same DHCP server, there is recorded information in the DHCP server that the corresponding IP address has been allocated.
When the initial time t is 0, the DHCP server allocates an IP address to the client PC1 through the DHCP Relay1, at this time, the DHCP server sets a timer for the Relay1, and the preset address update time RefreshTime is 15 minutes, then the relevant information recorded by the DHCP server at this time is as shown in the following table:
TABLE 3
IPaddress | Hardwareaddress | Client-Identifier | Leaseexpiration | Type | DHCPRelay | Refreshtime |
IP 1 | Mac 1 | ID 1 | XX | Automatic | Relay1 | 15 |
Within 5 minutes, the DHCP server has allocated IP addresses to the clients PC2, PC3, PC4, PC5, PC6, PC7 via Relay 1. Where the address of PC7 is statically assigned in the DHCP server and the other PCs are dynamically assigned in the DHCP server. When the IP addresses are allocated to these clients, the address update time corresponding to Relay1 is not exceeded, and therefore, the address update time does not need to be reset.
When t is 5, the DHCP server acquires an IP address for the client PC8 through the DHCP Relay3, and sets a timer for the Relay3, presetting an address update time. Thus, at time t-5, the DHCP server records the following related information:
TABLE 4
IPaddress | Hardwareaddress | Client-Identifier | Leaseexpirati on | Type | DHCPRelay | Refreshtime |
IP 1 | Mac 1 | ID 1 | XX | Automatic | Relay1 | 10 |
IP 2 | Mac 2 | ID 2 | XX | Automatic | Relay1 | 10 |
IP 3 | Mac 3 | ID 3 | XX | Automatic | Relay1 | 10 |
IP 4 | Mac 4 | ID 4 | XX | Automatic | Relay1 | 10 |
IP 5 | Mac 5 | ID 5 | XX | Automatic | Relay1 | 10 |
IP 6 | Mac 6 | ID 6 | XX | Automatic | Relay1 | 10 |
IP 7 | Mac 7 | ID 7 | XX | Manual | Relay1 | 10 |
IP 8 | Mac 8 | ID 8 | XX | Automatic | Relay3 | 15 |
When t is 15, the address update time corresponding to the DHCP Relay1 arrives. At this time, the DHCP server is triggered to generate an address assignment table corresponding to the Relay 1.
The DHCP server extracts all recorded table entries related to Relay1 to form an address allocation table; wherein, the Lease duration (Lease duration) of the IP address in the address allocation table is a valid time. Thus, the IP1, IP2, IP3, IP4, IP5 and IP6 are eligible, and the address allocation table composed of these six entries is:
TABLE 5
IP address | Hardware address |
IP1 | Mac1 |
IP2 | Mac2 |
IP3 | Mac3 |
IP4 | Mac4 |
IP5 | Mac5 |
IP6 | Mac6 |
The DHCP server sends the address allocation table to a DHCP Relay Relay 1; wherein, the message can be sent through DHCP information.
After receiving the DHCP information message, the DHCP Relay1 extracts an address allocation table issued by the DHCP server, and compares the address allocation table with a local ARP table. As shown in table 6, which is a local ARP table:
TABLE 6
IP address | Hardware address |
IP 1 | Mac1 |
IP 2 | Mac12 |
IP 3 | Mac13 |
IP 100 | Mac100 |
The DHCP Relay1 compares the IP addresses in the address allocation table one by one, and sends an ARP request to the corresponding IP address to detect, the specific process is as follows:
(1) relay1 selects IP1 from the address assignment table. When the Relay1 determines that the IP1 exists in the ARP table, the client address corresponding to the IP1 in the address allocation table is Mac1, and the client address corresponding to the IP1 in the ARP table is also Mac 1; therefore, Relay1 does nothing and continues to select the next IP address.
(2) Relay1 selects IP2 from the address assignment table. When the Relay1 determines that the IP2 exists in the ARP table, the client address corresponding to the IP2 in the address allocation table is Mac2, and the client address corresponding to the IP2 in the ARP table is Mac12, which are different from each other; the Relay1 initiates an ARP request detection to the IP2, and the destination IP address of the ARP detection message is IP 2; after receiving the ARP detection message, the PC2 responds to the ARP request within a preset time, and the responded address information is Mac 2; the Relay1 updates the ARP table thereof according to the received ARP response message, and the corresponding address information of the IP2 in the ARP table is updated to Mac 2; meanwhile, the Relay1 further determines that the client addresses corresponding to the IP2 in the address allocation table and the ARP response message are Mac 2; therefore, Relay1 continues to pick the next IP address.
(3) Relay1 selects IP3 from the address assignment table. When the Relay1 determines that the IP3 exists in the ARP table, the client address corresponding to the IP3 in the address allocation table is Mac3, and the client address corresponding to the IP2 in the ARP table is Mac13, which are different from each other; the Relay1 initiates an ARP request detection to the IP3, and the destination IP address of the ARP detection message is IP 3; after receiving the ARP detection message, the PC3 responds to the ARP request within a preset time, and the responded address information is Mac 13; the Relay1 updates the ARP table thereof according to the received ARP response message, and the corresponding address information of the IP3 in the ARP table is updated to Mac 13; meanwhile, the Relay1 further determines that the client address Mac3 corresponding to the IP3 in the address allocation table is different from the client address Mac13 corresponding to the ARP response message; therefore, Relay1 adds the entry corresponding to IP3 to the address release table.
(4) Relay1 selects IP4 from the address assignment table. When the Relay1 determines that the IP4 does not exist in the ARP table, the Relay1 initiates an ARP request detection to the IP4, and the target IP address of the ARP detection message is IP 4; after receiving the ARP detection message, the PC4 responds to the ARP request within a preset time, and the responded address information is Mac 4; the Relay1 updates the ARP table thereof according to the received ARP response message, and adds the IP4 and the corresponding address information Mac4 into the ARP table; meanwhile, the Relay1 further determines that the client addresses corresponding to the IP4 in the address allocation table and the ARP response message are Mac 4; therefore, Relay1 continues to pick the next IP address.
(5) Relay1 selects IP5 from the address assignment table. When the Relay1 determines that the IP5 does not exist in the ARP table, the Relay1 initiates an ARP request detection to the IP5, and the target IP address of the ARP detection message is IP 5; after receiving the ARP detection message, the PC5 responds to the ARP request within a preset time, and the responded address information is Mac 15; the Relay1 updates the ARP table thereof according to the received ARP response message, and adds the IP5 and the corresponding address information Mac15 into the ARP table; then, the Relay1 further determines that the client address Mac5 corresponding to the IP5 in the address allocation table is different from the client address Mac15 corresponding to the ARP table; therefore, Relay1 adds the entry corresponding to IP5 to the address release table.
(6) Relay1 selects IP6 from the address assignment table. When the Relay1 determines that the IP6 does not exist in the ARP table, the Relay1 initiates an ARP request detection to the IP6, and the target IP address of the ARP detection message is IP 6; the Relay1 does not receive the response of the ARP request within the preset time; therefore, Relay1 adds the entry corresponding to IP6 to the address release table.
After the above process is completed, the local ARP table of the DHCP Relay1 is updated as follows:
TABLE 7
IP address | Hardware address |
IP 1 | Mac1 |
IP 2 | Mac2 |
IP 3 | Mac13 |
IP 4 | Mac4 |
IP 5 | Mac15 |
IP 100 | Mac100 |
The address release table generated is as follows:
TABLE 8
IP address | Hardware address |
IP 3 | Mac3 |
IP 5 | Mac5 |
IP 6 | Mac6 |
The DHCP Relay1 constructs a DHCP information response message according to the address release table, and sends the DHCP information response message to the DHCP server. After receiving the DHCP information response message returned by the DHCP Relay1, the DHCP server can confirm that the IP3, IP5, and IP6 are no longer used, and release the DHCP message. At the same Time, the DHCP server sets the Refresh Time value associated with Relay1 back to the initial value for 15 minutes. The updated relevant information recorded by the DHCP server is as follows:
TABLE 9
IP address | Hardwareaddress | Client-Identifier | Leaseexpiration | Type | DHCPrelay | Refreshtime |
Ip 1 | Mac 1 | ID 1 | XX | Automatic | Relay1 | 15 |
Ip 2 | Mac 2 | ID 2 | XX | Automatic | Relay1 | 15 |
Ip 4 | Mac 4 | ID 4 | XX | Automatic | Relay1 | 15 |
Ip 7 | Mac 7 | ID 7 | XX | Manual | Relay1 | 15 |
Ip 8 | Mac 8 | ID 8 | XX | Automatic | Relay3 | 5 |
At this time, in the DHCP address pool, IP3, IP5, and IP6 have been released and can be reassigned to the client applying for the IP address.
Furthermore, when necessary, the administrator may directly send an instruction on the DHCP server, and manually cause the DHCP server to trigger generation of the address allocation table corresponding to the DHCP relay without waiting for the address update time to arrive.
According to the embodiment, the address allocation table corresponding to the DHCP repeater is generated by the DHCP server and is sent to the DHCP repeater, and the DHCP repeater is not required to snoop the message between the DHCP server and the client, so that the load of the DHCP repeater can be reduced; the DHCP repeater can determine whether the client corresponding to the IP address in the address distribution table is on line or not according to the ARP table without periodically polling all the IP addresses, so that the load of the DHCP repeater can be further reduced, the instantaneity of the IP address is increased, and the equipment is not in a high-load state due to the fact that a large number of messages are generated simultaneously when the DHCP repeater is attacked.
Example 4
An embodiment of the present invention provides a DHCP relay, as shown in fig. 6, where the DHCP relay includes: a first receiving unit 601, an online determination unit 602, an address recording unit 603, and a first transmitting unit 604;
the first receiving unit 601 is configured to receive an address allocation table sent by a DHCP server, where the address allocation table includes an IP address allocated by the DHCP server through the DHCP relay and a client address corresponding to the IP address; the online determining unit 602 is connected to the first receiving unit 601, and is configured to determine whether a client corresponding to the IP address in the address allocation table is online; the address recording unit 603 is connected to the online determining unit 602, and is configured to record the IP address corresponding to the offline client determined by the online determining unit 602, or the IP address and the client address corresponding to the IP address, so as to generate an address release table; the first sending unit 604 is connected to the address recording unit 603, and is configured to send the generated address release table to the DHCP server.
In this embodiment, the working procedure of the DHCP relay may be as described in embodiment 1, and is not described herein again.
It can be known from the above embodiments that the DHCP relay determines the offline client to generate the corresponding address release table by receiving the address allocation table sent by the DHCP server, and does not need to snoop the messages between the DHCP client and the DHCP server and extract the key fields in the messages to create the corresponding entries, nor needs to periodically poll all the IP addresses, so that the load of the DHCP relay can be reduced, the real-time performance of the IP addresses can be increased, and the device is not in a high-load state due to the simultaneous generation of a large number of messages when being attacked by DHCP.
Example 5
An embodiment of the present invention provides a DHCP relay, including: a first receiving unit 601, an online determination unit 602, an address recording unit 603, and a first transmitting unit 604; as described in embodiment 4, the description is omitted here.
In the present embodiment, as shown in fig. 7, the online determination unit 602 includes: a first determining unit 701, a message sending unit 702, a second determining unit 703 and a third determining unit 704; wherein,
the first determining unit 701 is configured to determine whether an IP address in an address allocation table exists in a pre-stored address resolution protocol ARP table; the message sending unit 702 is connected to the first determining unit 701, and is configured to send an ARP request message using an IP address in the address allocation table as a destination address when the first determining unit 701 determines that the IP address in the address allocation table does not exist in the ARP table; the second determining unit 703 is configured to determine whether an ARP reply message returned according to the ARP request message is received within a preset time; the third determining unit 704 is configured to determine that the client corresponding to the IP address is not online when the second determining unit 703 determines that the ARP reply message returned according to the ARP request message is not received within the preset time.
In this embodiment, the online determining unit 602 further includes: a fourth determination unit 705; the fourth determining unit 705 is configured to, when the first determining unit 701 determines that the IP address in the address allocation table exists in the address resolution protocol ARP table, further determine whether the client address corresponding to the IP address is the same as the client address corresponding to the IP address in the address resolution protocol ARP table; the message sending unit 702 is further configured to send an ARP request message using the IP address in the address allocation table as the destination address when the fourth determining unit 705 determines that the client address corresponding to the IP address is different from the client address corresponding to the IP address in the ARP table.
As shown in fig. 7, the online determination unit 602 further includes: a fifth determining unit 706 and a sixth determining unit 707; the fifth determining unit 706 is configured to determine, when the second determining unit 703 determines that an ARP reply message carrying a client address corresponding to an IP address and returned according to the ARP request message is received within a preset time, whether a client address corresponding to the IP address in the address allocation table is consistent with a client address corresponding to the IP address carried in the ARP reply message; the sixth determining unit 707 is configured to determine that the client corresponding to the IP address in the address allocation table is not online when the fifth determining unit 706 determines that the client corresponding to the IP address in the address allocation table is inconsistent with the client corresponding to the IP address carried in the address resolution protocol ARP reply message.
As shown in fig. 7, the DHCP relay further includes: a storage unit 708; the storage unit 708 is configured to store the client address corresponding to the IP address carried in the ARP reply message in an ARP table.
It can be known from the above embodiments that the DHCP relay determines the offline client to generate the corresponding address release table by receiving the address allocation table sent by the DHCP server, and does not need to snoop the messages between the DHCP client and the DHCP server and extract the key fields in the messages to create the corresponding entries, nor needs to periodically poll all the IP addresses, so that the load of the DHCP relay can be reduced, the real-time performance of the IP addresses can be increased, and the device is not in a high-load state due to the simultaneous generation of a large number of messages when being attacked by DHCP.
Example 6
An embodiment of the present invention provides a DHCP server, as shown in fig. 8, where the DHCP server includes: an information generation unit 801, a second transmission unit 802, a second reception unit 803, and an address recovery unit 804; wherein,
the information generating unit 801 is configured to generate an address allocation table corresponding to a DHCP relay according to identification information of the DHCP relay to which a client applying for an IP address belongs; the address allocation table comprises IP addresses allocated by the DHCP repeater and client addresses corresponding to the IP addresses; the second sending unit 802 is connected to the information generating unit 801, and is configured to send an address assignment table to the DHCP relay; the second receiving unit 803 is configured to receive an address release table generated according to the address allocation table and returned by the DHCP relay, where the address release table includes an IP address to be released or the IP address to be released and a client address corresponding to the IP address to be released; the address recovery unit 804 is connected to the second receiving unit 803, and is configured to release the corresponding IP address according to the address release table received by the second receiving unit 803.
In this embodiment, the working flow of the DHCP server may be as described in embodiment 2, and is not described herein again.
According to the embodiment, the address allocation table corresponding to the DHCP repeater is generated by the DHCP server, so that the load of the DHCP repeater can be reduced; by receiving the address release table returned by the DHCP repeater, unused IP addresses can be timely recovered according to the address release table, and the instantaneity of the IP addresses in the address pool of the DHCP server is improved.
Example 7
An embodiment of the present invention provides a DHCP server, as shown in fig. 9, where the DHCP server includes: an information generation unit 901, a second transmission unit 902, a second reception unit 903, and an address recovery unit 904; as described in example 6, the description is omitted here.
As shown in fig. 9, the DHCP server further includes: an address assignment unit 905 and an information recording unit 906; the address allocation unit 905 is configured to allocate an IP address to the client through the DHCP relay; the information recording unit 906 is configured to record the allocated IP address, identification information of a DHCP relay to which the client applying for the IP address belongs, and an address of the client.
According to the embodiment, the address allocation table corresponding to the DHCP repeater is generated by the DHCP server, so that the load of the DHCP repeater can be reduced; by receiving the address release table returned by the DHCP repeater, unused IP addresses can be timely recovered according to the address release table, and the instantaneity of the IP addresses in the address pool of the DHCP server is improved.
Example 8
An embodiment of the present invention provides an IP address recovery system, as shown in fig. 10, where the IP address recovery system includes: a DHCP server 1001 and a DHCP relay 1002.
In this embodiment, the DHCP server 1001 may be the DHCP server described in embodiment 6 or 7; the DHCP relay 1002 may be the DHCP relay described in embodiment 4 or 5; and will not be described in detail herein.
In this embodiment, as shown in fig. 10, the IP address recovery system further includes a client 1003; the DHCP server 1001 assigns an IP address to the client 1003 through the DHCP relay 1002.
In this embodiment, the working flow of the IP address recovery system may be as described in embodiment 3, and is not described herein again.
According to the embodiment, the address allocation table corresponding to the DHCP repeater is generated by the DHCP server and is sent to the DHCP repeater, and the DHCP repeater is not required to snoop the message between the DHCP server and the client, so that the load of the DHCP repeater can be reduced; the DHCP repeater can determine whether the client corresponding to the IP address in the address distribution table is on line or not according to the ARP table without periodically polling all the IP addresses, so that the load of the DHCP repeater can be further reduced, the instantaneity of the IP address is increased, and the equipment is not in a high-load state due to the fact that a large number of messages are generated simultaneously when the DHCP repeater is attacked.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied in hardware, a software module executed by a processor, or a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are merely exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.
Claims (18)
1. An IP address recovery method, the method comprising:
a DHCP repeater receives an address allocation table sent by a DHCP server, wherein the address allocation table comprises an IP address allocated by the DHCP server through the DHCP repeater and a client address corresponding to the IP address;
determining whether a client corresponding to the IP address in the address allocation table is online;
recording an IP address corresponding to an offline client or the IP address and a client address corresponding to the IP address to generate an address release table;
and sending the generated address release table to the DHCP server.
2. The method of claim 1, wherein the determining whether the client corresponding to the IP address in the address allocation table is online comprises:
determining whether the IP address in the address allocation table exists in a pre-stored Address Resolution Protocol (ARP) table;
if the IP address in the address distribution table is determined not to exist in the ARP table, the IP address in the address distribution table is used as a destination address to send an ARP request message;
and if the ARP response message returned according to the ARP request message is not received within the preset time, determining that the client corresponding to the IP address is not on-line.
3. The method according to claim 2, wherein if it is determined that the IP address in the address allocation table exists in the ARP table, further determining whether the client address corresponding to the IP address is the same as the client address corresponding to the IP address in the ARP table;
if the client address corresponding to the IP address is different from the client address corresponding to the IP address in the ARP table, the IP address in the address distribution table is used as a destination address to send an ARP request message;
and if the ARP response message returned according to the ARP request message is not received within the preset time, determining that the client corresponding to the IP address is not on-line.
4. A method according to claim 2 or 3, characterized in that the method further comprises:
if an address resolution protocol ARP response message which is returned according to the ARP request message and carries the client address corresponding to the IP address is received within preset time, determining whether the client address corresponding to the IP address in the address distribution table is consistent with the client address corresponding to the IP address carried by the ARP response message;
and if the client address corresponding to the IP address in the address allocation table is not consistent with the client address corresponding to the IP address carried by the ARP response message, determining that the client corresponding to the IP address in the address allocation table is not online.
5. The method according to claim 4, wherein when an ARP reply message carrying a client address corresponding to the IP address and returned according to the ARP request message is received within a preset time, the method further comprises: and storing the IP address and the client address corresponding to the IP address carried by the ARP response message in an ARP table.
6. An IP address recovery method, the method comprising:
the DHCP server generates an address allocation table corresponding to the DHCP repeater according to the identification information of the DHCP repeater to which the client applying for the IP address belongs; the address allocation table comprises an IP address allocated by the DHCP server through the DHCP repeater and a client address corresponding to the IP address;
sending the address allocation table to the DHCP repeater;
receiving an address release table generated according to the address allocation table and returned by the DHCP repeater, wherein the address release table comprises an IP address to be released or the IP address to be released and a client address corresponding to the IP address to be released;
and releasing the corresponding IP address according to the address release table.
7. The method according to claim 6, wherein before the DHCP server generates the address allocation table corresponding to the DHCP relay according to the identification information of the DHCP relay to which the client applying for the IP address belongs, the method comprises:
the DHCP server distributes an IP address for the client through the DHCP repeater;
and recording the allocated IP address, the identification information of the DHCP repeater to which the client applying for the IP address belongs and the address of the client.
8. The method of claim 6, wherein the DHCP server generates an address allocation table corresponding to the DHCP relay according to the DHCP relay to which the client applying for the IP address belongs, and the method includes:
and when the DHCP server receives an instruction for generating an address allocation table or determines that the preset address updating time is reached, the DHCP server generates the address allocation table corresponding to the DHCP relay according to the identification information of the DHCP relay to which the client applying for the IP address belongs.
9. A DHCP repeater, comprising:
the first receiving unit is used for receiving an address allocation table sent by a DHCP server, wherein the address allocation table comprises an IP address allocated by the DHCP server through the DHCP relay and a client address corresponding to the IP address;
an online determining unit, connected to the first receiving unit, configured to determine whether a client corresponding to the IP address in the address allocation table is online;
the address recording unit is connected with the online determining unit and is used for recording the IP address corresponding to the offline client determined by the online determining unit or the IP address and the client address corresponding to the IP address so as to generate an address release table;
and the first sending unit is connected with the address recording unit and used for sending the generated address release table to the DHCP server.
10. The DHCP relay of claim 9, wherein the online determination unit comprises:
a first determination unit, configured to determine whether an IP address in the address allocation table exists in a pre-stored Address Resolution Protocol (ARP) table;
the message sending unit is connected with the first determining unit and used for sending an ARP request message by taking the IP address in the address distribution table as a destination address when the first determining unit determines that the IP address in the address distribution table does not exist in the ARP table;
a second determining unit, configured to determine whether an ARP reply message returned according to the ARP request message is received within a preset time;
and the third determining unit is used for determining that the client corresponding to the IP address is not on line when the second determining unit determines that the ARP response message returned according to the ARP request message is not received within the preset time.
11. The DHCP relay of claim 10, wherein the online determination unit further comprises:
a fourth determining unit, configured to further determine whether a client address corresponding to the IP address is the same as a client address corresponding to the IP address in the ARP table when the first determining unit determines that the IP address in the ARP table exists in the ARP table;
the message sending unit is further configured to send an ARP request message using the IP address in the address allocation table as a destination address when the fourth determining unit determines that the client address corresponding to the IP address is different from the client address corresponding to the IP address in the ARP table.
12. The DHCP relay according to claim 10 or 11, wherein the online determining unit further includes:
a fifth determining unit, configured to determine, when the second determining unit determines that an ARP reply packet carrying a client address corresponding to the IP address and returned according to the ARP request packet is received within a preset time, whether a client address corresponding to the IP address in the address allocation table is consistent with a client address corresponding to the IP address carried in the ARP reply packet;
and the sixth determining unit is used for determining that the client corresponding to the IP address in the address allocation table is not online when the fifth determining unit determines that the client corresponding to the IP address in the address allocation table is inconsistent with the client corresponding to the IP address carried in the ARP response message.
13. The DHCP relay of claim 12, wherein the DHCP relay further comprises:
and the storage unit is used for storing the client address corresponding to the IP address carried by the ARP response message in the ARP table.
14. A DHCP server, comprising:
the information generating unit is used for generating an address allocation table corresponding to the DHCP repeater according to the identification information of the DHCP repeater to which the client applying for the IP address belongs; the address allocation table comprises an IP address allocated by the DHCP server through the DHCP repeater and a client address corresponding to the IP address;
a second sending unit, connected to the information generating unit, for sending the address allocation table to the DHCP relay;
a second receiving unit, configured to receive an address release table generated according to the address allocation table and returned by the DHCP relay, where the address release table includes an IP address to be released, or the IP address to be released and a client address corresponding to the IP address to be released;
and the address recovery unit is used for releasing the corresponding IP address according to the address release table received by the second receiving unit.
15. The DHCP server of claim 14, wherein the DHCP server further comprises: the address allocation unit is used for allocating an IP address to the client through the DHCP repeater;
and the information recording unit is used for recording the allocated IP address, the identification information of the DHCP repeater to which the client applying for the IP address belongs and the address of the client.
16. An IP address recovery system, comprising a DHCP relay, the DHCP relay comprising:
the first receiving unit is used for receiving an address allocation table sent by a DHCP server, wherein the address allocation table comprises an IP address allocated by the DHCP server through the DHCP relay and a client address corresponding to the IP address;
an online determining unit, connected to the first receiving unit, configured to determine whether a client corresponding to the IP address in the address allocation table is online;
the address recording unit is connected with the online determining unit and is used for recording the IP address corresponding to the offline client determined by the online determining unit or the IP address and the client address corresponding to the IP address so as to generate an address release table;
and the first sending unit is connected with the address recording unit and used for sending the generated address release table to the DHCP server.
17. The IP address recovery system according to claim 16, wherein the DHCP relay is any one of the DHCP relays according to claim 10 to claim 13.
18. The IP address recovery system according to claim 16, further comprising the DHCP server according to claim 14 or 15.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2009102216495A CN101795300B (en) | 2009-11-11 | 2009-11-11 | IP (Internet Protocol) address recovery method and system, as well as DHCP (Dynamic Host Configuration Protocol) repeater and DHCP server |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2009102216495A CN101795300B (en) | 2009-11-11 | 2009-11-11 | IP (Internet Protocol) address recovery method and system, as well as DHCP (Dynamic Host Configuration Protocol) repeater and DHCP server |
Publications (2)
Publication Number | Publication Date |
---|---|
CN101795300A CN101795300A (en) | 2010-08-04 |
CN101795300B true CN101795300B (en) | 2012-07-25 |
Family
ID=42587723
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2009102216495A Expired - Fee Related CN101795300B (en) | 2009-11-11 | 2009-11-11 | IP (Internet Protocol) address recovery method and system, as well as DHCP (Dynamic Host Configuration Protocol) repeater and DHCP server |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101795300B (en) |
Families Citing this family (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9379974B2 (en) | 2011-03-29 | 2016-06-28 | Panasonic Corporation | Transfer control device, integrated circuit thereof, transfer control method, and transfer control system |
CN103516766B (en) * | 2012-06-30 | 2017-04-19 | 北京神州泰岳软件股份有限公司 | Method and system of communication between client-side and application server |
CN104158917B (en) * | 2013-05-14 | 2017-12-15 | 新华三技术有限公司 | Reclaim the method and apparatus of the IP address at dhcp client end |
CN104253874B (en) * | 2013-06-27 | 2018-12-25 | 华为技术有限公司 | A kind of methods, devices and systems that message sends and handles |
CN103428308B (en) * | 2013-08-13 | 2016-12-28 | 杭州华三通信技术有限公司 | Assist the method and device of the safe list item of DHCP relay refresh address |
CN104519145A (en) * | 2013-09-26 | 2015-04-15 | 华为技术有限公司 | An address resource managing method, system and DHCP server |
CN103957288A (en) * | 2014-04-28 | 2014-07-30 | 福建星网锐捷网络有限公司 | Method, device and equipment for IP address dynamic allocation |
CN106331185B (en) * | 2015-06-17 | 2020-03-10 | 中兴通讯股份有限公司 | Method and device for recovering IP address |
CN105959282A (en) | 2016-04-28 | 2016-09-21 | 杭州迪普科技有限公司 | Protection method and device for DHCP attack |
CN107517138A (en) * | 2016-06-16 | 2017-12-26 | 中兴通讯股份有限公司 | Equipment detection method and device |
CN106487948A (en) * | 2016-12-26 | 2017-03-08 | 上海斐讯数据通信技术有限公司 | A kind of DHCP service management system and DHCP service management method |
CN106936942A (en) * | 2017-03-07 | 2017-07-07 | 迈普通信技术股份有限公司 | A kind of dhcp address recovery system and method |
CN108712522B (en) * | 2018-07-20 | 2021-06-29 | 新华三技术有限公司 | IP address allocation method and device |
CN111339099B (en) * | 2020-02-27 | 2023-08-25 | 紫光云技术有限公司 | Concurrent IP distribution method based on database optimistic lock |
CN114727278B (en) * | 2022-04-19 | 2023-07-28 | 广州爱浦路网络技术有限公司 | Address changing method and device for single NRF network element |
CN115987611A (en) * | 2022-12-20 | 2023-04-18 | 新华三技术有限公司 | Information updating method and device, electronic equipment and storage medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1744612A (en) * | 2005-08-19 | 2006-03-08 | 杭州华为三康技术有限公司 | DHCP address allocation method |
CN1859409A (en) * | 2006-03-17 | 2006-11-08 | 华为技术有限公司 | Method and system for improving network dynamic host configuration DHCP safety |
-
2009
- 2009-11-11 CN CN2009102216495A patent/CN101795300B/en not_active Expired - Fee Related
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1744612A (en) * | 2005-08-19 | 2006-03-08 | 杭州华为三康技术有限公司 | DHCP address allocation method |
CN1859409A (en) * | 2006-03-17 | 2006-11-08 | 华为技术有限公司 | Method and system for improving network dynamic host configuration DHCP safety |
Non-Patent Citations (1)
Title |
---|
JP特开2001-36550A 2001.02.09 |
Also Published As
Publication number | Publication date |
---|---|
CN101795300A (en) | 2010-08-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101795300B (en) | IP (Internet Protocol) address recovery method and system, as well as DHCP (Dynamic Host Configuration Protocol) repeater and DHCP server | |
JP4727537B2 (en) | Relay agent device and proxy address lending device | |
CN101534329B (en) | IP address allocation method and system | |
CN100490377C (en) | Method and arrangement for preventing illegitimate use of IP addresses | |
US6195706B1 (en) | Methods and apparatus for determining, verifying, and rediscovering network IP addresses | |
CN102118453B (en) | Method, service device, client and communication system for automatic configuration of IP address | |
US20100309813A1 (en) | Detection and support of a dual-stack capable host | |
CN101741702B (en) | Method and device for limiting broadcast of ARP request | |
CN100586106C (en) | Message processing method, system and equipment | |
CN101179566A (en) | A method and device for defending against ARP packet attacks | |
CN102685270A (en) | Method and equipment for distributing dynamic addresses | |
CN105245629A (en) | DHCP-based host communication method and device | |
CN102137109B (en) | Access control method, access equipment and system | |
CN102355510B (en) | Medium/media access control (MAC) address allocation method, device and system | |
CN102082835B (en) | Method and device for distributing IP (internet protocol) addresses | |
CN102594839B (en) | Method for distinguishing pseudo dynamic host configuration protocol (DHCP) servers and switchboards | |
US9992159B2 (en) | Communication information detecting device and communication information detecting method | |
CN101179515A (en) | Method and device for inhibiting black hole routing | |
CN100362800C (en) | A method for triggering user terminal online via data message | |
CN102413000A (en) | Client-side online method, DHCP server and network management system | |
CN106878481B (en) | Method, device and system for acquiring Internet Protocol (IP) address | |
CN102340555B (en) | Medium/media access control address allocation method, device and system | |
CN100525179C (en) | Method for preventing IP address leakage | |
CN102752414B (en) | Method and equipment for releasing Internet protocol (IP)v6 address | |
CN102333133A (en) | Medium access control (MAC) address distribution method, device and system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20120725 Termination date: 20151111 |
|
CF01 | Termination of patent right due to non-payment of annual fee |