Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 2550

Raspberry Pi OS • Re: Static IP with Bookworm

$
0
0
It is sad even the online rpi os manual doesn't just reference your solution.
It is not surprising that i doesn't. It is an old, outdated way of managing networking.

Using Network Manager is the current method for Raspberry Pi OS. Use the nmcli or nmtui commands to set up connections.
At least the "old, outdated way" did not insist on launching wpa_supplicant ... on a B+ that has no wifi :roll:
[EDIT: OK my bad, wpa_supplicant.service is enabled separately.]

I absolutely do not want NetworkManager or anything like it on the Pi I'm currently rebuilding because it is going to be the DHCP/DNS server for my network. It will be the fixed point that facilitates the easy life for the other hosts. Is such a role thought inconceivable?

There is no defensible rationale for having a running config daemon for a static config that can be brought up with 3 pithy lines of bash even without the old-skool ifup scripts. It just gets in the way and wastes cycles (did I mention B+?)

Also for this server-role I'll use dnsmasq, but I note that there are dnsmasq-related config dirs in /etc/NetworkManager/ - I don't know why, and I'd much rather never have to learn why, especially not the hard way when it collides with my own usage of it.

EDITED TO ADD:
I feared there would be a lot to unpick, but it's not too bad. A key point is that Bookworm has removed the old functionality but it is still available (for now?) in the ifupdown package.

So, steps to setup a static wired connection and dispense with NetworkMangler...

1.

Code:

$ apt install ifupdown
(The networking service is enabled automatically.)

2. Add settings to /etc/network/interfaces.d/eth0 (adjust for your own network)

Code:

auto eth0iface eth0 inet static address 192.168.1.10 netmask 255.255.255.0 gateway 192.168.1.1
3. Add your DNS servers in /etc/resolv.conf (ditto)

Code:

nameserver 192.168.1.1nameserver 8.8.8.8
4. Disable unneeded services

Code:

$ systemctl disable NetworkManager(and if you happen not to have or be using wifi)$ systemctl disable wpa_supplicant
5. Reboot.

DISCLAIMER: No warranty implied. It worked for me today, it may not work for you tomorrow. NetworkManager is fine really, I use it on many boxes, it's just a bad fit in some scenarios.

Statistics: Posted by Havinit — Sun Jan 12, 2025 3:19 pm



Viewing all articles
Browse latest Browse all 2550

Trending Articles