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!

Seamus
  • 23,558
  • 5
  • 42
  • 83
ArtB
  • 31
  • 1
  • 1
  • 3

2 Answers2

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.

Seamus
  • 23,558
  • 5
  • 42
  • 83
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

SEWTGIYWTKHNTDS
  • 458
  • 3
  • 8