重装Ubuntu后无法连接家庭WiFi,DHCP疑似故障(静态IP可用)
Hey there, I’ve dealt with this exact kind of head-scratcher before—reinstalling Ubuntu, only to have your home WiFi refuse to connect via DHCP while other networks work fine. Let’s walk through some practical fixes to get this sorted:
1. Verify NetworkManager & DHCP Service Status
First, make sure the core network service is running properly:
- Open a terminal and check NetworkManager’s status:
sudo systemctl status NetworkManager - If you see it’s inactive or throwing errors, restart and enable it:
This ensures the service starts automatically on boot too.sudo systemctl start NetworkManager sudo systemctl enable NetworkManager
2. Reset NetworkManager Configuration
Old cached settings from your previous install might be interfering. Let’s wipe them clean:
- Back up existing configs first (just in case):
sudo mv /etc/NetworkManager/NetworkManager.conf /etc/NetworkManager/NetworkManager.conf.bak sudo mv /var/lib/NetworkManager /var/lib/NetworkManager.bak - Restart NetworkManager to generate fresh configs:
Now try connecting to your home WiFi again.sudo systemctl restart NetworkManager
3. Switch to a Different DHCP Client
Ubuntu uses dhclient by default, but sometimes swapping to dhcpcd resolves compatibility issues with certain routers:
- Install
dhcpcd5:sudo apt update && sudo apt install dhcpcd5 - Modify NetworkManager to use this new client:
Add this line under thesudo nano /etc/NetworkManager/NetworkManager.conf[main]section:dhcp=dhcpcd - Save the file (press
Ctrl+O, hit Enter, thenCtrl+X), then restart NetworkManager:sudo systemctl restart NetworkManager
4. Troubleshoot Your Home Router
Don’t rule out the router being the culprit—even if it worked before:
- Reboot the router: Unplug it for 30 seconds, plug it back in, and wait 5 minutes before testing the connection.
- Check DHCP pool limits: Log into your router’s admin panel (usually at
192.168.1.1or192.168.0.1) and make sure the DHCP address pool isn’t full. If it is, expand the range or release unused IPs. - Verify MAC filtering: If your router has MAC address filtering enabled, confirm your Ubuntu machine’s WiFi MAC address is on the allowed list. You can find your MAC with:
(Replaceip link show | grep wlan0wlan0with your actual WiFi interface name if needed.)
5. Diagnose DHCP Traffic with Packet Capture
To narrow down where the issue lies, capture DHCP traffic:
- Run this command in the terminal (replace
wlan0with your WiFi interface):sudo tcpdump -i wlan0 port 67 or port 68 - Try connecting to your home WiFi while the capture runs. You’ll see:
- If you see
DHCPDISCOVERmessages but noDHCPOFFER, the router isn’t responding—focus on router troubleshooting. - If you don’t see any
DHCPDISCOVERmessages at all, the problem is on the Ubuntu side, so revisit the earlier steps.
- If you see
6. Manually Specify DHCP Server Address
If all else fails, force your Ubuntu machine to use your router as the DHCP server:
- Open Network Settings, select your home WiFi network, and click "Settings".
- Go to the IPv4 tab, change the method from "Automatic (DHCP)" to "Automatic (DHCP) addresses only".
- In the "DHCP server" field, enter your router’s IP address (usually
192.168.1.1or192.168.0.1). - Save the settings and reconnect.
内容的提问来源于stack exchange,提问作者James B

