Dynamic DNS synchronization method based on DHCP server

The DHCP server calculates the initial TTL when allocating IP addresses and embeds a DNS proxy module to monitor lease renewals and dynamically update or delete DNS records. This solves the problem of DNS records not being cleared in a timely manner after the client lease expires, reducing server load and resource usage.

CN120614342APending Publication Date: 2025-09-09INTERNET DOMAIN NAME SYST BEIJING ENG RES CENT
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510904583.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-01
Publication Date
2025-09-09

AI Technical Summary

Technical Problem

In the existing technology, when the client lease expires and is not renewed, the DNS record still exists, causing the domain name to be resolved to an invalid IP. In addition, when a large number of clients frequently go online and offline, a large number of zombie records exist in the DNS cache, occupying server resources.

Method used

The DHCP server calculates the initial TTL of the DNS record when allocating the IP, and calls the API interface to register the DNS record through the embedded DNS proxy module, monitors the client's renewal behavior, and dynamically updates or deletes the DNS record based on the lease status event to ensure the synchronization of the IP address lease period and the domain name resolution life cycle.

Benefits of technology

It achieves timely update and deletion of DNS records, avoids domain name resolution to invalid IP, and reduces server load and resource usage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120614342A_ABST
    Figure CN120614342A_ABST
Patent Text Reader

Abstract

The invention discloses a dynamic DNS (Domain Name Server) synchronization method based on a DHCP (Dynamic Host Configuration Protocol) server, and solves the problems that in the prior art, lease renewal is not performed after lease of a client expires, and DNS records still exist, so that a domain name is analyzed to a failed IP; and when a large number of clients are frequently online and offline, a large number of zombie records can exist in a DNS cache, so that server resources are occupied. When an IP address is allocated to a client through a DHCP server, an initial TTL of a DNS record is calculated, an API interface is called through an embedded DNS agent module to register the DNS record to a DNS server, and meanwhile, the TTL of the DNS record is set as the initial TTL; when the lease remaining time reaches a first preset value, the DHCP server monitors a lease renewing behavior of the client through the DNS agent module; and if the client succeeds in renewing the lease, updating the TTL recorded by the DNS in the DNS server to the initial TTL.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of DNS technology, and in particular to a dynamic DNS synchronization method. Background Art

[0002] In the prior art, the collaboration between DHCP and DNS is mainly achieved through the client actively reporting IP changes or the DHCP server triggering a static update of DNS records when allocating IP addresses.

[0003] Client actively reports: After obtaining the IP address, the client actively sends an update request to the DNS server to bind its own IP and domain name.

[0004] DHCP server-triggered static update: When allocating IP addresses, the DHCP server calls an API to register records with the DNS server. Once the records are generated, they do not change. This is an example of the DNS update function of the DHCP service on Huawei switches.

[0005] The existing technology has the following defects:

[0006] 1. If the client does not renew its lease after it expires, the DNS record will still exist, causing the domain name to resolve to an invalid IP address.

[0007] 2. When a large number of clients frequently go online and offline, there will be a large number of "zombie records" in the DNS cache, causing server resources to be occupied. Summary of the Invention

[0008] This application provides a dynamic DNS synchronization method based on a DHCP server and a DHCP server, aiming to solve the problem in the prior art that if a client lease expires and is not renewed, the DNS record still exists, resulting in the domain name being resolved to an invalid IP address; and when a large number of clients frequently go online and offline, a large number of "zombie records" will exist in the DNS cache, resulting in server resources being occupied.

[0009] In a first aspect, a dynamic DNS synchronization method based on a DHCP server is provided, comprising:

[0010] When the DHCP server assigns an IP address to a client, it calculates the initial TTL of the DNS record and calls the API interface through the embedded DNS proxy module to register the DNS record with the DNS server. At the same time, it sets the TTL of the DNS record to the initial TTL. The initial TTL = lease time * preset threshold.

[0011] When the remaining time of the lease reaches a first preset value, the DHCP server monitors the client's renewal behavior through the DNS proxy module; if the client successfully renews the lease, the TTL of the DNS record in the DNS server is updated to the initial TTL; if the client does not renew the lease, the DNS record is marked as high risk;

[0012] For DNS records marked as high-risk, when the remaining lease time reaches a second preset value, the client's renewal behavior is monitored again; if the client successfully renews the lease, the TTL of the DNS record is updated to the initial TTL; if the client does not renew the lease, the DNS record is deleted;

[0013] When the lease expires, if the client has not renewed the lease, the IP address will be reclaimed.

[0014] In the above solution, optionally, the DHCP server monitors the client's lease renewal behavior through the DNS proxy module, specifically including: if the DHCP server receives a DHCP REQUEST message sent by the client and replies to the client with a DHCPACK message to confirm the lease renewal, it indicates that the client has successfully renewed the lease; the DHCP server updates the TTL of the DNS record in the DNS server through the DNS proxy module; if the DHCP server does not detect the client's lease renewal request, it indicates that the client has not renewed the lease, and the DNS record is marked as high risk.

[0015] In the above solution, optionally, the DNS proxy module is embedded in the DHCP server and monitors the lease status events of the DHCP server to perform deterministic operations related to DNS records; wherein the lease status events include ACK events and RELEASE / EXPIRE events; the deterministic operations include: if the DNS proxy module monitors the ACK event, registering / updating the DNS record with the DNS server; if the DNS proxy module monitors the RELEASE / EXPIRE event, deleting the DNS record in the DNS server.

[0016] In the above solution, optionally, deleting the DNS record specifically includes: when the remaining lease time reaches a second preset value, the DHCP server does not detect the client's renewal request, then notifying the DNS proxy module that the client has not renewed the lease; the DNS proxy module calls the API to delete the corresponding DNS record in the DNS server.

[0017] In the above solution, optionally, the reclaiming of the IP address specifically includes: the client fails to renew the lease upon expiration and stops using the current IP address; the DHCP server reclaims the IP address and returns it to the address pool.

[0018] In the above solution, optionally, the preset threshold is 80%.

[0019] In the above solution, optionally, the first preset value is 50%; the second preset value is 12.5%.

[0020] In a second aspect, a DHCP server is provided, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the above method.

[0021] Compared with the prior art, this application has at least the following beneficial effects:

[0022] This application is based on further analysis and research of existing technical problems and recognizes that in the existing technology, if the client does not correctly implement the update logic, or the client does not renew the lease after expiration, the DNS record still exists, resulting in the domain name being resolved to an invalid IP; and when a large number of clients frequently go online and offline, there will be a large number of "zombie records" in the DNS cache, resulting in server resources being occupied. This application directly drives the generation, update and deletion of DNS records through DHCP lease status events (T1 / T2 / EXPIPE), achieves strict synchronization of IP address lease period and domain name resolution life cycle, solves the problem of resolution failure caused by DNS record failure to be deleted in time due to lease expiration; cleans up invalid DNS records from the source based on the event-driven mechanism, reduces server load and other technical problems. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 A system architecture diagram of a dynamic DNS synchronization method based on a DHCP server provided in one embodiment of the present application;

[0024] Figure 2 A flowchart of a dynamic DNS synchronization method based on a DHCP server is provided in one embodiment of the present application;

[0025] Figure 3 This is a timing diagram of a client successfully renewing a lease when the remaining lease time reaches a first preset value in one embodiment of the present application;

[0026] Figure 4 This is a timing diagram of a client successfully renewing a lease when the remaining lease time reaches a second preset value in one embodiment of the present application;

[0027] Figure 5 This is a timing diagram of an embodiment of the present application in which the client fails to successfully renew the lease within the lease time. DETAILED DESCRIPTION

[0028] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.

[0029] In the description of this application: Unless otherwise specified, the terms "first," "second," "third," etc. in this application are intended to distinguish the objects referred to and do not have any special meaning in terms of technical connotation (for example, they should not be understood as emphasizing the degree of importance or order, etc.). Expressions such as "including," "comprising," and "having" also mean "not limited to" (certain units, components, materials, steps, etc.).

[0030] The present invention aims to directly drive the generation, update and deletion of DNS records through DHCP lease status events (T1 / T2 / EXPIPE), achieve strict synchronization between IP address lease period and domain name resolution life cycle, and solve the technical problems such as resolution failure caused by failure to delete DNS records in time due to lease expiration; clean up invalid DNS records from the source based on event-driven mechanism, reduce server load, etc.

[0031] Figure 1 This is a system architecture diagram of a dynamic DNS synchronization method based on a DHCP server; now combined with Figure 1 Description of the system architecture:

[0032] About core component interactions:

[0033] 1. DHCP server: Address pool management: Dynamically allocate IP addresses; Lease state machine: Monitor IP lease period (T1 / T2 / EXPIRE phase).

[0034] 2. DNS proxy module: embedded in the DHCP server; receives lease state machine events; generates DNS operation instructions.

[0035] 3. DNS server: Domain name record database: stores domain name-IP mapping; domain name resolution engine: responds to client queries;

[0036] About key data flow (arrow direction):

[0037] 1. The device obtains an IP address through DHCP DISCOVER / REQUEST.

[0038] 2. The DNS proxy module sends three types of instructions to the DNS server: registration instructions (when IP is allocated), update instructions (T1 phase renewal detection), and deletion instructions (T2 / EXPIRE event).

[0039] 3. When the user queries, the DNS server returns real-time and valid resolution results.

[0040] In one embodiment, Figure 1 This application provides a dynamic DNS synchronization method based on a DHCP server. Figure 2 , including the following steps S1-S4.

[0041] In step S1, when the DHCP server assigns an IP address to the client, it calculates the initial TTL of the DNS record, and calls the API interface through the embedded DNS proxy module to register the DNS record with the DNS server, and sets the TTL of the DNS record to the initial TTL; wherein the initial TTL = lease time * preset threshold.

[0042] In one embodiment, the first preset value is 50%; the second preset value is 12.5%.

[0043] In one embodiment, the preset threshold is 80%.

[0044] In this embodiment, the preset threshold is set to 80%, that is, initial TTL = lease time * 80%; if the TTL of the DNS record and the DHCP lease time are exactly the same (for example, both are 8 hours), it may happen that: the DNS cache is not updated, but the IP is invalid: the client still uses the cached DNS record after the lease expires, resulting in access failure.

[0045] TTL = Lease × 80% (e.g. 8-hour lease → TTL = 6.4 hours):

[0046] The DNS record will expire 1.6 hours before the DHCP lease expires, so the client will be forced to re-query DNS before the lease expires to avoid using an expired IP.

[0047] When the TTL expires (after 6.4 hours), the client will query the DNS server again. At this time:

[0048] If the DHCP lease is renewed (the client is still active), the DNS record is updated and the TTL is recalculated.

[0049] If the DHCP lease is not renewed (the client is offline), the DNS record will be deleted to avoid returning an invalid IP.

[0050] Take the lease time as an example:

[0051] T = 0 hours (IP allocation), lease starts (8 hours), DNS record is created, TTL = 6.4 hours; client uses new IP.

[0052] T = 4 hours (T1 phase), 4 hours remaining in the lease, check for renewal requests. If the renewal is successful, maintain the DNS record and update the TTL to 6.4 hours; if the renewal is not successful, mark the DNS record as high risk, and the client remains active.

[0053] T = 6.4 hours, 1.6 hours remaining in the lease, the DNS record expires, and the client queries DNS again.

[0054] T=7 hours, 1 hour left in the lease (T2 phase), detect the renewal request, if the renewal is successful, maintain the DNS record and update the TTL=6.4 hours; if the lease is not renewed, the DNS record is deleted and the client cannot resolve to the old IP.

[0055] T = 8 hours, the lease expires (EXPIRE), the record is deleted (redundancy protection), and the IP is reclaimed.

[0056] In one embodiment, the DNS proxy module is embedded in the DHCP server and monitors the lease status events of the DHCP server to perform deterministic operations related to DNS records; wherein the lease status events include ACK events and RELEASE / EXPIRE events; the deterministic operations include: if the DNS proxy module monitors the ACK event, registering / updating the DNS record with the DNS server; if the DNS proxy module monitors the RELEASE / EXPIRE event, deleting the DNS record in the DNS server.

[0057] In this embodiment, the DNS proxy module logic:

[0058] Event monitoring: Capture ACK, RELEASE, and EXPIRE events from the DHCP server.

[0059] Operation execution: ACK event: Call the DNS API to register the record, TTL = lease time * 80%. RELEASE / EXPIRE event: Call the DNS API to delete the record.

[0060] In this embodiment, the DNS proxy module is embedded within the DHCP server, allowing it to directly access the server's internal state and events. This allows it to respond to changes in lease status in real time, ensuring timely updates and deletions of DNS records. By using a lease status event-driven mechanism, the DNS proxy module avoids traditional polling, reduces unnecessary resource consumption, and improves system performance.

[0061] Through the embedded DNS proxy module, this application can monitor the DHCP server's lease status events (such as ACK, RELEASE, EXPIRE) in real time and dynamically update DNS records based on these events to ensure the accuracy and timeliness of DNS records.

[0062] Step S2: When the remaining lease time reaches a first preset value, the DHCP server monitors the client's lease renewal behavior through the DNS proxy module; if the client successfully renews the lease, the TTL of the DNS record in the DNS server is updated to the initial TTL; if the client does not renew the lease, the DNS record is marked as high risk.

[0063] In one embodiment, the DHCP server monitors the client's lease renewal behavior through the DNS proxy module, specifically including: if the DHCP server receives a DHCP REQUEST message sent by the client and replies to the client with a DHCPACK message to confirm the lease renewal, it indicates that the client has successfully renewed the lease; the DHCP server updates the TTL of the DNS record in the DNS server through the DNS proxy module; if the DHCP server does not detect the client's lease renewal request, it indicates that the client has not renewed the lease, and the DNS record is marked as high risk.

[0064] In this embodiment, the timing diagram of the client successfully renewing the lease when the remaining lease time reaches the first preset value is as follows: Figure 3 , failed to renew the lease Figure 4 . The client attempts to renew the IP address during the T1 phase (when the remaining lease time reaches the first preset value), and the DHCP server sends a DHCPACK message to confirm the renewal. The DHCP server: notifies the DNS proxy module that the client's IP address renewal is successful. The DNS proxy module: calls the DNS server's API and updates the DNS record's TTL to 80% of the new lease time. The DNS server: receives the API call and updates the DNS record's TTL.

[0065] The client attempts to renew the IP address during the T1 phase (when the remaining lease time reaches the first preset value), but is unsuccessful: Client: Attempts to renew the IP address during the T1 phase and sends a DHCP REQUEST message. DHCP server: Receives the client's renewal request, but for some reason (such as the IP address has been assigned to another client or the parameters requested by the client are not accepted by the server), the server decides not to approve the renewal request. DHCP server: Sends a DHCPNAK (Negative Acknowledgment) message to the client to reject the renewal request. Client: After receiving the DHCPNAK message, it stops using the current IP address and restarts the IP address acquisition process (sending a DHCP DISCOVER message, etc.). DHCP server: Notifies the DNS proxy module that the client's IP address renewal has failed. DNS proxy module: Marks the DNS record as high-risk, but does not delete it immediately, waiting for further renewal attempts or reaching the T2 phase. DNS server: The DNS record remains unchanged, waiting for subsequent operations (such as processing in the T2 phase or another renewal attempt by the client).

[0066] Step S3, for DNS records marked as high-risk, when the remaining lease time reaches a second preset value, monitor the client's renewal behavior again; if the client successfully renews the lease, update the TTL of the DNS record to the initial TTL; if the client does not renew the lease, delete the DNS record.

[0067] In one embodiment, the deleting of the DNS record specifically includes: when the remaining lease time reaches a second preset value, the DHCP server does not detect the client's renewal request, then notifying the DNS proxy module that the client has not renewed the lease; the DNS proxy module calls an API to delete the corresponding DNS record in the DNS server.

[0068] In this embodiment, the timing diagram of the client successfully renewing the lease when the remaining lease time reaches the second preset value is as follows: Figure 4 , failed to renew the lease Figure 5 . The client attempts to renew the IP address during the T2 phase (when the remaining lease time reaches the second preset value), and the DHCP server sends a DHCPACK message to confirm the renewal. The DHCP server: notifies the DNS proxy module that the client's IP address renewal is successful. The DNS proxy module: calls the DNS server's API and updates the DNS record's TTL to 80% of the new lease time. The DNS server: receives the API call and updates the DNS record's TTL.

[0069] If the client does not renew its lease during T2 (when the remaining lease time reaches the second preset value), the DHCP server triggers a deletion operation, or the client releases the IP address (RELEASE event), or the lease expires (EXPIRE event). The DHCP server notifies the DNS proxy module that the client has not renewed its lease or that the lease has expired. The DNS proxy module calls the DNS server's API to delete the DNS record. The DNS server receives the API call and deletes the corresponding DNS record.

[0070] In this embodiment, the purpose of stage T2 is as follows: It is triggered when 12.5% ​​of the lease remains (8-hour lease → 1 hour remaining). If the client does not renew the lease (perhaps due to powering off or leaving the network), the DNS proxy module directly deletes the DNS record. This way, the DNS record is cleared before the lease actually expires, preventing the client from resolving to an invalid IP address.

[0071] Step S4: When the lease expires, if the client has not renewed the lease, the IP address is reclaimed.

[0072] In one embodiment, the reclaiming of the IP address specifically includes: the client does not renew the lease when the lease expires and stops using the current IP address; the DHCP server reclaims the IP address and returns it to the address pool.

[0073] In this embodiment, the triggering time is: the lease expires completely (0% remaining). The DHCP server reclaims the IP and sends an EXPIRE event. The DNS proxy module checks and deletes the record again (redundancy mechanism to prevent the T2 stage from not being triggered).

[0074] In this embodiment, normal DHCP / DNS functions are not affected: If the client renews its lease normally, the T2 phase will not trigger deletion, and the DNS record will be updated with the renewal. If the client goes offline abnormally, the T2 phase will clear the DNS record in advance to avoid zombie records.

[0075] This method is user-aware: devices that are online will renew their DNS records, and offline devices will be quickly cleared, reducing DNS pollution.

[0076] In this embodiment, lease event-driven DNS lifecycle management:

[0077] Initial registration: When DHCP assigns an IP address, the DNS record's initial TTL is automatically calculated and set. The setting rule is: initial TTL = lease time * 80%, allowing for the impact of network latency.

[0078] Phase T1: When 50% of the lease remains, monitor the device's lease renewal behavior. If the device actively initiates a DHCP request and the server responds with an ACK, maintain the DNS record. If no lease renewal request is detected, mark the record as high risk.

[0079] Phase T2: When 12.5% ​​of the lease remains, if the device does not renew the lease, the DNS record will be deleted directly.

[0080] DNS proxy module: embedded in the DHCP server, monitors lease status events to perform deterministic operations: ACK event → register / update DNS records; RELEASE / EXPIRE event → immediately delete records.

[0081] Key points of this application:

[0082] Key Point 1: Binding Lease Status Events to DNS Operations: Converting state machine events (T1 / T2 / EXPIRE) inherent to the DHCP protocol into control signals for the DNS record lifetime.

[0083] Key Point 2: Lightweight event-driven architecture: Embed a DNS proxy module in the DHCP server to implement polling-free on-demand operations by monitoring lease status events.

[0084] In one embodiment, a DHCP server is provided, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method of the above embodiment.

[0085] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

Claims

1. A dynamic DNS synchronization method based on a DHCP server, characterized in that: include: When the DHCP server assigns an IP address to a client, it calculates the initial TTL of the DNS record and calls the API interface through the embedded DNS proxy module to register the DNS record with the DNS server. At the same time, it sets the TTL of the DNS record to the initial TTL. The initial TTL = lease time * preset threshold. When the remaining time of the lease reaches a first preset value, the DHCP server monitors the client's renewal behavior through the DNS proxy module; if the client successfully renews the lease, the TTL of the DNS record in the DNS server is updated to the initial TTL; if the client does not renew the lease, the DNS record is marked as high risk; For DNS records marked as high-risk, when the remaining lease time reaches a second preset value, the client's renewal behavior is monitored again; if the client successfully renews the lease, the TTL of the DNS record is updated to the initial TTL; if the client does not renew the lease, the DNS record is deleted; When the lease expires, if the client has not renewed the lease, the IP address will be reclaimed.

2. The method for dynamic DNS synchronization based on a DHCP server according to claim 1, wherein: The DHCP server monitors the client's lease renewal behavior through the DNS proxy module, specifically including: If the DHCP server receives the DHCP REQUEST message sent by the client and replies with a DHCPACK message to the client to confirm the renewal, it means that the client has successfully renewed its lease; The DHCP server updates the TTL of the DNS record in the DNS server through the DNS proxy module; If the DHCP server does not detect the client's renewal request, it means that the client has not renewed the lease and marks the DNS record as high risk.

3. The dynamic DNS synchronization method based on a DHCP server according to claim 1, wherein: The DNS proxy module is embedded in the DHCP server and monitors the lease status events of the DHCP server to perform deterministic operations related to DNS records; wherein the lease status events include ACK events and RELEASE / EXPIRE events; the deterministic operations include: If the DNS proxy module detects an ACK event, it registers / updates the DNS record with the DNS server; If the DNS proxy module detects a RELEASE / EXPIRE event, it deletes the DNS record in the DNS server.

4. The method for dynamic DNS synchronization based on a DHCP server according to claim 1, wherein: Deleting the DNS record specifically includes: When the remaining lease time reaches a second preset value, the DHCP server does not detect a renewal request from the client, and notifies the DNS proxy module that the client has not renewed the lease; The DNS proxy module calls the API to delete the corresponding DNS records in the DNS server.

5. The method for dynamic DNS synchronization based on a DHCP server according to claim 1, wherein: The reclaimed IP address specifically includes: The client does not renew the lease when it expires and stops using the current IP address; The DHCP server reclaims the IP address and returns it to the address pool.

6. The method for dynamic DNS synchronization based on a DHCP server according to claim 1, wherein: The preset threshold is 80%.

7. The dynamic DNS synchronization method based on a DHCP server according to claim 1, characterized in that: The first preset value is 50%; the second preset value is 12.5%.

8. A DHCP server comprising a memory, a processor, and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the method according to claim 1.