1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice

Welcome To SNBForums

SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.

If you'd like to post a question, simply register and have at it!

While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!

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

Discussion in 'Asuswrt-Merlin' started by MKANET, Jan 19, 2020.

  1. MKANET

    MKANET Occasional Visitor

    Joined:
    Jan 22, 2013
    Messages:
    35
    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.
     
  2. Striker317

    Striker317 Regular Contributor

    Joined:
    Dec 18, 2015
    Messages:
    153
    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.
     
  3. ColinTaylor

    ColinTaylor Part of the Furniture

    Joined:
    Mar 31, 2014
    Messages:
    10,674
    Location:
    UK
    DHCP servers don't renew leases of their own accord. They only do so in response to a client's request.
     
    dosborne likes this.
  4. pattiri

    pattiri Senior Member

    Joined:
    Dec 27, 2016
    Messages:
    263
    Location:
    Istanbul, Turkey
    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.
     
  5. MKANET

    MKANET Occasional Visitor

    Joined:
    Jan 22, 2013
    Messages:
    35
    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: Jan 20, 2020
  6. MKANET

    MKANET Occasional Visitor

    Joined:
    Jan 22, 2013
    Messages:
    35
    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.
     
  7. ColinTaylor

    ColinTaylor Part of the Furniture

    Joined:
    Mar 31, 2014
    Messages:
    10,674
    Location:
    UK
    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
     
  8. dosborne

    dosborne Senior Member

    Joined:
    May 11, 2019
    Messages:
    454
    Location:
    /dev/null
    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? :)
     
  9. MKANET

    MKANET Occasional Visitor

    Joined:
    Jan 22, 2013
    Messages:
    35
    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.
     
  10. MKANET

    MKANET Occasional Visitor

    Joined:
    Jan 22, 2013
    Messages:
    35
    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!
     
    Zonkd likes this.
  11. ColinTaylor

    ColinTaylor Part of the Furniture

    Joined:
    Mar 31, 2014
    Messages:
    10,674
    Location:
    UK
    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.
     
    dosborne likes this.
  12. MKANET

    MKANET Occasional Visitor

    Joined:
    Jan 22, 2013
    Messages:
    35
    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.
     
    dosborne likes this.