Restore Ubuntu Network Configuration โ DHCP
Recover WiFi from static IP issues โ back to stable automatic DHCP mode
๐ด Recommended when: static IP configuration causes instability
- โ ๏ธ WiFi fails during boot
- โ ๏ธ "Activation of network connection failed"
- โ ๏ธ IP configuration could not be reserved
- โ ๏ธ DHCP previously worked normally
- โ ๏ธ Static IP caused random disconnects
1
Check Existing Network Connections
Open a terminal and list all saved connections:
nmcli connection show
๐ก Example output:
NAME UUID TYPE DEVICE
MyWifi xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx wifi wlp1s0b1
NAME UUID TYPE DEVICE
MyWifi xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx wifi wlp1s0b1
๐ Take note of your WiFi connection name โ e.g., MyWifi. You will need it in next commands.
2
Switch to DHCP (auto)
Replace "MyWifi" with your actual connection name and run:
nmcli connection modify "MyWifi" ipv4.method autoโ
This forces IPv4 configuration back to Automatic DHCP.
3
Remove Old Static IP Settings
Clear any leftover static IP, gateway, and DNS entries:
nmcli connection modify "MyWifi" ipv4.addresses ""nmcli connection modify "MyWifi" ipv4.gateway ""nmcli connection modify "MyWifi" ipv4.dns ""
๐ก Note: Replace "MyWifi" with your connection name. Empty strings fully erase previous static config.
4
Restart NetworkManager
Apply changes by restarting the networking service:
sudo systemctl restart NetworkManagerโณ Wait 10โ15 seconds for the service to fully reload.
5
Disconnect & Reconnect WiFi
Refresh the connection manually:
nmcli connection down "MyWifi"nmcli connection up "MyWifi"
6
โ ๏ธ If Connection Still Fails
If DHCP still doesn't work, delete the corrupted WiFi profile entirely:
nmcli connection delete "MyWifi"Then restart NetworkManager again:
sudo systemctl restart NetworkManagerNow reconnect from the Ubuntu GUI: click WiFi icon โ select your SSID โ enter password.
๐ด IMPORTANT: Do not configure static IP. Leave IPv4 Method = Automatic (DHCP).
๐ด IMPORTANT: Do not configure static IP. Leave IPv4 Method = Automatic (DHCP).
7
Verify DHCP IP Address
Check your interface gets an IP from DHCP:
ip addr
๐ป Look for your WiFi interface (e.g., wlp1s0b1).
You should see something like: inet 192.168.1.25/24 (dynamic range).
You should see something like: inet 192.168.1.25/24 (dynamic range).
8
Verify Default Gateway
Confirm the routing table shows a correct default route:
ip route
โ
Expected output: default via 192.168.1.1 dev wlp1s0b1 (your router IP)
9
Test Internet Connectivity
Ping a domain to validate DNS + internet access:
ping google.com
๐ข You should see 64 bytes from ... replies. Press Ctrl+C to stop.
10
Recommended Next Step
After DHCP is stable, prefer hostname-based access instead of static IP:
- Use server-hp.local or hostname.local for reliable access.
- Avoid manual static IP assignments to prevent future NetworkManager conflicts.
๐ Benefits: stable boot networking ยท automatic IP management ยท fewer connectivity failures.
๐ง Optional Cleanup (Highly Recommended)
Disable WiFi power saving โ improves stability on Ubuntu laptops & avoids random disconnects.
Create NetworkManager config file:
sudo nano /etc/NetworkManager/conf.d/wifi-powersave.confAdd the following lines:
[connection]wifi.powersave = 2
Save file (Ctrl+O, then Ctrl+X) and restart NetworkManager:
sudo systemctl restart NetworkManager
โ
This setting completely disables Wi-Fi powersave, often resolving roaming delays and dropouts.
๐ DHCP mode = โจ automatic addresses
โ ๏ธ Never set static IPv4 on this connection
Comments