
A static IP address ensures your Raspberry Pi is always reachable at the same network address instead of receiving a new one from the router each time it boots. This is particularly important when the Pi provides a service that other devices must reliably find, such as SSH access, a web server, Home Assistant, Pi‑hole, a Minecraft server or anything behind a port‑forward on your router.
When to use a static IP on the Pi vs. a DHCP reservation on the router:
- Use a static IP on the Pi when you fully control the device and network segment or when your router can’t create DHCP reservations.
- Prefer a DHCP reservation (a “static lease”) on the router if possible. The router will still hand out the address via DHCP but always assign the same one to the Pi’s MAC address. This avoids address conflicts and centralizes IP management.
If you configure the address on the Pi, choose one outside the DHCP pool of your router. Otherwise the router may hand the same address to another device.
Which method applies to your Raspberry Pi OS version?
Raspberry Pi OS changed its network stack with Bookworm (released in October 2023):
- Bookworm and later use NetworkManager.
/etc/dhcpcd.confno longer exists there and editing it has no effect. - Bullseye and earlier use
dhcpcd.
Check your version and the active network service:
1grep VERSION_CODENAME /etc/os-release
2systemctl is-active NetworkManagerIf NetworkManager is active, follow the NetworkManager section. Otherwise use the dhcpcd section.
The examples use 192.168.1.100/24 as the Pi’s address and 192.168.1.1 as router and DNS server. Replace these values with the ones of your network.
Bookworm and later: NetworkManager
- List the connections and note the name of the one you want to change:
nmcli connection showThe wired connection is usually named Wired connection 1; a Wi-Fi connection is usually named after its SSID.
- Set the static address, gateway and DNS server:
sudo nmcli connection modify "Wired connection 1" ipv4.method manual ipv4.addresses 192.168.1.100/24 ipv4.gateway 192.168.1.1 ipv4.dns 192.168.1.1- Reactivate the connection to apply the change:
sudo nmcli connection up "Wired connection 1"If you are connected via SSH, the session drops when the address changes. Reconnect to the new address.
As an alternative to the command line, sudo nmtui offers a text-based UI for the same settings.
Bullseye and earlier: dhcpcd.conf
- Open the
dhcpcd.conffile in a text editor:
sudo nano /etc/dhcpcd.conf- Add the following lines at the end of the file, replacing
eth0with your network interface (useip ato find your interface name; Wi-Fi is usuallywlan0):
1interface eth0
2static ip_address=192.168.1.100/24
3static routers=192.168.1.1
4static domain_name_servers=192.168.1.1Save the file and exit the text editor.
Ctrl + X, thenYandEnterRestart the
dhcpcdservice:
sudo systemctl restart dhcpcdAs with NetworkManager, an SSH session drops when the address changes.
Verify the configuration
Check that the interface has the new address and that the router is reachable:
1ip a
2ping -c 3 192.168.1.1Conclusion
A static IP address is particularly useful when you want to ensure that your Raspberry Pi is always reachable at the same address on the network. This is important for applications that require a constant network connection, such as servers, IoT devices or remote control. On current Raspberry Pi OS versions you configure it with NetworkManager, on older versions through dhcpcd.conf. The address stays the same across reboots; if the Pi moves to a different network, the static configuration has to be adjusted or removed.
Related articles

- 7 min read
Raspberry Pi WS2812B Lightstrip Unit Testing Strategies with .NET
Testing hardware-driven projects pays off quickly. Compared to driving a single LEGO motor, controlling a WS2812B lightstrip involves timing …

- 7 min read
Raspberry Pi WS2812B Lightstrip Control with .NET
In this beginner-friendly guide, you’ll learn how to control a WS2812B (aka “NeoPixel”) LED light strip with a Raspberry …

- 6 min read
Raspberry Build HAT: Unit Testing Strategies with .NET
If you go beyond hobby tinkering and aim for reliable, maintainable software, you need tests. Hardware projects are no exception. In fact, …
Let's Work Together
Looking for an experienced Platform Architect or Engineer for your next project? Whether it's cloud migration, platform modernization or building new solutions from scratch - I'm here to help you succeed.
