0

I have a pi working as a pihole that is also working as my dhcp server as my router doesn't allow setting alternate DNS servers, the DHCP server in my router is disabled.

I had previously configured the pi to have a static IP through /etc/dhcpcd.conf for some reason after an update this no longer seems to work and upon booting the desktop network widget shows:

link is up, configuring
expired [ip]

I've gone back through all the up to date guides and confirmed that my /etc/network/interfaces file is unchanged and that my /etc/network/interfaces.d directory is empty

I've run a systemctl daemon-reload and then restart the dhcpcd service, after doing this the interface comes up with my desired static IP, however after a reboot again it goes back to not working.

from another machine on the network running a continuous ping the machine briefly starts answering pings (<30s) and then stops answering them. restarting dhcpcd seems to fix it but again only until reboot.

I've tried enabling the "wait for network on boot" option which seemed to make no difference.

where else can i look for related settings?

for clarity the end of my /etc/dhcpcd.conf file looks like this but with my network specific IPs:

interface eth0
       static ip_address=10.1.1.30/23
       static routers=10.1.1.1
       static domain_name_servers=127.0.0.1

I don't believe pihole is doing anything specifically with the interfaces other than listening on it doe DHCP and DNS requests, I'm using the DHCP server built into pihole. As for updates it was very out of date and was still running jessie, I did a full upgrade, then dist-upgrade, reboot and change repos to point at stretch, dist-upgrade, reboot, upgrade, reboot again. It wasn't until the last upgrade that the interface fell over, however there were about 700 packages affected by that.

  • Do you know what pihole is doing with your interfaces? What dhcp server is running? What update do you have done? It seems that there are some dependencies of services not respected because dhcpcd works when all other services are started after boot. Maybe dhcpcd starts too early? – Ingo Jan 1 at 13:18
  • i don't believe pihole is doing anything specifically with the interfaces other than listening on it doe DHCP and DNS requests, i'm using the DHCP server built into pihole. as for updates it was very out of date and was still running jessie, i did a full upgrade, then dist-upgrade, reboot and change repos to point at stretch, dist-upgrade, reboot, upgrade, reboot again. it wasn't until the last upgrade that the interface fell over, however there were about 700 packages affected by that. – James Kent Jan 1 at 15:18
  • just to clarify, i do have a full imaged backed up from before the update, but i'd rather not roll back if i can help it – James Kent Jan 1 at 15:19
0

dhcpcd.conf file is configuration for DHCP client. In this configuration DHCP client try to connect to DHCP server and reserve/register given static IP address. But: Your DHCP server is on the same machine, so at the moment when DHCP client try to register, the DHCP server is not accessible or running at all, because do not have IP address and machine is currently bootting.

The solution is to disable DHCP client and set IP address truly static not by DHCP reservation.

You can do that in /etc/network/interfaces. i.e.:

auto eth0
allow-hotplug eth0
iface eth0 inet static
  address 10.0.0.2
  gateway 10.0.0.1
  netmask 255.255.255.0
  network 10.0.0.0
  broadcast 10.0.0.255
  • That's what I've done as a temporary measure, but this configuration previously worked? – James Kent Dec 31 '18 at 10:19
  • I don't know why previous configuration sometimes is working. It shouldn't, but I'm not DHCP expert. – Łukasz Jakubek Dec 31 '18 at 10:29
  • Thing is dhcpcd is for configuring static ip as well, hence the static options, this doesn't make any sense when acting as a client as there is no mechanism to notify a dhcp server that you are taking that address. But dhcpcd needs to know if you are configuring a static address so it sets that up and doesn't try to set up a dhcp address – James Kent Dec 31 '18 at 10:41
0

You had a running pihole based on Raspbian Jessie. Then you upgraded it to Raspbian Stretch. Debian can do it but a complete upgrade to another version is a big issue. Debian cannot always ensure what and how it should take over old configuration setups. Often it asked on the upgrade process by manual interaction what to do. In addition there are many changes in systemd belonging to its behavior for dependencies between services. That dhcpcd runs when all other services have started up after boot is a hint that it has wrong dependencies on startup, maybe it is starting too early.

The pihole documentation - Prerequisites describes:

As part of our install process, we append some lines to /etc/dhcpcd.conf in order to statically assign an IP address, so take note of this prior to installing.

I don't know what pihole sets and it is unclear if this settings are the same you have described. So first I would look after these settings in dhcpcd.conf and I would check the dependencies from dhcpcd.service, maybe with systemctl list-dependencies dhcpcd.service.

As also said on pihole documentation - Prerequisites pihole can be installed on top of Raspbian Stretch Lite. If you cannot get the upgrade into a stable state with minimal effort I suggest just download a Raspbian Stretch Lite image and install pihole on it direct again. It's said that it doesn't take much time.

  • i did watch the upgrade and whenever prompted about the config files i did a diff, in all cases i looked at i ended up keeping my original because of changes i knew about that needed to be made, i have got it to a stable state now by disabling dhcpcd and configuring in interfaces instead. worth noting though that pihole does have a reinstall option (sudo pihole -r) which i did run without success. the reason i went for upgrade instead of clean install is because there is a lot more than just pihole running on it. i shall have a look into dependencies – James Kent Jan 1 at 18:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.