“Stable connections, predictable addressing, and fewer networking headaches — that’s the power of static IPs.”
Whether you’re building a smart home hub, running a local web server, or setting up a Pi-hole, giving your Raspberry Pi a static IP address is one of the smartest networking steps you can take. No more wondering what your Pi’s IP is after a reboot — it’ll always be right where you left it.
This article walks you through how to do it like a pro using nmcli
(NetworkManager’s command-line interface), and also offers a quick detour for those using the Raspberry Pi Desktop environment.
🛠️ CLI First: Setting a Static IP with nmcli
If you’re running Raspberry Pi OS Lite or prefer SSH and the terminal (and we salute you for it), nmcli
is a clean, powerful way to configure your networking.
✅ Step 1: Identify Your Connection
Open a terminal or SSH session and run:
bashCopyEditnmcli con show
This will list all connections. Look for something like:
nginxCopyEditWired connection 1
(If you’re on Wi-Fi, it might show wlan0
or similar.)
✅ Step 2: Set the Static IP
Here’s the full command to set a static IP address:
bashCopyEditnmcli con mod "Wired connection 1" \
ipv4.addresses 192.168.0.198/24 \
ipv4.gateway 192.168.0.1 \
ipv4.dns "192.168.0.90 192.168.0.92" \
ipv4.method manual
✔️ Replace values to match your local network settings:
192.168.0.198/24
— your desired static IP address192.168.0.1
— your gateway/router IP192.168.0.90
and192.168.0.92
— your DNS servers (could be Pi-hole or Google DNS)
✅ Step 3: Restart the Connection
Activate the new settings with:
bashCopyEditnmcli con down "Wired connection 1" && nmcli con up "Wired connection 1"
Or reboot the Pi:
bashCopyEditsudo reboot
After rebooting, confirm the new IP:
bashCopyEditip a
🖼️ GUI Option: Using the Raspberry Pi Desktop
If you’re running Raspberry Pi OS with Desktop, setting a static IP is even easier — here’s how.
📋 Step-by-Step via GUI:
- Click the network icon in the top right of the taskbar (next to the clock).
- Select Wired Settings or Wi-Fi Settings, depending on your connection.
- Click the gear ⚙️ icon next to your connection name.
- Go to the IPv4 tab.
- Change the method from Automatic (DHCP) to Manual.
- Enter your:
- Address (e.g.
192.168.0.198
) - Netmask (e.g.
255.255.255.0
) - Gateway (e.g.
192.168.0.1
)
- Address (e.g.
- Enter DNS servers like
192.168.0.90, 192.168.0.92
. - Click Apply, and reconnect the interface or reboot.
💡 Tip:
Use .local
domain names (like raspberrypi.local
) only if mDNS is enabled and you’re on a LAN that supports it. For headless setups, a static IP is far more reliable.
🧠 Bonus Tips
- 🔒 Reserve your IP in the router: Even with static IPs, it’s smart to also reserve that IP on your router to prevent IP conflicts.
- 📜 Use
nmcli con show <connection> | grep ipv4
to verify your current settings. - 🧪 Test before you reboot. Disconnect and reconnect the connection with
nmcli
to ensure everything works smoothly.
🎯 Conclusion
Setting a static IP is a small step that pays off big in network stability and service reliability. Whether you’re configuring your Raspberry Pi as a local DNS resolver, web server, or just a dependable smart node, nmcli
gives you precise control — no cables unplugged, no desktop required.
Ready to go pro? Set it once, forget it forever. 💻🔌