Ubuntu 24.04频繁断网问题求助
Hey there, sorry to hear you're stuck with this super frustrating WiFi issue—nothing kills a YouTube session like random drops mid-song! Let's walk through some practical fixes that might get your connection stable again:
Check your WiFi driver first
HP laptops often have finicky WiFi adapters (especially Broadcom ones). Start by identifying your network card with this command:lspci | grep Network
Once you have the model, open "Software & Updates" → go to the "Additional Drivers" tab. If there's a proprietary driver listed for your card, install it, reboot, and see if that helps. Proprietary drivers usually fix compatibility issues that open-source ones miss.Disable WiFi power saving
Ubuntu's default power saving settings might be putting your WiFi card to sleep unexpectedly. To turn this off:- Open the config file with:
sudo nano /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf - Change
wifi.powersave = 3towifi.powersave = 2 - Save and exit (Ctrl+O, then Ctrl+X), then restart NetworkManager:
sudo systemctl restart NetworkManager
- Open the config file with:
Switch your WiFi channel
If you're on the 2.4GHz band, it's probably crowded with neighbors' routers, IoT devices, etc. Try switching to a less busy channel:- Scan nearby networks to see which channels are free:
iwlist wlan0 scan | grep Frequency(replacewlan0with your actual interface name—you can find it withip link show) - Log into your router's settings (usually via 192.168.1.1 or 192.168.0.1) and change the WiFi channel to one with less interference. 5GHz bands are usually less crowded too, if your router supports it.
- Scan nearby networks to see which channels are free:
Fix DNS or DHCP issues
Sometimes the connection shows as "connected" but you can't access the internet because of DNS problems. Try manually setting Google's public DNS:- Go to Settings → Network → Click on your WiFi connection → IPv4 tab
- Change "DNS" to
8.8.8.8, 8.8.4.4and hit Apply.
Alternatively, use the command line:sudo nmcli con mod "Your WiFi Name" ipv4.dns "8.8.8.8,8.8.4.4"then restart the connection.
Rule out hardware/Windows issues
Since you're dual-booting with Windows 10, check if the same disconnection happens there. If it does, the problem might be your WiFi card hardware or your router—try updating your router firmware or testing with a different router. If Windows works fine, we know it's an Ubuntu-specific config issue.
If none of these work, could you share the output of lspci | grep Network and dmesg | grep -i wifi? That'll help narrow down the exact problem. Good luck—hope you get back to uninterrupted YouTube sessions soon!
备注:内容来源于stack exchange,提问作者user227495

