-1

Friends,

I'm attempting to position Pi CM4-based devices on a collection of remote LANs and to connect them to my VPN. Each is configured with a static IP. I'm having problems, in some locations but not everywhere, with the Pis coming up without a default route for eth0, which keeps the VPN from connecting.

I read that I should comment out the line "option classless_static_routes", but that didn't help. I double-checked that /etc/network/interfaces ended with "source-directory /etc/network/interfaces.d" and that that .d subdirectory was empty, but no change there either.

The final recommendation in a number of threads was to have the network administrator change a DHCP setting, but that's really not an option for me. I'm trying to not use DHCP at all, but it seems it may be fiddling with me anyway.

Here's the last bit of my dhcpcd.conf:

# Example static IP configuration:
interface eth0
static ip_address=10.1.10.13/24
static router = 10.1.10.1
static domain_name_servers=8.8.8.8

And here's a bit of config info in case it's useful:

Linux xxxxx 5.10.17-v7l+ #1421 SMP Thu May 27 14:00:13 BST 2021 armv7l GNU/Linux

dhcpcd/stable 1:3.2.3-11 armhf

I'm to the point of ripping out dhcpcd altogether, but I'm not sure how to proceed with that and not eager to start tearing things up. Is there a later fix to this, which seems like a not-unfamiliar problem? If not, can anyone suggest the best way for me to proceed?

Thanks!

1
  • So in the meantime I uninstalled dhcpcd and configured my static interface the slightly-more-old-fashioned way in interfaces.d. So far I haven’t perceived any loss of function although if there’s something in particular I should watch out for I’d appreciate any heads up. Thanks all!
    – ArtB
    Sep 17 '21 at 23:03
1

can anyone suggest the best way for me to proceed?

Yes...

First thing to check is your syntax. I don't recall there being any white space in the configuration statements.

Next, know that dhcpcd works well. The people who have issues seem always to have the same problem as you: they read and follow various blogs on the Internet which are incompetent, inaccurate, or incorrect for a particular use-case.

My first suggestion is to read man dhcpcd and man dhcpcd.conf. Once you've done that, you will be informed that you should not use the static ip_address= option in /etc/dhcpcd.conf; man dhcpcd.conf is specific about this:

For IPv4, you should use the inform ipaddress option instead of setting a static address.

If you use the inform ipaddress option in /etc/dhcpcd.conf, you will effectively have a static IP address, and you will see it in your router's DHCP table of leases.

The dhcpcd documentation available from the Arch Linux project is also quite good & contains some hints that may help you.

Finally, if you prefer not to use dhcpcd, and you understand why it's not best for your networking environment, you have one or two other options:

  1. You may wish to try systemd-networkd. There is an excellent Q&A here on RPi SE that covers how to set up systemd-networkd in some detail.

  2. If you have an RPi 4, you can configure the bootloader to skip the DHCP process entirely, and assign a static IP address during the boot process. N.B. I have not tried this myself, and the "official documentation" is characteristically sparse on details, so be prepared to experiment.

0

Are you sure that the line

static router=10.1.10.1

is correct, my /etc/dhcpcd.conf has the equivalent of

static routers=10.1.10.1

note the plurality of routers, it never seems to fail, the man page has the plural version too

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.