2

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
    Commented Sep 17, 2021 at 23:03

2 Answers 2

2

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

2

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.

UPDATE: Dec 12, 2022: Despite the mis-informed comment to the contrary below, the line quoted above IS in man dhcpcd.conf. Use the search feature in less if you have trouble finding it.

If you use the inform ipaddress option in /etc/dhcpcd.conf, you will effectively have a static IP address, but you may not see it in your router's DHCP table of leases. You'll need to create a static reservation in your DHCP server; see your router/firewall documentation for instructions.

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.

4
  • 2
    What you wrote actually doesn't make sense at all. Nor MAN page not official examples mention what you propose. Just take a look at /etc/dhcpcd.cong and you'll find a commented-out static profile boarding IPv4 config. It wouldn't work on raspbian by default. that's it.
    – Vega4
    Commented May 23, 2022 at 14:52
  • @Vega4: Really... I don't know where you're getting your information, but it's incorrect. If you've got something you feel is viable, you're welcome to post your own answer.
    – Seamus
    Commented May 25, 2022 at 4:46
  • /etc/dhcpcd.conf interface eth0 static ip_address=192.168.0.10/24 static routers=192.168.0.1 static domain_name_servers=192.168.0.1 8.8.8.8 <- taken directly from the docs you've pointed to AND there's same example directly within the official default config. the 'inform' of yours is not mentioned. As the sample config from official file is commented out it doesn't do a thing.
    – Vega4
    Commented May 25, 2022 at 5:28
  • @Vega4 and Seamus, please be advised to adhere to the be nice policy and cut out the unfriendly language and the personal attacks.
    – Ghanima
    Commented May 25, 2022 at 10:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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