Changing the Raspberry Pi Static IP Address with NetworkManager

Changing the static IP address of a Raspberry Pi is straightforward when NetworkManager is managing the Ethernet connection. This guide covers changing the Pi from 192.168.68.88 to 192.168.68.30 while keeping the existing DNS server at 192.168.68.20.

Before You Start

Make sure the new IP address is not already being used on the network.

In this example:

SettingValue
New IP address192.168.68.30
Subnet/24
Gateway192.168.68.1
DNS server192.168.68.20
DNS search domainorder.realm
Interfaceeth0
NetworkManager connectionWired connection 1

Check that the new address is free:

ping -c 3 192.168.68.30

If there is no response, it should be safe to use.

Identify the Network Connection

First, list the NetworkManager connections:

nmcli connection show

On this Pi, the active Ethernet connection was:

NAME                UUID                                  TYPE      DEVICE
Wired connection 1  bf66f5e3-3914-33ce-9c4c-2a8770f38b07  ethernet  eth0
docker0             291ac5e9-4f4f-415b-9d39-39a5e0ed4bf1  bridge    docker0
lo                  e9fe24a3-1611-42d5-a5f7-1be0c9f4cfa0  loopback  lo
NetherRealm         9e7b7ff2-3340-4876-8555-e1aa876e476c  wifi      --

The important entry is Wired connection 1, which is attached to eth0.

Change the IP Address

Set the new static IP address:

sudo nmcli connection modify "Wired connection 1" ipv4.addresses 192.168.68.30/24

Set the gateway:

sudo nmcli connection modify "Wired connection 1" ipv4.gateway 192.168.68.1

Keep the DNS server at 192.168.68.20:

sudo nmcli connection modify "Wired connection 1" ipv4.dns "192.168.68.20"

Set the DNS search domain:

sudo nmcli connection modify "Wired connection 1" ipv4.dns-search "order.realm"

Make sure the connection is configured for a manual/static address:

sudo nmcli connection modify "Wired connection 1" ipv4.method manual

Reboot the Pi

Once the changes have been made:

sudo reboot

The current SSH/Termius session will disconnect as the Pi reboots.

Reconnect using the new address:

192.168.68.30

Verify the Configuration

Once connected again, check the Ethernet address:

ip addr show eth0

You should see:

192.168.68.30/24

Then check the DNS configuration:

cat /etc/resolv.conf

The DNS server should remain:

nameserver 192.168.68.20

Final Configuration

The Raspberry Pi should now be configured as:

IP address:    192.168.68.30
Subnet:        255.255.255.0
Gateway:       192.168.68.1
DNS:           192.168.68.20
Search domain: order.realm
Interface:     eth0

Important

Changing the Pi’s IP address does not change the DNS server. In this setup, 192.168.68.20 remains the DNS server while the Pi itself moves from 192.168.68.88 to 192.168.68.30.

This is particularly useful when the Pi hosts services such as Home Assistant, Docker containers, Node-RED or MQTT, as it provides a consistent address for accessing those services.