-
-
Notifications
You must be signed in to change notification settings - Fork 566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dhcp: static lease config conflict with currently active leases #1026
Comments
This is dnsmasq's behavior for handling DHCP renewals and static leases. Please contact their mailing list to see what they can do. http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss |
+1 for this, I'm setting up pihole for the first time, and this has been really frustrating to figure out. I'd much rather the dynamic lease be automatically deleted when adding a static lease, but it looks like pi-hole/api#138 plus #177 would make this easier to manage? |
This issue has been mentioned on Pi-hole Userspace. There might be relevant details there: https://discourse.pi-hole.net/t/multiple-ip-addresses-in-network-overview/33562/18 |
This issue has been mentioned on Pi-hole Userspace. There might be relevant details there: https://discourse.pi-hole.net/t/option-to-delete-existing-dhcp-reservation/34305/8 |
I think there's a failure to see this problem from the perspective of people who would like to use pi-hole's DHCP features and expect it to be mostly on par with whatever DHCP solution their router used to provide. Case in point - my Netgear router has an option to add a static DHCP lease just like pi-hole does. When I add one, it instantly removes any leases attached to the MAC/ip combo and changes the ip address of the device right away. It seems there's some legitimate pushback from the dnsmasq community on this issue. For them, it's a feature, not a bug. For us, it's a bug, not a feature. As such, I would think that the solution should probably be provided in pi-hole itself. I know maintainers have their hands full, but can we at least prioritize a native pi-hole solution to this problem rather than deferring people to go pester the dnsmasq community every time it comes up? Thanks, and I'm happy to help with a solution although I'm weak on networking. |
Ultimately I was able to look into the problem and found that it is indeed tough to solve due to universal lack of support for the FORCERENEW message by most clients. See here for more. What I was able to do was halt pihole-FTL, remove the leases from /etc/pihole/dhcp.leases and then restart pihole-FTL. The problem here is that this alone doesn't magically tell all affected clients to update their IP address to the one specified in the static lease. They'll still try to connect to the IP given in the old lease. The quickest way to fix that for me was by rebooting my router. Upon reconnecting to the internet most clients renegotiated their lease and connected to the correct static IP. If you wanna try this yourself you can do so by: # Make a copy of your leases in case you mess up
sudo cp /etc/pihole/dhcp.leases
# Stop the pihole-FTL service which manages DHCP
sudo service pihole-FTL stop
# Find the line containing the MAC and/or IP of the sticky lease in the 'dhcp.leases' file . Delete this line.
sudo nano /etc/pihole/dhcp.leases
# Start pihole-FTL back up
sudo service pihole-FTL start At this point, the client in question will still be holding onto an old lease. If you have access to the device, and it is running linux, you can do this: # DONT RUN ANY OF THIS ON YOUR PIHOLE, run it on the effected device if you can.
# Replace eth0 with the name of your clients interface e.g. wlan0
# This command releases the client's current DHCP lease.
sudo dhclient -r -4 -v eth0
# This command grabs the latest DHCP lease from the DHCP server (the pihole in our case)
sudo dhclient -4 -v eth0 That should do the trick for Linux devices. Other devices will need to be manually restarted, have airplane mode toggled, etc. In my case all clients happily renewed their leases when I rebooted my router. This is probably not a guarantee however. |
I think it is not necessary for most users to force a renewal of the lease to a client. I rather think it is sufficient what the OP suggested and let the users manually reconnect their devices to the network. |
This issue has been mentioned on Pi-hole Userspace. There might be relevant details there: https://discourse.pi-hole.net/t/v5-setting-static-ip-doesnt-work/34926/2 |
This issue has been mentioned on Pi-hole Userspace. There might be relevant details there: https://discourse.pi-hole.net/t/remove-dhcp-leases-over-webgui/2277/23 |
@afiaka87 is right. These are technical limitation we cannot come across. With #1634 you can at least skip doing any manual work on the server as you can remove existing leases without the need for a server restart. The manual re-lease on the client is still needed and there isn't anything that could be done about it. |
This should be solved with #1634 and has been released by |
In raising this issue, I confirm the following:
{please fill the checkboxes, e.g: [X]}
How familiar are you with the the source code relevant to this issue?:
1
Expected behaviour / Steps to reproduce:
Actual behaviour:
Device remains old IP address.
Solution
/etc/pihole/dhcp.leases
The text was updated successfully, but these errors were encountered: