If you use a Raspberry Pi as a server, an ad blocker or a smart home hub, it needs an address that never changes. In other words, it needs a static IP on a Raspberry Pi. Otherwise, one day your router gives it a new IP and everything that depends on it stops working.
This guide shows three ways to set a static IP on a Raspberry Pi: a router reservation (the easiest), NetworkManager on Raspberry Pi OS Bookworm and newer, and dhcpcd on older versions.

Before You Set a Static IP on a Raspberry Pi
First, find your current network details. On the Raspberry Pi, run:
ip -4 addr show
ip route | grep default
The first command shows the current IP and prefix, such as 192.168.1.37/24. The second shows your router, called the gateway, for example 192.168.1.1. If these terms are new, our guide to IP addresses, routers and DNS explains them clearly.
Next, pick an address in the same network that your router does not hand out automatically. Many routers assign addresses from .100 upwards, so something like 192.168.1.50 is usually safe. Not sure which addresses belong to your network? Our free subnet calculator shows the full usable range.
🛒 What you need
As an Amazon Associate, Arelvox earns from qualifying purchases. This does not change the price you pay.
Method 1: Reserve the IP in Your Router (Recommended)
The simplest and most reliable option is a DHCP reservation. You tell your router to always give the Raspberry Pi the same address, and you do not change anything on the Pi itself.
- Log in to your router, usually at 192.168.1.1 or 192.168.0.1.
- Find the section called DHCP, LAN or Address Reservation.
- Select your Raspberry Pi from the list of connected devices, or enter its MAC address.
- Choose the IP you want and save.
- Reboot the Pi so it picks up the reserved address.
Because the router manages everything, this method also survives reinstalling the operating system.
Method 2: NetworkManager on Raspberry Pi OS Bookworm and Newer
Since Raspberry Pi OS Bookworm, network settings are handled by NetworkManager. First, list your connections:
nmcli con show
A wired connection is usually called “Wired connection 1”, and a Wi-Fi network set up with Raspberry Pi Imager is usually called “preconfigured”. Then set the static IP, replacing the name and addresses with your own:
sudo nmcli con mod "Wired connection 1" ipv4.method manual ipv4.addresses 192.168.1.50/24 ipv4.gateway 192.168.1.1 ipv4.dns "1.1.1.1 9.9.9.9"
sudo nmcli con up "Wired connection 1"
If you are connected over SSH, your session will drop when the address changes. Simply reconnect to the new IP. Alternatively, run sudo nmtui for a menu-based editor that does the same job.
Method 3: dhcpcd on Older Raspberry Pi OS Versions
On Bullseye and older releases, network settings live in /etc/dhcpcd.conf. Open the file:
sudo nano /etc/dhcpcd.conf
Then add these lines at the end, using wlan0 instead of eth0 for Wi-Fi:
interface eth0
static ip_address=192.168.1.50/24
static routers=192.168.1.1
static domain_name_servers=1.1.1.1 9.9.9.9
Save the file, reboot, and the Raspberry Pi will use the new address.
Check the Static IP on a Raspberry Pi
ip -4 addr show
ping -c 3 1.1.1.1
ping -c 3 arelvox.com
The first command should show your new static IP. The second checks that the gateway works, and the third checks that DNS works. If the last one fails but the second succeeds, double-check your DNS servers.
What to Do Next
With a fixed address, your Raspberry Pi is ready to act as a real server. For example, you can turn it into a home server or block ads on every device with Pi-hole. To log in securely without a password, follow our guide on how to set up SSH keys.
For more details on networking options, see the official Raspberry Pi configuration documentation.
FAQ: Static IP on a Raspberry Pi
Why does dhcpcd.conf not work on my Raspberry Pi?
Raspberry Pi OS Bookworm and newer use NetworkManager instead of dhcpcd, so changes in dhcpcd.conf are ignored. Use nmcli or nmtui, or set a reservation in your router.
Is a static IP or a DHCP reservation better?
A DHCP reservation is usually better at home, because the router keeps full control and the address survives a reinstall. A static IP on the device is useful when you cannot change the router settings.
Which IP address should I choose for my Raspberry Pi?
Choose an address in the same network as your router that is outside its automatic DHCP range, for example 192.168.1.50 when the router hands out addresses from .100 upwards.