-
Notifications
You must be signed in to change notification settings - Fork 112
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
Keep DISCOVER after falling back to static IP address #337
Comments
I try to add a hook script (/usr/libexec/dhcpcd-hooks/40-fallback) to solve the problem. See below that sends 'renew' to dhcpcd manager. if [ "$reason" = "STATIC" ] && [ "$profile" = "static_eth0" ]; then
dhcpcd --renew
fi I realize the '--renew' is designed to retain the old lease (the static IP is also considered as lease with infinite lease-time). It is not for restarting DISCOVER phase. So this is not solution. |
The |
@perkelix we intend no ipv4 link local address but a specific static IP. I tested with adding the waitip 4 to /etc/dhcpcd.conf. The dhcpcd still fall into the static IP for ever. And `waitip' has side-effect: "Wait for an address to be assigned before forking to the background.". We start the dhcpcd with option '-b'. |
The static options are meant to override any DHCP reply as well as providing a fixed IP to fall back to. That being said, we could allow this behavior in a fallback profile. To turn it off and have pure static the user could add the |
@rsmarples thanks! As a compromise, the ipv4ll is working with DISCOVER in parallel. Maybe an option could be added to specify the link local address with a range for ipv4ll. For example: |
@LeoRuan just curious - why do you want a dynamic address but want a static IPv4LL allocation to fallback to? |
@rsmarples Good question :) For historical reason, installers does configuration on the device via Ethernet interface in early phase - when no router available (even no wall-power) and device is supplied by a battery. Yes, this is very specific requirement for my production. |
That doesn't really answer the question though? I mean if you're swapping between DHCP and IPv4LL then you're likely doing DNS lookups and provided you have mDNS in play (it's 2024 - all my OS's I support which is a lot use mDNS in my homelab) it really doesn't matter what the IP address is, whether on the client or on the server. |
We have a very old remote-program running in Windows PC. The remote program requests IP address of device for connection. In device initial setup, a static IP address is requested so that installer can program the device. After configuration, the device run with DHCP server, DNS server and connect to others e.g. Cloud. The device (DHCP client) is originally implemented by own code and prefer to run with a DHCP server. Only when the DHCP server is not available in network, device fallback to a static IP. I don't know all use-cases that may auto-swap between dynamic and static IP addresses. I am not clear whether the swapping make sense or not. Recently we use dhcpcd with the fallback mechanism instead of the own code. But due to history reason, we are not going to change the mechanism right now. |
I think I'm happy to add the |
My embedded Linux system device uses dhcpcd-10.0.6 to get IPv4 address for only interface 'eth0' from a router, and switches may be used in between device and router. The dynamical IPv4 address is always expected but if router is not available in the networking, dhcpcd fallback into the specific static IPv4 address. The conf looks like as below:
We have use case that router may join the networking very later after device startup (e.g. 10 minutes later). So at first the device is falling back into the static IP address. When router joins, we expect the dhcpcd can automatically request an old lease or discover a new lease from router. But it does not. Instead the device uses the static IP address for ever. See following debug logs:
Is it possible to keep DISCOVER when the device is in fallback status?
The text was updated successfully, but these errors were encountered: