Insights

How to set a static IP address on a Raspberry Pi

Reserve a local IP for your Raspberry Pi on the router, or set it with NetworkManager. Then verify the address, DNS, and service access.

Illustration of Wi-Fi router with Pi-shaped recess.
On this page

To keep the same local IP address on your Raspberry Pi, reserve it on your router and leave the Pi on automatic addressing. This is called a Dynamic Host Configuration Protocol (DHCP) reservation. If you need to set the address on the Pi itself, use NetworkManager if it manages that connection.

In short:

  • Reserve it first. Let the router give the Pi the same address each time.
  • Set it manually. If the Pi must set its own address, pick an unused one outside the router's automatic address pool.
  • Check after reconnecting. Confirm the address, how it was assigned, and whether the service and name lookups work.

Where to set the fixed address

Use a router reservation on a typical home network. The router still supplies the Pi's address, gateway and Domain Name System (DNS) settings. The gateway is the router address the Pi uses to reach other networks.

These are two ways to set the address, not two parts of the same setup. With manual configuration, you put those values in the Pi's connection profile. Use it when the Pi needs to set its own address and you know the right settings for your network.

Reserve the address on your router

For either method, change settings only on a network you administer. Record the current settings and make sure you can access the Pi locally if reconnecting drops your remote session.

  1. Find the interface you use to reach the service. Note its Media Access Control (MAC) address, which identifies that interface. Ethernet and Wi-Fi have different MAC addresses.
  2. Add the reservation on the router. Look in the local network or DHCP settings, since menu names vary by router. Pair the intended address with the interface's MAC address and save the entry.
  3. Reconnect the Pi with automatic addressing still on. Reconnect the same interface so the Pi requests an address from the router.

Set the address on the Pi if you need to

NetworkManager is the default in Raspberry Pi OS Bookworm and was optional in Bullseye. A Bullseye Pi that uses NetworkManager can follow the same steps as a Bookworm Pi still using its default manager. Check the active profile instead of relying on the release name.

Use the Raspberry Pi OS terminal. These steps change only Internet Protocol version 4 (IPv4) settings.

1. List the active NetworkManager connections.

nmcli connection show --active

Match the device to the Ethernet or Wi-Fi interface you want to configure and note its profile name. If you don't see that interface, don't apply the commands to a guessed profile.

2. Choose an unused address on the same subnet, outside the DHCP pool.

The subnet is the local block of addresses, and the DHCP pool is the range the router hands out automatically. For this example, assume the pool runs from 192.168.1.100 to 192.168.1.199, that 192.168.1.210 is unused on the same subnet, and that /24 is the correct prefix for that subnet. Assume you've confirmed that 192.168.1.1 is both the gateway and the DNS server.

3. Save the manual settings in the profile.

Replace Example wired with your profile name. Replace the example address, prefix, gateway and DNS server with your own values.

sudo nmcli connection modify "Example wired" ipv4.method manual ipv4.addresses 192.168.1.210/24 ipv4.gateway 192.168.1.1 ipv4.dns 192.168.1.1

4. Activate the profile you just changed.

sudo nmcli connection up "Example wired"

Check the address and try your service

After reconnecting, run these checks on Raspberry Pi OS. For the NetworkManager commands, replace Example wired with the profile name for the intended interface. If you use a different manager with a router reservation, check the same live and saved settings there.

1. Check the live IPv4 address and DNS settings.

nmcli -f active connection show "Example wired"

Look for the intended IPv4 address and DNS servers. The DNS list shows the connection's settings, not which server every app uses.

2. Check how the address was assigned.

nmcli connection show "Example wired"

Look for ipv4.method: manual means the profile sets the address, and auto means it uses automatic addressing. For a reservation, also check that the router's saved entry pairs the intended address with the active interface's MAC address. Seeing the same address again doesn't prove there's a reservation. If the live address is wrong, check the active profile and, if you used a reservation, the router's MAC entry before editing again.

3. Try the service by address from another device on the local network.

Use the service's usual client and connect to the Pi's address on its usual port. A successful connection confirms the client can reach the service at the new address. If the address matches but the service doesn't respond, check that it's running and listening on the expected port before changing the address again.

4. Check name resolution separately on the Pi.

Use a DNS lookup tool on the Pi to look up a hostname it needs. An address in the result shows the Pi could resolve that name. If only name lookups fail, check DNS. If local connections work but the Pi can't reach other networks by address, check the gateway on the intended interface.

What stays local

Both methods give the Pi a predictable local address. Neither makes the public address from your internet provider fixed or changes who can reach the service from outside your network.

Where doxx.net fits. doxx.net is a separate private network where people and agents can share private channels. If you also need that kind of network, get the doxx.net app for a supported device.

Ask an AI assistant

Share this article

Private Everywhere

Stop giving the internet everything

Keep your browsing, messages, files, and agents private.