I'm using Raspbian stretch, an a Raspberry Pi 2 B+, and I can't seem to have it wait for an IP address on boot. The purpose of the Pi is to act as a network UPS server, using NUT. NUT doesn't successfully start unless the interface it is configured to listen on is up, and afaik that means either having a static IP or obtaining a DHCP lease. Now, if there was a power failure, the router shuts down and reboots once power is back. Since the router may take a few minutes to start handing out DHCP leases, I need the Pi to wait until it receives one so that network dependant services start correctly (like NUT)

I've tried setting a static IP in /etc/dhcpcd.conf and /etc/network/interfaces, which didn't seem to have any effect on bringing the interface up on boot, before the NUT service starts.

I've tried increasing the timeouts for obtaining a DHCP lease, which also didn't have any effect. E.g. setting timeout 300 in /etc/dhcpcd.conf and/or /etc/dhcp/dhclient.conf.

I've also tried using raspi-config to enable Wait for Network on Boot, which had a minimal effect. Unfortunately, the timeouts were still not respected, and NUT failed to start because there was no interface ready.

My upsd.conf is:

LISTEN ::1 3493

I'd prefer to set a static IP of and have the network interface be brought up right away so that NUT can listen on that interface. It seems that my skills are a bit rusty, so how do I accomplish this on raspbian stretch?

Your Answer

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

Browse other questions tagged or ask your own question.