I have the following in /etc/dhcpcd.conf (on a Pi), which (as I understand it) should seek an IP via DHCP but fallback to 192.168.60.100 if none is offered.
My problem is that more often than not I end up with the fallback IP address rather than one from DHCP, despite the Pi being on a network with a DHCP server.
(The connection to DHCP is a bit convoluted: Pi cabled to Wifi access point, which is on my home wifi network, which gives it access to my home router's DHCP server.)
Any suggestions how I can diagnose this?
I'm not sure if the complex connection to DHCP is the issue or not (and it does sometimes work so I don't think it's a config issue) but I'm not sure where to start looking and I'd like this to work over unreliable links if possible.
If I comment out the fallback line I get a reliable DHCP address.
# fallback to static profile on eth0 profile static_eth0 static ip_address=192.168.60.100/24 static routers=192.168.60.250 static domain_name_servers=192.168.60.250
interface eth0 fallback static_eth0
On Thu, 4 Jun 2020 at 09:48, Mark Rogers mark@more-solutions.co.uk wrote:
My problem is that more often than not I end up with the fallback IP address rather than one from DHCP, despite the Pi being on a network with a DHCP server.
Additional information:
Here's the output of dhcpcd run from the terminal. Notice that an IP is offered from 192.168.10.1 but it nevertheless falls back. (I'm testing in IPv4 mode in case it's the lack of an IPv6 from my router that's causing it, but it does the same thing regardless - the logs are a bit shorter excluding IPv6 though.)
I do have to run it several times to get an IP address offered before it falls back to 192.168.60.100 which is interesting (but the whole process is over in a few seconds and it should be waiting far longer before giving up anyway in the absence of an IP, but falling back when it demonstrably has received an IP?)
$sudo dhcpcd -B -d -w -4 eth0 dhcpcd-8.1.2 starting eth0: executing `/lib/dhcpcd/dhcpcd-run-hooks' PREINIT eth0: executing `/lib/dhcpcd/dhcpcd-run-hooks' CARRIER eth0: delaying IPv4 for 0.8 seconds eth0: using ClientID 01:b8:27:eb:22:1c:05 eth0: soliciting a DHCP lease eth0: sending DISCOVER (xid 0x274915b3), next in 3.4 seconds eth0: sending DISCOVER (xid 0x274915b3), next in 7.7 seconds eth0: offered 192.168.10.220 from 192.168.10.1 eth0: sending REQUEST (xid 0x274915b3), next in 3.3 seconds eth0: selected profile static_eth0 eth0: using ClientID 01:b8:27:eb:22:1c:05 eth0: using static address 192.168.60.100/24 eth0: adding IP address 192.168.60.100/24 broadcast 192.168.60.255 eth0: adding route to 192.168.60.0/24 eth0: adding default route via 192.168.60.250 eth0: ARP announcing 192.168.60.100 (1 of 2), next in 2.0 seconds eth0: executing `/lib/dhcpcd/dhcpcd-run-hooks' STATIC eth0: ARP announcing 192.168.60.100 (2 of 2)
After posting here I decided to post to a wider audience via StackOverflow: https://stackoverflow.com/questions/62191940/dhcpcd-fallback-triggering-even...
If anyone does have any solutions feel free to post them there for SO reputation, otherwise I'll update SO if anyone helps me solve it here.