The 2026 Reality: Why Old Static IP Tutorials Fail

If you are searching for how to set static IP Raspberry Pi configurations and following tutorials that tell you to edit /etc/dhcpcd.conf, stop immediately. As of Raspberry Pi OS Bookworm (and continuing into 2026), the dhcpcd daemon has been deprecated and removed from default images. The Pi now uses NetworkManager as its default network configuration tool.

Editing the old dhcpcd.conf file will do absolutely nothing on a modern Pi OS install. Your changes will be ignored, and your Pi will continue pulling a dynamic IP via DHCP. To set a static IP reliably on the Raspberry Pi 5 or Pi 4 running Bookworm or newer, you must use the nmcli (NetworkManager Command Line Interface) tool or the nmtui text-user interface.

Warning: If you are running a legacy Bullseye image, dhcpcd is still active. However, for any new deployment in 2026, you should be on Bookworm or Trixie. This guide strictly targets the modern NetworkManager stack.

Decision Tree: Router DHCP Reservation vs. Pi-Side Static IP

Before typing commands, decide where the IP assignment should live. Assigning IPs at the router level (DHCP reservation) is generally safer for home networks, while Pi-side static IPs are mandatory for isolated industrial or headless IoT subnets.

Criteria Router DHCP Reservation Pi-Side Static IP (NetworkManager)
Portability Breaks if moved to a new network Travels with the Pi (can cause conflicts if subnet differs)
Headless Boot Speed Slower (waits for DHCP timeout if router is down) Instant (applies IP immediately on link-up)
IP Conflict Risk Zero (router manages the pool) High (if you pick an IP inside the router's DHCP pool)
Best Use Case Home media servers, desktop replacements Headless IoT nodes, isolated VLANs, industrial sensors

The Decision Path:
Are you deploying this Pi on a managed home network with a reliable router? Yes → Use Router DHCP Reservation.
Is this Pi going into a standalone switch, an isolated VLAN, or a headless sensor network where DHCP servers may be intermittently offline? Yes → Use Pi-Side Static IP.
Concrete Pick: For 100% uptime guarantee on headless nodes and embedded projects, execute the Pi-side nmcli configuration detailed below, ensuring your chosen IP sits strictly outside the router's dynamic DHCP pool.

Hardware & Interface Mapping

This guide and the provided code target the Raspberry Pi 5 (8GB variant) and the Raspberry Pi 4 Model B (Rev 1.5) running Raspberry Pi OS Bookworm (64-bit). The physical ports map to logical interfaces in NetworkManager as follows:

Physical Port Logical Interface Default NetworkManager Connection Name MAC Address Source
Gigabit Ethernet Jack eth0 Wired connection 1 Hardware EEPROM (USB-C power side)
Onboard WiFi (2.4/5GHz) wlan0 MyWiFiNetwork (varies) Hardware EEPROM
USB-to-Ethernet Adapter eth1 or enx... Wired connection 2 Adapter USB MAC

Step-by-Step: Setting the Static IP via nmcli

For this example, we are assigning 192.168.1.50 to the Ethernet interface. Ensure this IP is outside your router's DHCP range (e.g., if your router hands out .100 to .200, .50 is safe).

  1. Identify your active connection name. NetworkManager uses connection profiles, not just interface names. Run:
    nmcli connection show
    Look for the active connection tied to eth0. It is usually named Wired connection 1.
  2. Modify the IPv4 address and method. Replace the connection name if yours differs:
    sudo nmcli connection modify "Wired connection 1" ipv4.addresses 192.168.1.50/24
    sudo nmcli connection modify "Wired connection 1" ipv4.gateway 192.168.1.1
    sudo nmcli connection modify "Wired connection 1" ipv4.dns "1.1.1.1 8.8.8.8"
  3. Set the method to manual (static).
    sudo nmcli connection modify "Wired connection 1" ipv4.method manual
  4. Apply the changes by restarting the connection.
    sudo nmcli connection down "Wired connection 1" && sudo nmcli connection up "Wired connection 1"
Pro Tip: If you are doing this over an active SSH session, running the down and up commands will instantly drop your connection. You will need to reconnect using the new static IP address you just assigned.

Automated Bash Script with Error Handling

For fleet deployments or repeatable project builds, use this Bash script. It includes interface validation, connection cleanup, and strict error handling. Save it as set_static_ip.sh, make it executable (chmod +x set_static_ip.sh), and run it with sudo.

#!/bin/bash
# Target Board: Raspberry Pi 5 (8GB) / Pi 4 Model B
# Target OS: Raspberry Pi OS Bookworm (64-bit) or newer
set -euo pipefail

# --- Configuration Variables ---
IFACE="eth0"
CONN_NAME="eth0-static-profile"
STATIC_IP="192.168.1.50/24"
GATEWAY="192.168.1.1"
DNS="1.1.1.1,8.8.8.8"

# --- Error Handling Trap ---
trap 'echo "[ERROR] Static IP configuration failed at line $LINENO. Verify gateway and subnet mask." >&2; exit 1' ERR

# 1. Verify NetworkManager is active
if ! command -v nmcli &> /dev/null; then
    echo "[FATAL] nmcli not found. Ensure you are on Pi OS Bookworm+ with NetworkManager."
    exit 1
fi

# 2. Verify physical interface exists
if ! ip link show "$IFACE" &> /dev/null; then
    echo "[FATAL] Interface $IFACE not found. Check physical cable or USB adapter."
    exit 1
fi

# 3. Clean up existing profile to prevent merge conflicts
if nmcli connection show "$CONN_NAME" &> /dev/null; then
    echo "[INFO] Deleting existing $CONN_NAME profile..."
    nmcli connection delete "$CONN_NAME"
fi

# 4. Create and apply the new static profile
echo "[INFO] Creating static IP profile for $IFACE..."
nmcli connection add type ethernet con-name "$CONN_NAME" ifname "$IFACE" \
    ipv4.addresses "$STATIC_IP" \
    ipv4.gateway "$GATEWAY" \
    ipv4.dns "$DNS" \
    ipv4.method manual \
    connection.autoconnect yes

# 5. Bring up the connection
echo "[INFO] Activating connection..."
nmcli connection up "$CONN_NAME"

echo "[SUCCESS] Static IP $STATIC_IP applied to $IFACE. Verify with: ip -4 addr show $IFACE"

Troubleshooting: Exact Error Strings and Fixes

When network configurations fail, the terminal output tells you exactly what went wrong if you know how to read it. Here are the most common failure modes when figuring out how to set static IP Raspberry Pi deployments.

The First Three Things to Check

  1. Subnet Mask Mismatch: Did you type 192.168.1.50/24 or just 192.168.1.50? NetworkManager requires the CIDR prefix length (e.g., /24 for a 255.255.255.0 mask). Without it, the Pi assumes a /32 host route and cannot reach the gateway.
  2. IP Pool Collision: Is your chosen static IP inside the router's DHCP pool? If the router hands out .50 to a smartphone, you will experience intermittent packet loss and ARP conflicts.
  3. Connection vs. Interface Name: nmcli modifies connection profiles, not raw interfaces. Modifying eth0 directly will fail if the profile is named Wired connection 1.

Ranked Error Causes and Exact Strings

Exact Error String Root Cause The Fix
Error: unknown connection 'eth0' You passed the interface name to a command expecting a connection profile name. Run nmcli connection show and use the value in the NAME column (e.g., Wired connection 1).
RTNETLINK answers: Network is unreachable The gateway IP you specified is not on the same subnet as your static IP, or the CIDR mask is wrong. Verify your subnet mask. If IP is 192.168.1.50 and Gateway is 192.168.0.1, change mask to /16 or fix the gateway IP.
Error: Connection 'Wired connection 1' is not available on the device eth0 The physical link is down, or the interface is administratively disabled by another service. Check the Ethernet cable. Run sudo ip link set eth0 up before applying the nmcli profile.

Extending and Simplifying Your Network Build

Once your static IP is locked in, you can optimize the Pi for embedded and IoT environments.

How to Extend the Build

  • VLAN Tagging: If your Pi is connected to a managed switch, you can extend the nmcli script to create VLAN sub-interfaces. Use nmcli connection add type vlan con-name "IoT-VLAN" dev eth0 id 20 ipv4.method manual ipv4.addresses "10.0.20.5/24". This is critical for isolating IoT sensor traffic from your main LAN.
  • Multiple Static IPs: Need the Pi to host multiple services on different IPs? Append addresses using the + modifier: sudo nmcli connection modify "eth0-static-profile" +ipv4.addresses 192.168.1.51/24.

How to Simplify the Build (The mDNS Alternative)

If your only reason for setting a static IP is so you don't have to look up the Pi's dynamic IP every time you reboot, you are over-engineering the solution. Raspberry Pi OS includes Avahi (mDNS/Bonjour) out of the box.

Instead of fighting with subnets and gateways, simply leave the Pi on DHCP and access it via its hostname:

ssh pi@raspberrypi.local

This resolves automatically on any modern Windows, macOS, or Linux machine on the same Layer 2 broadcast domain. Reserve true static IP configurations for scenarios where DNS/mDNS is unreliable, or where the Pi is acting as a gateway/server for other static-routed subnets.

For deeper reading on the underlying network stack, refer to the official Raspberry Pi NetworkManager documentation and the upstream nmcli manual maintained by the GNOME/RedHat NetworkManager project.