
Setting a static IP on Raspberry Pi is essential for reliable network connectivity. If you’re working on any raspberry pi project, you’ve probably run into that annoying moment when your Raspberry Pi just disappears from the network. You try to SSH into it or access a local web dashboard, but suddenly it's not there. You fire up the terminal and type ping raspberrypi.local and nothing. It turns out, your router handed the Pi a different IP address this time, and now you have to go hunt it down again.
This happened to me more times than I’d like to admit, especially while working on IoT projects, setting up MQTT servers, or running home automation scripts that needed the Pi to be reliably reachable. If your Raspberry Pi keeps getting different IP addresses from your router, this guide will show you how to configure a static IP address on Raspberry Pi using both NetworkManager (nmcli) and the desktop GUI method.
I Thought I Knew How to Set a Static IP on Raspberry Pi Until It Didn't Work
Like many others, I started by editing /etc/dhcpcd.conf That’s what almost every Raspberry Pi static IP tutorial tells you to do. I added all the correct lines, rebooted, and nothing changed. The Pi still grabbed a random IP from my router.
At first, I assumed I did something wrong. But after checking and retrying a few times, it became clear that something deeper was going on. That’s when I discovered that recent versions of Raspberry Pi uses NetworkManager by default. And when NetworkManager is in charge, dhcpcd.conf gets completely ignored.
If you’re running the latest Pi OS and your static IP settings just won’t stick, this might be exactly what’s happening to you too.
Why I Prefer the nmcli Method for Static IP on Raspberry Pi Now
Honestly, this approach feels way more modern. Unlike the old dhcpcd.conf trick, which can be silently overridden or ignored, using NetworkManager’s CLI gives me full control over networking. It also works well for both Wi-Fi and Ethernet interfaces, and even works well with Raspberry Pi headless setup.
If you're using Raspberry Pi OS Bookworm or anything released recently, this is the method you should go with especially if dhcpcd.conf isn't behaving the way you expect.
Why Set a Static IP on Raspberry Pi?
Let me break it down: your Raspberry Pi, by default, gets its IP address dynamically from the router using DHCP. That means every time it reboots, there’s a chance it’ll get a different address. While this might be okay for casual use, it becomes a nightmare when you’re working on more advanced setups like:
⇒ Remote SSH or VNC connections
⇒ Hosting a local web server or dashboard
⇒ Setting up a home assistant or smart devices
⇒ Configuring port forwarding to access your Raspberry Pi from outside your network
⇒ Using the Pi as an MQTT broker, file server, or NAS
All of these use cases benefit from having a fixed IP address. It gives your networked Pi a stable presence like a permanent desk in a shared office, so everything else knows exactly where to find it.
Method 1: Set Static IP on Raspberry Pi Using nmcli (NetworkManager)
Once I realized that dhcpcd.conf wasn’t going to work, I started exploring how to use NetworkManager to handle static IP configuration. The good news is that NetworkManager has a powerful command-line interface called nmcli, and once you get the hang of it, it’s actually pretty straightforward.
Here’s how I got a fixed IP address working on my Raspberry Pi using nmcli.
Step 1: Get Your Current IP Address
Before setting anything, I wanted to know what IP address my Pi was currently using. This gives a good starting point to avoid conflicts and confirm my network is active.
In the terminal, I ran:
hostname -I

This printed the current IP address, which in my case was something like 192.168.29.71. It’s the temporary, dynamic address assigned by the router via DHCP.
Step 2: Find Your Default Gateway (Your Router’s IP)
Next, I needed to get my router’s IP address. This is the gateway the Pi uses to access the internet and other devices on the LAN. I used this command:
ip r | grep default
This showed me something like:

So, my gateway is 192.168.29.1. That’s what I’ll use later for both the gateway and dns fields.
Step 3: Check Your Current Network Connection Name
Since I was connected over Wi-Fi, I had to find the name of the active wireless profile. With NetworkManager, every connection has a name (usually the same as your SSID). I listed them using:
nmcli connection show
This printed a list of known and active connections. I saw my Wi-Fi connection listed as:

So in my case, "Circuit Digest" was the name of my active connection. If you’re using Ethernet, you’ll probably see something like Wired connection 1.
Step 4: Check Existing IPv4 Info (Optional but Handy)
Before overwriting anything, I wanted to peek at the current IPv4 settings. This command shows just the IPv4 configuration for the connection:
nmcli connection show "Circuit Digest" | grep ipv4

This told me how the IP was currently being assigned, usually set to ipv4.method: auto when using DHCP.
Step 5: Set the Static IP Address
Now comes the fun part actually assigning the static IP.
I decided to give my Pi the address 192.168.29.155, which is within my subnet and outside my router’s dynamic DHCP pool. Here’s the exact command I used:
Here’s what each part does:

If you’re using Ethernet instead of Wi-Fi, just replace "Circuit Digest" with the Ethernet connection name.
Step 6: Restart the Connection to Apply Changes
After setting the static IP, I needed to bring the connection down and then back up so the new config would be used.

At this point, the Pi disconnected from Wi-Fi briefly, then reconnected using the new static IP address I assigned.
Step 7: Verify the Static IP Address Is Set
To confirm everything worked, I ran:
hostname -I
This time, the result was:

Perfect. The Raspberry Pi was now using the static IP address I assigned (192.168.29.155), and I could SSH into it, ping it from other devices, and configure port forwarding confidently.
Method 2: Set a Static IP on Raspberry Pi Using the Desktop GUI
While I usually work on Raspberry Pi setups through the terminal, especially for headless projects, there are times when I’m using the Raspberry Pi OS with Desktop. If you’re using the full version with a graphical interface (the one that boots into the familiar desktop environment), you actually don’t need to touch the terminal at all to assign a static IP address.
Note: This method only works if you're using Raspberry Pi OS with Desktop GUI. If you're using Raspberry Pi OS Lite or running your Pi headless (no monitor), this approach won’t be available. For that, you'll need to use the nmcli method I explained earlier.
Setting a Static IP via Raspberry Pi OS GUI
1. Click the Network Icon
First, I clicked on the network icon in the top-right corner of the Raspberry Pi desktop screen. It looks like either a Wi-Fi symbol or two arrows (for Ethernet), depending on how your Pi is connected.

2. Open Advanced Settings > Edit Connections
I selected "Advanced Options" from the menu that popped up, and then clicked "Edit Connections". This opened the Network Connections window, where all configured network profiles are listed.

3. Select the Right Network Connection
Under the Wi-Fi section, I selected my wireless network (in my case, it matched the SSID I was connected to). If you’re using Ethernet, you’d find your wired connection listed there instead.

4. Set Method to Manual
By default, this was set to "Automatic (DHCP)", so I changed it to Manual from the Method dropdown.

5. Go to the IPv4 Settings Tab
Once I selected the connection and clicked Edit, I switched to the IPv4 Settings tab from the menu at the top of the window.

6. Enter the Static IP, Gateway, and Subnet
In the "Addresses" section, I added my desired static IP address, the netmask (CIDR format), and the gateway. For example, I entered:
That tells the Pi to always use 192.168.29.175 as its local IP and send traffic through the 192.168.29.1 router.
7. Enter DNS Server Address
In the DNS Servers field below, I typed in 192.168.29.1 (my router’s address) to use it as the DNS resolver. You could also use a public DNS server like 8.8.8.8 (Google DNS) if you prefer.
8. Click Apply and Reboot
Once everything was entered, I clicked Apply to save the changes. Then I rebooted the Raspberry Pi to make sure the settings would stick.

If you’re running the latest Raspberry Pi OS with NetworkManager and most people are, you'll find that traditional methods like editing /etc/dhcpcd.conf just don’t work anymore. But with nmcli, setting a static IP is not only possible, it’s actually better. You have full control, and it works for both Wi-Fi and Ethernet interfaces.
Whether you’re building an IoT project, setting up a local web server, running Home Assistant, or just want reliable SSH access without IP changes, this static IP configuration is crucial for SSH access, web servers, and IoT projects on your Raspberry Pi.
If you're planning to use this setup for port forwarding, headless setups, or integrating your Raspberry Pi into a multi-device IoT system, let me know I can walk you through those next. Setting a static IP is just the beginning of what a well-networked Pi can do.
Similar Raspberry Pi Networking Projects
Previously, we have built many projects using Raspberry Pi. If you want to know more about those projects, links are given below.
How to Quickly Setup TeamViewer on Raspberry Pi
In this tutorial, we will install TeamViewer in Raspberry Pi to access Desktop from anywhere in the world.
Getting Started with the RASPBERRY PI ZERO W – Headless Setup without Monitor
Learn how to set up the Raspberry Pi Zero W heedlessly SSH access over Wi-Fi using Windows.
Sharing your Wifi Internet over the Ethernet Port of Raspberry Pi
Learn how to connect Raspberry Pi to any Wifi and then share that WiFi’s internet over the LAN port of the Raspberry Pi.
Raspberry Pi based Smart Phone Controlled Home Automation
Explore how to control home appliances through smart phone using Raspberry Pi 3 and Bluetooth.
Voice controlled Home automation using Amazon Alexa on Raspberry Pi
Learn how to build a voice controlled home automation system using Amazon Alexa and Raspberry Pi.