You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 22.04 LTS开机WiFi上网频繁出现ERR_ADDRESS_UNREACHABLE问题的永久解决方法咨询

Ubuntu 22.04 LTS开机WiFi上网频繁出现ERR_ADDRESS_UNREACHABLE问题的永久解决方法咨询

Hey there, sorry to hear you're stuck with this frustrating WiFi glitch on Ubuntu 22.04 LTS—having to run those dhclient commands every time you boot up is such a hassle! Let’s walk through what might be causing this and how to fix it for good.

Common Root Causes

This error usually pops up because your system isn’t properly grabbing a valid IP address from your WiFi router on startup. Your manual dhclient commands force a refresh, which works temporarily, so we need to fix the automatic IP acquisition process.

Fix 1: Tweak NetworkManager’s DHCP Settings

NetworkManager might be using a slow or unresponsive DHCP client by default. Let’s switch to its built-in client and adjust the timeout:

  • Open NetworkManager’s config file with your favorite editor:
    sudo nano /etc/NetworkManager/NetworkManager.conf
    
  • In the [main] section, add or update these lines:
    dhcp=internal
    dhcp-client-timeout=10
    
    This tells NetworkManager to use its own DHCP client and retry IP acquisition faster if the first attempt fails.
  • Save the file (press Ctrl+O, hit Enter, then Ctrl+X), then restart NetworkManager to apply changes:
    sudo systemctl restart NetworkManager
    

Fix 2: Auto-Run Your DHCP Fix on Boot

If the first fix doesn’t work, we can set up a systemd service to automatically run those dhclient commands when your system starts:

  • Create a new systemd service file:
    sudo nano /etc/systemd/system/wifi-dhcp-fix.service
    
  • Paste this content into the file:
    [Unit]
    Description=Automatically fix WiFi DHCP issue on boot
    After=network.target
    
    [Service]
    Type=oneshot
    ExecStart=/usr/sbin/dhclient -r wlp2s0
    ExecStart=/usr/sbin/dhclient wlp2s0
    User=root
    
    [Install]
    WantedBy=multi-user.target
    
  • Save and close the file, then enable the service so it runs on every boot:
    sudo systemctl enable wifi-dhcp-fix.service
    

Fix 3: Check for WiFi Driver Issues

Sometimes outdated or incompatible drivers can cause IP acquisition failures. Let’s identify your WiFi hardware and update the driver if needed:

  • First, find your WiFi adapter model:
    # For PCIe WiFi cards
    lspci | grep Network
    # For USB WiFi adapters
    lsusb | grep Wireless
    
  • Search for the driver corresponding to your model. For example, if you have a Realtek RTL8821CE adapter, install the DKMS driver package:
    sudo apt install rtl8821ce-dkms
    
  • Reboot your system after installing the driver to see if the issue is resolved.

Bonus: Diagnose with System Logs

If none of the above fixes work, check the NetworkManager logs to get more details about what’s going wrong:

journalctl -u NetworkManager.service --boot

Look for lines mentioning "DHCP" or "IP address"—they might point to router compatibility issues or specific configuration errors.

Hopefully one of these fixes gets your WiFi working reliably on startup! Let me know if you run into any issues with the steps.

备注:内容来源于stack exchange,提问作者Junio Batista

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.16 12:28:10