Hi all, I’m pretty new to the Linux ecosystem…But I’ve some base and I manage with step by step
tutorial but for now I cant find what i need
I’m searching a way to add a script into "etc/network/interfaces " for when i connect my SBC to a network it detect the router and use the DHCP address but if I’m connecting it to my laptop I want it to use some priority, first boot try 10-15sec to use any available DHCP if no, to Fall on a pre-configured Static IP.
How I can achieve that ?
On RPi OS, dhcpcd
is used as only network tool, while we use ifupdown
and the isc-dhcp-client
. I am not aware of an automatic fallback via ifupdown
resp. /etc/network/interfaces
, but the DHCP client config might have something: dhclient.conf(5) — isc-dhcp-client — Debian bookworm — Debian Manpages
The prepend
statement sounds like it would serve your needs: Have certain option applied first, then have the DHCP server overriding them, if there is one.
I found it, and it’s working great 
I Added this code
timeout 10;
lease {
interface "eth0";
fixed-address 10.0.0.10;
option subnet-mask 255.255.255.0;
option routers 10.0.0.10;
renew 2 2053/1/12 00:00:01;
rebind 2 2053/1/12 00:00:01;
expire 2 2053/1/12 00:00:01;
}
1 Like