1

I have used dhcpd on my Raspberry Pi with Stretch Lite installed to configure my static IP, however this will only work on the private robot network. When testing and developing, I connect it to my home network to SSH into it.

How can I set a static IP for one network, but use a dynamic one on all other networks? Both are connected with the eth0 interface.

1

Fallback profile

It is possible to configure a static profile within dhcpcd and fall back to it when DHCP lease fails. This is useful particularly for headless machines, where the static profile can be used as "recovery" profile to ensure that it is always possible to connect to the machine. The static profile is setup as any other Static IP Address

# define static profile
profile static_eth0
static ip_address=⋯
static routers=⋯
static domain_name_servers=⋯

# fallback to static profile on eth0
interface eth0
fallback static_eth0

See How to set up networking/WiFi

|improve this answer|||||

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.