I've tried to set up a static IP on a RPi4 running the latest Raspbian Lite (Bullseye), so I can remove DHCP entirely.
My /etc/network/interfaces
file looks like:
# Include files from /etc/network/interfaces.d:
auto lo
iface lo inet loopback
I also have /etc/network/interfaces.d/wlan0
, which looks like:
auto wlan0
iface wlan0 inet static
address 192.168.0.133
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameservers 192.168.0.1 8.8.8.8 4.4.4.4
If I run ip a
, I get the following output:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether e4:5f:01:20:e9:00 brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether e4:5f:01:20:e9:01 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.133/24 brd 192.168.0.255 scope global wlan0
valid_lft forever preferred_lft forever
inet 192.168.0.132/24 brd 192.168.0.255 scope global secondary dynamic noprefixroute wlan0
valid_lft 6495sec preferred_lft 5595sec
inet6 fdfc:b729:655a:4bd0:4620:dbb9:867b:fc3d/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 1654sec preferred_lft 1654sec
inet6 fe80::eba1:157a:7b52:9b5c/64 scope link
valid_lft forever preferred_lft forever
This looks legit and I can access the Pi on both ...132 and ...133. However, if I disabled dhcpcd.service, I can't access it anymore after a reboot (or if I manually stop dhcpcd.service)
I'm assuming that ifup
is not called, but I may be completely off. It's a bit difficult to get a keyboard and display on the unit right now, which makes debugging this complicated (since I can't access it if it's not on the network).
Any suggestions are deeply appreciated.
EDIT:
I've started the system with DHCP disabled, left it a minute or two and shut it down, so I can have a look at the logs on a different machine. Seems like the network is going up as expected:
Jun 10 12:28:16 rpi-display systemd[1]: Starting Raise network interfaces...
Jun 10 12:28:16 rpi-display avahi-daemon[355]: Server startup complete. Host name is rpi-display.local. Local service cookie is 166240168.
Jun 10 12:28:17 rpi-display avahi-daemon[355]: Joining mDNS multicast group on interface wlan0.IPv4 with address 192.168.0.133.
Jun 10 12:28:17 rpi-display avahi-daemon[355]: New relevant interface wlan0.IPv4 for mDNS.
Jun 10 12:28:17 rpi-display avahi-daemon[355]: Registering new address record for 192.168.0.133 on wlan0.IPv4.
Jun 10 12:28:17 rpi-display systemd[1]: Finished Raise network interfaces.
Resolv.conf has the nameservers I configured:
# Generated by resolvconf
nameserver 192.168.0.1
nameserver 8.8.8.8
nameserver 4.4.4.4