Ashari Abidin's Developer Docs

Reset DHCP on Ubuntu

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
๐Ÿ“ 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 NetworkManager
Now reconnect from the Ubuntu GUI: click WiFi icon โ†’ select your SSID โ†’ enter password.
๐Ÿ”ด 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).
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.conf
Add 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
๐Ÿ“ก Recovery complete โ€” your Ubuntu network now uses DHCP. Red guide ensures stability.
If you still face issues, check router DHCP pool or try deleting the connection profile (step 6) and reconnecting via GUI.
Back