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

Work with DHCP address instead of static IP address configuration. #629

Closed
jpluimers opened this Issue Aug 21, 2016 · 13 comments

Comments

Projects
None yet
5 participants
@jpluimers

jpluimers commented Aug 21, 2016

This is more of a feature request.

A lot of networks prefer DHCP addresses that are fixed by MAC over individual hard-coded static IP addresses. This can make central maintenance of IP addresses a lot easier. Another benefit is that it would allow to configure a machine in one network, then move it over to another network and it would "just work".

The feature request is for pi-hole to be able to work with DHCP provided IP-addresses. Upon boot/dhcp-change any configuration file that now has the fixed IP address would then need to be changed.

@dschaper

This comment has been minimized.

Show comment
Hide comment
@dschaper

dschaper Aug 21, 2016

Member

Would a Yes/No dialog screen for Static IP address assignment be something that you see as a working solution?

Member

dschaper commented Aug 21, 2016

Would a Yes/No dialog screen for Static IP address assignment be something that you see as a working solution?

@jpluimers

This comment has been minimized.

Show comment
Hide comment
@jpluimers

jpluimers Aug 21, 2016

It would, but I think there will be more work needed: each time an IP address is assigned by DHCP any configuration file (including /etc/pihole/gravity.list) depending on the IP address needs to change.

It might be that following http://roy.marples.name/man/html8/dhcpcd-run-hooks.html is enough.

Furthermore (maybe I should put this in a separate issue), I think it's wise to document how to change the IP address of an existing pi-bot installation.

jpluimers commented Aug 21, 2016

It would, but I think there will be more work needed: each time an IP address is assigned by DHCP any configuration file (including /etc/pihole/gravity.list) depending on the IP address needs to change.

It might be that following http://roy.marples.name/man/html8/dhcpcd-run-hooks.html is enough.

Furthermore (maybe I should put this in a separate issue), I think it's wise to document how to change the IP address of an existing pi-bot installation.

@dschaper

This comment has been minimized.

Show comment
Hide comment
@dschaper

dschaper Aug 21, 2016

Member

Very interesting link, didn't know about the hooks, but that would work great for dhcpcd configuration. This is definitely something to look at implementing. Would you be willing to start work on some code to PR, or is this more of a feature request for us to code and implement?

Member

dschaper commented Aug 21, 2016

Very interesting link, didn't know about the hooks, but that would work great for dhcpcd configuration. This is definitely something to look at implementing. Would you be willing to start work on some code to PR, or is this more of a feature request for us to code and implement?

@jpluimers

This comment has been minimized.

Show comment
Hide comment
@jpluimers

jpluimers Aug 22, 2016

I'm a relative n00b on debian and certainly not proficient at bash programming. But with some assistance, I could give it a head-start as I do have Red Hat (5-6) and SuSE/opensuse (7 and up) user experience and am not afraid of touching new grounds. To get an impression of what I can do, browse a bit of my blog http://wiert.me or G+ stream https://plus.google.com/+JeroenPluimers (yes, both are high volume as this relatively old fart is trying to keep up with tech)

It would for instance help to point out where the /etc/pihole/gravity.list is generated and how to integrate changes to config files in the install / uninstall procedures.

jpluimers commented Aug 22, 2016

I'm a relative n00b on debian and certainly not proficient at bash programming. But with some assistance, I could give it a head-start as I do have Red Hat (5-6) and SuSE/opensuse (7 and up) user experience and am not afraid of touching new grounds. To get an impression of what I can do, browse a bit of my blog http://wiert.me or G+ stream https://plus.google.com/+JeroenPluimers (yes, both are high volume as this relatively old fart is trying to keep up with tech)

It would for instance help to point out where the /etc/pihole/gravity.list is generated and how to integrate changes to config files in the install / uninstall procedures.

@dschaper

This comment has been minimized.

Show comment
Hide comment
@dschaper

dschaper Aug 22, 2016

Member

gravity.list basically is the resultant host file of the entire script, so is the question about how that file is created in its entirety, or just how the individual lists are amalgamated into the final monolithic file?

The changes that involve calls to the hooks would probably be best in the https://github.com/pi-hole/pi-hole/blob/master/automated%20install/basic-install.sh#L333 section, this is where the static / DHCP choice is actually made.

Member

dschaper commented Aug 22, 2016

gravity.list basically is the resultant host file of the entire script, so is the question about how that file is created in its entirety, or just how the individual lists are amalgamated into the final monolithic file?

The changes that involve calls to the hooks would probably be best in the https://github.com/pi-hole/pi-hole/blob/master/automated%20install/basic-install.sh#L333 section, this is where the static / DHCP choice is actually made.

@dschaper dschaper self-assigned this Aug 22, 2016

@jacobsalmela

This comment has been minimized.

Show comment
Hide comment
@jacobsalmela

jacobsalmela Nov 12, 2016

Member

Made this votable in Discourse. @dschaper are you still working on this or has it fallen out of scope?

@jpluimers any further input?

Member

jacobsalmela commented Nov 12, 2016

Made this votable in Discourse. @dschaper are you still working on this or has it fallen out of scope?

@jpluimers any further input?

@dschaper

This comment has been minimized.

Show comment
Hide comment
@dschaper

dschaper Nov 13, 2016

Member

Definately not out of scope and self-assigned. Goes with the DHCPCD5 issue. #830

Member

dschaper commented Nov 13, 2016

Definately not out of scope and self-assigned. Goes with the DHCPCD5 issue. #830

@jacobsalmela

This comment has been minimized.

Show comment
Hide comment
@jacobsalmela

jacobsalmela Nov 13, 2016

Member

OK thanks!

Member

jacobsalmela commented Nov 13, 2016

OK thanks!

@jpluimers

This comment has been minimized.

Show comment
Hide comment
@jpluimers

jpluimers Nov 17, 2016

No real input. I could help testing, but helping with development will be tough as my schedule is tight until the end of January.

jpluimers commented Nov 17, 2016

No real input. I could help testing, but helping with development will be tough as my schedule is tight until the end of January.

@dschaper

This comment has been minimized.

Show comment
Hide comment
@dschaper

dschaper Jul 9, 2017

Member

Bumping myself @dschaper to come back to this issue.

Member

dschaper commented Jul 9, 2017

Bumping myself @dschaper to come back to this issue.

@WaLLy3K

This comment has been minimized.

Show comment
Hide comment
@WaLLy3K

WaLLy3K Oct 9, 2017

Member

Thoughts on this, assuming I understand the issue correctly:

The issue is that /etc/pihole/gravity.list and /etc/dnsmasq.d/03-pihole-wildcard.conf both rely on IPV4_ADDRESS and IPV6_ADDRESS from /etc/pihole/setupVars.conf, as AFAIK they're the only places the current IP address is "hardcoded".

If we can detect an IP change, we can then run change_setting() (from /opt/pihole/webpage.sh) to update the IP addresses, and then run pihole -g -sd to recompile gravity.list. We'd also need to fix the IP addresses within 03-pihole-wildcard.conf, (preferably?) via gravity.sh too.

That'd make it nice and easy to have a simple command that when called, grabs the latest IP address, changes setupVars.conf and regenerates the blocklists.

That bit seems "fairly" simple. What about updating the clients with the new DNS server IP, if the DHCP server isn't Pi-hole?

Member

WaLLy3K commented Oct 9, 2017

Thoughts on this, assuming I understand the issue correctly:

The issue is that /etc/pihole/gravity.list and /etc/dnsmasq.d/03-pihole-wildcard.conf both rely on IPV4_ADDRESS and IPV6_ADDRESS from /etc/pihole/setupVars.conf, as AFAIK they're the only places the current IP address is "hardcoded".

If we can detect an IP change, we can then run change_setting() (from /opt/pihole/webpage.sh) to update the IP addresses, and then run pihole -g -sd to recompile gravity.list. We'd also need to fix the IP addresses within 03-pihole-wildcard.conf, (preferably?) via gravity.sh too.

That'd make it nice and easy to have a simple command that when called, grabs the latest IP address, changes setupVars.conf and regenerates the blocklists.

That bit seems "fairly" simple. What about updating the clients with the new DNS server IP, if the DHCP server isn't Pi-hole?

@jacobsalmela

This comment has been minimized.

Show comment
Hide comment
@jacobsalmela
Member

jacobsalmela commented Apr 10, 2018

@HarvsG

This comment has been minimized.

Show comment
Hide comment
@HarvsG

HarvsG May 22, 2018

Ubuntu 16.04 OpenVPN + Cloudflared DoH +PiHole

So this issue moved onto the forums and is marked as solved. However, I cannot get it to work. I am trying to create a PiHole on a digital ocean server which can be dropped around the globe. However, whenever I put it into a new location with a different IP config the networking completely breaks. The solution to the broken networking is to use pihole -r to reset the static IP to the new DHCP configuration. However, since networking is broken by this issue pihole -r hangs, and even if it didn't I think it would just retrieve the incorrect, old, configuration.

Also, since the networking is broken, you can't do any of this over SSH

paging @dschaper @jacobsalmela

HarvsG commented May 22, 2018

Ubuntu 16.04 OpenVPN + Cloudflared DoH +PiHole

So this issue moved onto the forums and is marked as solved. However, I cannot get it to work. I am trying to create a PiHole on a digital ocean server which can be dropped around the globe. However, whenever I put it into a new location with a different IP config the networking completely breaks. The solution to the broken networking is to use pihole -r to reset the static IP to the new DHCP configuration. However, since networking is broken by this issue pihole -r hangs, and even if it didn't I think it would just retrieve the incorrect, old, configuration.

Also, since the networking is broken, you can't do any of this over SSH

paging @dschaper @jacobsalmela

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment