DrayTek UK Users' Community Forum
Help, Advice and Solutions from DrayTek Users
A Question on the "Right" Way to Purge DHCP Lease Tables...
- ytene
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 18
- Thank you received: 0
10 Dec 2024 19:52 #104310
by ytene
A Question on the "Right" Way to Purge DHCP Lease Tables... was created by ytene
So I've just done something characteristically silly... which is usually [hopefully] a prelude to learning something useful.
Just got myself a new smartphone, brought it home and I want to get it configured to work with my local "5G" WiFi on my 2862 / VDSL2 router. I have reasonably good security on my home wireless network, so the SSID is hidden by default, I have WPA2/WPA3 active, I have a random 30-character password and I use whitelisting as a last line of defense against anyone left.
There's likely a better/simpler way, but from what I can make out, when connecting an iPhone to a wireless network, the first connection always seems to use Apple's randomised MAC address; then, once I have a working connection, I can go in to the configuration parameters for that network and disable the on-by-default "Private Wi-Fi Address", which means that each time the handset connects to this specific WiFi network, it will always use the same MAC address, which in turn means I can then use IP Binding, give it a DNS entry, that sort of thing.
But there's a problem. AKA, "But I did something stupid". I let my new phone take a DHCP lease, which it did, perfectly. By default, the lease term is 24 hours... But now that I have the thing connected, I've switched it to using a static MAC address, reconnected and then gone in to check and ensure that it is using MAC-to-IP binding to give me a recogniseable IP address for the phone. Which of course it isn't, because my router still has an active DHCP lease for the mac address.
I've been through the on-line documentation and the Admin panels to see if there is an option to "force retrieve" a DHCP lease... but there doesn't seem to be one.
This being the case, I figure that my best approach is to disable the phone's WiFi services, power recycle the router, then switch the phone back on and let it connect and request a lease. With the MAC-to-IP binding now registered and the MAC address recognised for this network, I'm expecting things to work.
But that's going to require that I reboot the whole router, interrupting "other things". Which for me includes a VPN tunnel that I'd rather not lose - it's work related. Does anyone happen to know if there is a way to purge/empty a DHCP cache please? I'm not averse to going in via SSH for a bit of command line if that's what it takes... but it would be nice if there is a simple way to do this that I've missed.
And if there actually isn't a way to "take back" a DHCP lease... then that might be a nice feature request for a future release of firmware...
Thanks in advance...
Just got myself a new smartphone, brought it home and I want to get it configured to work with my local "5G" WiFi on my 2862 / VDSL2 router. I have reasonably good security on my home wireless network, so the SSID is hidden by default, I have WPA2/WPA3 active, I have a random 30-character password and I use whitelisting as a last line of defense against anyone left.
There's likely a better/simpler way, but from what I can make out, when connecting an iPhone to a wireless network, the first connection always seems to use Apple's randomised MAC address; then, once I have a working connection, I can go in to the configuration parameters for that network and disable the on-by-default "Private Wi-Fi Address", which means that each time the handset connects to this specific WiFi network, it will always use the same MAC address, which in turn means I can then use IP Binding, give it a DNS entry, that sort of thing.
But there's a problem. AKA, "But I did something stupid". I let my new phone take a DHCP lease, which it did, perfectly. By default, the lease term is 24 hours... But now that I have the thing connected, I've switched it to using a static MAC address, reconnected and then gone in to check and ensure that it is using MAC-to-IP binding to give me a recogniseable IP address for the phone. Which of course it isn't, because my router still has an active DHCP lease for the mac address.
I've been through the on-line documentation and the Admin panels to see if there is an option to "force retrieve" a DHCP lease... but there doesn't seem to be one.
This being the case, I figure that my best approach is to disable the phone's WiFi services, power recycle the router, then switch the phone back on and let it connect and request a lease. With the MAC-to-IP binding now registered and the MAC address recognised for this network, I'm expecting things to work.
But that's going to require that I reboot the whole router, interrupting "other things". Which for me includes a VPN tunnel that I'd rather not lose - it's work related. Does anyone happen to know if there is a way to purge/empty a DHCP cache please? I'm not averse to going in via SSH for a bit of command line if that's what it takes... but it would be nice if there is a simple way to do this that I've missed.
And if there actually isn't a way to "take back" a DHCP lease... then that might be a nice feature request for a future release of firmware...
Thanks in advance...
Please Log in or Create an account to join the conversation.
- ytene
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 18
- Thank you received: 0
11 Dec 2024 16:13 #104314
by ytene
Replied by ytene on topic A Question on the "Right" Way to Purge DHCP Lease Tables...
Just amending this with the confirmation that my work-around was indeed successful.
I've also looked through everything again and I can't see any documentation or options that suggest that a "DHCP Lease Purge" option is available for a single device - I can't force the DHCP Cach to expire a granted lease.
OK, the power recycle solves the problem, but it is a bit clumsy. The ability to purge a single lease would be a nice additional feature for a future firmware update, should the Devs be willing to consider it.
I've also looked through everything again and I can't see any documentation or options that suggest that a "DHCP Lease Purge" option is available for a single device - I can't force the DHCP Cach to expire a granted lease.
OK, the power recycle solves the problem, but it is a bit clumsy. The ability to purge a single lease would be a nice additional feature for a future firmware update, should the Devs be willing to consider it.
Please Log in or Create an account to join the conversation.
- HodgesanDY
- Offline
- Member
Less
More
- Posts: 215
- Thank you received: 19
14 Dec 2024 01:43 #104318
by HodgesanDY
Replied by HodgesanDY on topic A Question on the "Right" Way to Purge DHCP Lease Tables...
Hi
ytene
You can always lower the 'DHCP Expiration Recycle' period to 5 seconds, using the telnet command page (launched from the GUI - top right corner buttons, on the dashboard page).
This can then be returned to a higher setting after the DHCP has purged the inactive lease. Setting range is 5-300 seconds.
If this doesn't work for you, you can also adjust the lease time as well:
Min 500 seconds, max 52 years (apparently!) entered in seconds. Although it's easier to use this command:
Which will return it to the default setting after you've resolved the sticky lease.
The good thing about doing it this way is, you won't need to reboot!
One thing to also consider, disabling the device's Wi-Fi and re-enabling it, plus refreshing the DHCP list on the Router will help force the purge/renewal to happen.
You can always lower the 'DHCP Expiration Recycle' period to 5 seconds, using the telnet command page (launched from the GUI - top right corner buttons, on the dashboard page).
Code:
srv dhcp expRecycle 5
This can then be returned to a higher setting after the DHCP has purged the inactive lease. Setting range is 5-300 seconds.
If this doesn't work for you, you can also adjust the lease time as well:
Code:
srv dhcp leasetime 500
Min 500 seconds, max 52 years (apparently!) entered in seconds. Although it's easier to use this command:
Code:
srv dhcp leasetime 0
Which will return it to the default setting after you've resolved the sticky lease.
The good thing about doing it this way is, you won't need to reboot!
One thing to also consider, disabling the device's Wi-Fi and re-enabling it, plus refreshing the DHCP list on the Router will help force the purge/renewal to happen.
The following user(s) said Thank You: ytene
Please Log in or Create an account to join the conversation.
- ytene
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 18
- Thank you received: 0
14 Dec 2024 12:15 #104320
by ytene
Replied by ytene on topic A Question on the "Right" Way to Purge DHCP Lease Tables...
I like it - thank you... Some viable work-around options here.
Please Log in or Create an account to join the conversation.
Moderators: Chris, Sami
Copyright © 2024 DrayTek