I had no success applying the many other good solutions to my setup which involves having a macvlan interface on top of eth0
.
Install based on 2018-06-27-raspbian-stretch-lite
.
What works well for me:
Disable dhcpcd
service.
systemctl disable dhcpcd
Reduce timeout in /etc/dhcp/dhclient.conf
.
# Do not hold boot for default 60 seconds, give up faster
# but not too fast, see what work with your DHCP server
timeout 10;
# Retry faster
# This is after initial give up and dhclient went to background and boot proceeded without a lease
# Default 5 minutes is too long
retry 20;
# Consider backoff-cutoff setting as well
So now that waits at boot for up to 10 seconds, and if there is no DHCP lease the dhclient
goes into background and boot continues without a lease.
Without dhcpcd
I have the added benefit of being manually stop/start/restart wlan0
without having to hunt down wpa_supplicant
started presumably by dhcpcd
and which was refusing to stop with ifdown wlan0
.
Note: this might mean you might not be able to use rapsi-config
to configure your wifi, and need to write config into /etc/network/interfaces
, which is preferred for me anyway.
The otherwise neat solution by Evgeniy Chukanov using /etc/systemd/system/networking.service.d/reduce-timeout.conf
to reduce timeout causes dhcpcd
to NOT bring up my macvlan interface IF lease timeout on eth0
at boot gets reached.
Not that my macvlan config matters for OP, but it was the reason to come up with this solutions, so for completeness:
In /etc/network/interfaces.d/macvlan1
auto macvlan1
iface macvlan1 inet static
address .....
netmask .....
pre-up ip link add macvlan1 link eth0 type macvlan
post-down ip link del macvlan1
I have since swapped eth0
and mavclan1
, and I do static IPv4 on eth0
and DHCP client on macvlan1
, which gets me further even using dhcpcd
, interface gets created, but still does not re-try to obtain lease after initial timeout.
I have not bothered to investigate further because my solution without dhcpcd
works very well for me.