What's new

Is there a way to end a DHCP lease from router?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

MKANET

Regular Contributor
Is there any way to end a DHCP lease from the router? I have an active DHCP lease for a device that keeps renewing; even though that device hasn't been connected in a couple of days. My DHCP lease time is set to 24 hours (86400 seconds).

I tried to restart my router; thinking that would make the router to "forget" this lease (since the device isn't connected to my network anymore). Instead, the DHCP server on my router renewed the lease for that disconnected device!

I would just like to release this device's IP; so I can use it for another device.

It's possible that the device will connect back to my network in the future; but probably not for a very long time. I just want the device gone from "System Log - DHCP leases" page.
 
Is there any way to end a DHCP lease from the router? I have an active DHCP lease for a device that keeps renewing; even though that device hasn't been connected in a couple of days. My DHCP lease time is set to 24 hours (86400 seconds).

I tried to restart my router; thinking that would make the router to "forget" this lease (since the device isn't connected to my network anymore). Instead, the DHCP server on my router renewed the lease for that disconnected device!

I would just like to release this device's IP; so I can use it for another device.

It's possible that the device will connect back to my network in the future; but probably not for a very long time. I just want the device gone from "System Log - DHCP leases" page.

You’ll have to renew from the device. If you cannot, you’ll have to wait up to 86400 seconds for the lease to expire.
 
Is there any way to end a DHCP lease from the router? I have an active DHCP lease for a device that keeps renewing; even though that device hasn't been connected in a couple of days. My DHCP lease time is set to 24 hours (86400 seconds).

I tried to restart my router; thinking that would make the router to "forget" this lease (since the device isn't connected to my network anymore). Instead, the DHCP server on my router renewed the lease for that disconnected device!

I would just like to release this device's IP; so I can use it for another device.

It's possible that the device will connect back to my network in the future; but probably not for a very long time. I just want the device gone from "System Log - DHCP leases" page.

Go to LAN - DHCP server and manually assign this IP address to your another device. Renew IP address of your another dive via it's settings. You will see your "another device" with the IP address that you want in DHCP leases page.
 
Go to LAN - DHCP server and manually assign this IP address to your another device. Renew IP address of your another dive via it's settings. You will see your "another device" with the IP address that you want in DHCP leases page.

Thank you. If I manually assign the same IP to my new device, what happens to the device that still has an active lease when it reconnects to my network? Will there be an IP address conflict?

Also, I'm certain there's something wrong with this currently active lease, its lease period NEVER goes below 21 hours. It's been like that for 3 days now. I thought it was because I rebooted my router. However, I haven't rebooted my router for over a day now. I didn't see any derogatory system log messages other the the below events. Would the events below cause the lease period to never complete below?
Anyway, one way or another I need to let force-end the lease of the offending device. I just don't want to introduce an IP address conflict by manually assigning the same IP to a device if that IP is used by an existing device/DHCP lease:

Code:
Jan 20 03:55:38 WAN(0)_Connection: ISP's DHCP did not function properly.
Jan 20 03:55:38 DualWAN: skip single wan wan_led_control - WANRED off
Jan 20 03:55:38 nat: apply redirect rules
Jan 20 03:55:42 WAN(0)_Connection: Ethernet link down.
Jan 20 03:57:47 WAN(0)_Connection: Ethernet link up.
Jan 20 03:57:47 rc_service: wanduck 266:notify_rc restart_wan_if 0
 
Last edited:
Go to LAN - DHCP server and manually assign this IP address to your another device. Renew IP address of your another dive via it's settings. You will see your "another device" with the IP address that you want in DHCP leases page.

Okay, I just this this, however, the "another device" in the manually assigned DHCP IP list kept the same MAC address as the offending device that's not on my network anymore. I need to flush out the MAC address (and any other trace) of the old offending device or I'll definitely run into trouble.

Surely there has to be a way to just clear out all the active DHCP leases without having to factory reset the entire router.
 
What you're describing makes no sense. The router doesn't create or renew leases by itself. It only does so when requested to do so by a client.

To delete all the current leases log into the router an issue the following commands:
Code:
killall dnsmasq; rm /var/lib/misc/dnsmasq.leases; service restart_dnsmasq

EDIT: Corrected filename based on info from @kernol below. Also changed commands to be issued all at once because if you're to slow entering the commands watchdog will restart dnsmasq before you do.
 
Last edited:
I need to flush out the MAC address (and any other trace) of the old offending device or I'll definitely run into trouble
Why? This is normal network behaviour. The lease will clear at the expiry time that is set. It won't cause you "trouble" in the meantime as log as your lease pool has available addresses to assign. Why the paranoia about having a few remnant traces of a MAC for a few hours? :)
 
Why? This is normal network behaviour. The lease will clear at the expiry time that is set. It won't cause you "trouble" in the meantime as log as your lease pool has available addresses to assign. Why the paranoia about having a few remnant traces of a MAC for a few hours? :)

The problem is that the lease does NOT clear at the expiry time that was set. It reaches down to about 10hours of lease time left; then resets back to 24 hours. It's done this several times already in the last several days. This is definitely not normal behavior. I finally used the commands that @ColinTaylor posted to clear out all the leases.
 
What you're describing makes no sense. The router doesn't create or renew leases by itself. It only does so when requested to do so by a client.

To delete all the current leases log into the router an issue the following commands:
Code:
killall dnsmasq
rm /tmp/var/lib/misc/dnsmasq.leases
service restart_dnsmasq

It looks like this device's lease goes down to about 10 hours or so, then resets itself back to 24 hours lease time. This has happened several times already in the last several days. Since it was looking like this device's lease would stay in an indefinite loop without the lease ever running out, I ran the commands you posted to clear out the leases and start fresh. It worked like a charm. Thanks!
 
It looks like this device's lease goes down to about 10 hours or so, then resets itself back to 24 hours lease time. This has happened several times already in the last several days. Since it was looking like this device's lease would stay in an indefinite loop without the lease ever running out, I ran the commands you posted to clear out the leases and start fresh. It worked like a charm. Thanks!
I suspect that in a few hours time the lease will reappear. Like I keep saying, the router doesn't trigger a lease renewal only a client can do that. Which means that client must still be able to communicate with the router's DHCP server.
 
Update, I finally figured what was going on. As you guys suspected, a device with that MAC address WAS connecting to my network and disconnecting. I was thrown off because my Asus router was identifing that MAC address with a hostname that is has never had before. As soon as I released the lease of the device and connected it back to the network, it identified the device with the correct hostname.

Thank you guys for being patient with me. I really appreciate your time.
 
What you're describing makes no sense. The router doesn't create or renew leases by itself. It only does so when requested to do so by a client.

To delete all the current leases log into the router an issue the following commands:
Code:
killall dnsmasq
rm /tmp/var/lib/misc/dnsmasq.leases
service restart_dnsmasq

Interesting ... I have been trying to fix a repeat problem with two devices that I originally had on DHCP and then moved to static ip's [different to the ones assigned by DHCP]. No problem with connectivity - but the Webui Client list would repeatedly show a superscript "2" on the icon of these two devices - suggesting they each had two connections - but worse ... would reflect the OLD DHCP assigned ip addresses rather than the new ones statically entered !!!

A full scan of the local network using Advanced ip Scanner would show them correctly connected under static assigned ip's and revealed no sign of the old DHCP ip's.

Thanks Colin - fixed it with your post info - except for my RT-AC86U had to change the code as follows for it to work ...
Code:
killall dnsmasq
rm /var/lib/misc/dnsmasq.leases
service restart_dnsmasq
Basically removed the /tmp before /var
 
Thanks Colin - fixed it with your post info - except for my RT-AC86U had to change the code as follows for it to work ...
Code:
killall dnsmasq
rm /var/lib/misc/dnsmasq.leases
service restart_dnsmasq
Basically removed the /tmp before /var
Maybe things have changed on the 86U but they should both be the same file because /var is a link to /tmp/var.
Code:
# ls -l /var/lib/misc/dnsmasq.leases /tmp/var/lib/misc/dnsmasq.leases
-rw-r--r--    1 admin    root           773 May  5 15:25 /tmp/var/lib/misc/dnsmasq.leases
-rw-r--r--    1 admin    root           773 May  5 15:25 /var/lib/misc/dnsmasq.leases

# ls -l /var
lrwxrwxrwx    1 admin    root             7 May  4 14:58 /var -> tmp/var
 
Maybe things have changed on the 86U but they should both be the same file because /var is a link to /tmp/var.
Code:
# ls -l /var/lib/misc/dnsmasq.leases /tmp/var/lib/misc/dnsmasq.leases
-rw-r--r--    1 admin    root           773 May  5 15:25 /tmp/var/lib/misc/dnsmasq.leases
-rw-r--r--    1 admin    root           773 May  5 15:25 /var/lib/misc/dnsmasq.leases

# ls -l /var
lrwxrwxrwx    1 admin    root             7 May  4 14:58 /var -> tmp/var

Must have indeed - I get "No such file or directory" trying to find /tmp/var/lib/misc/dnsmasq.leases.
 
Out of interest what do you get from these commands?
Code:
find / -name dnsmasq.leases

df -h
 
The first ... find / -name dnsmasq.leases ... yields
/var/lib/misc/dnsmasq.leases

The second - a bunch more ...
Code:
johnw@RT-AC86U-8178:/tmp/home/root# df -h
Filesystem                Size      Used Available Use% Mounted on
ubi:rootfs_ubifs         77.2M     63.9M     13.3M  83% /
devtmpfs                214.9M         0    214.9M   0% /dev
tmpfs                   215.0M    784.0K    214.3M   0% /var
tmpfs                   215.0M      1.6M    213.5M   1% /tmp/mnt
mtd:bootfs                4.4M      3.3M      1.1M  75% /bootfs
tmpfs                   215.0M      1.6M    213.5M   1% /tmp/mnt
mtd:data                  8.0M    640.0K      7.4M   8% /data
tmpfs                   215.0M      1.6M    213.5M   1% /tmp
/dev/mtdblock8           48.0M      9.9M     38.1M  21% /jffs
/dev/sda1                29.3G      2.2G     25.6G   8% /tmp/mnt/usb3
tmpfs                   215.0M      1.6M    213.5M   1% /www/index_style.css
tmpfs                   215.0M      1.6M    213.5M   1% /www/require/modules/menuTree.js
/dev/mtdblock8           48.0M      9.9M     38.1M  21% /www/Main_LogStatus_Content.asp
 
I had a similar thing that once I assigned dhcp for clients I want to have them take effect immediately instead of waiting. I found that I can change the frequency setting of the wireless then change back, all clients will be renew dhcp.
 
I have had the same problem as kernol. Whenever I have had to connect a device with DHCP in order to setup a fixed IP, the only way to get rid of the DHCP IP in the client list is to reboot, even after deleting dnsmasq.leases.

It seems a pretty basic function for a router to accurately display all the clients connected to it, and to be able to cancel a DHCP lease.

Is there any chance of this ever being fixed on the AC68U?
 

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top