How to Set a Static WiFi IP on Ubuntu (Without Router Access)
-
Jason Yang - 03 Dec, 2025
- Updated 04 Jan, 2026
- Views —
When I use WiFi on my test laptop, its IP address sometimes changes. This forces me to update the configuration on other client devices or reconfigure applications running on the test laptop.
Ideally, I would reserve a fixed IP address directly on the router (DHCP Reservation), but strict security policies prevent me from accessing the router settings.
Therefore, I decided to configure a Static IP address on the test laptop itself. Here is how I did it on Ubuntu 22.04.
0. Environment & Preparation
First, check the OS version:
$ lsb_release -a
# Output: Ubuntu 22.04.4 LTS (Jammy)
Next, identify your WiFi Interface Name and Current Gateway.
(Note: grep 192 might fail if you aren’t currently connected, so ip link is safer.)
# 1. Check Interface Name (Look for wlp... or wlan...)
$ ip link show
# Example Output: 3: wlp3s0: <BROADCAST,MULTICAST,UP...>
# 2. Check Current Gateway (Router IP)
$ ip route | grep default
# Example Output: default via 192.168.1.1 dev wlp3s0 ...
⚠️ Important: Make sure the Static IP you choose (e.g.,
192.168.1.144) is outside the router’s DHCP range to avoid IP conflicts.
Method 1. The Laptop-Friendly Way (Recommended)
Use this method if you want to keep using the top-right WiFi menu.
Ubuntu Desktop uses NetworkManager by default. We can use the nmcli command to set a static IP without breaking the GUI functionality.
1. Find your WiFi Connection Name
$ nmcli connection show
# NAME UUID TYPE DEVICE
# MyOfficeWiFi 59d6-....-.... wifi wlp3s0
2. Set the Static IP
Replace MyOfficeWiFi with your connection name.
# Set IP and Prefix (Subnet Mask)
$ sudo nmcli con mod "MyOfficeWiFi" ipv4.addresses 192.168.1.144/24
# Set Gateway (Your Router IP found in step 0)
$ sudo nmcli con mod "MyOfficeWiFi" ipv4.gateway 192.168.1.1
# Set DNS Servers
$ sudo nmcli con mod "MyOfficeWiFi" ipv4.dns "8.8.8.8 1.1.1.1"
# Switch from Auto (DHCP) to Manual
$ sudo nmcli con mod "MyOfficeWiFi" ipv4.method manual
3. Apply Changes
$ sudo nmcli con up "MyOfficeWiFi"
Now your laptop has a static IP, and you can still easily switch WiFi networks using the system tray icon when you go home or to a cafe.
Method 2. The Server/Hard-coded Way (Netplan)
Use this method for Headless Servers or fixed devices.
Warning: Changing the renderer to networkd disables the Ubuntu Desktop WiFi GUI menu.
1. Locate and Backup Configuration
$ cd /etc/netplan
$ ls
# 01-network-manager-all.yaml
$ sudo cp 01-network-manager-all.yaml 01-network-manager-all.org
2. Edit the Netplan YAML File
$ sudo vim 01-network-manager-all.yaml
Modify the file as follows. Ensure indentation (2 spaces) is correct.
network:
version: 2
renderer: networkd # Note: This disables NetworkManager GUI!
wifis:
wlp3s0: # Your Interface Name
dhcp4: no
addresses:
- 192.168.1.144/24
routes:
- to: default
via: 192.168.1.1 # Your Gateway IP (Check carefully!)
nameservers:
addresses: [8.8.8.8, 1.1.1.1]
access-points:
"Your_WiFi_SSID":
password: "Your_WiFi_Password"
3. Apply Configuration
$ sudo netplan try
# If no errors, press Enter to accept.
Summary: Which Renderer Should I Use?
The renderer determines which backend manages your network.
| Renderer | Description | Best For |
|---|---|---|
| NetworkManager | Desktop-oriented. Managed via GUI or nmcli. Supports auto-switching WiFi. | Laptops, Desktops with GUI |
| networkd | Lightweight and stable. Controlled strictly by config files. | Servers, IoT Devices, Fixed setups |
Note: On Ubuntu Desktop, switching the renderer to networkd may disable WiFi entirely on some laptops, depending on driver support.
For my test laptop, I realized keeping NetworkManager (Method 1) is better for mobility, but Method 2 is great for understanding how Ubuntu networking works under the hood.