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

Ubuntu 20.04 出现 'temporary failure in name resolution' 错误导致无法联网及系统更新求助

Ubuntu 20.04 出现 'temporary failure in name resolution' 错误导致无法联网及系统更新求助

Hey there, sorry to hear you've been stuck with this frustrating network issue for days—let's break this down step by step to get your internet access and system updates working again.

First, let's address the resolv.conf problem: on Ubuntu 20.04, this file is usually a symbolic link managed by systemd-resolved, so manually editing it often doesn't stick (it gets overwritten after a reboot or network restart). Here's how to fix that properly:

  • Check if resolv.conf is a symlink
    Run this command to confirm:

    ls -l /etc/resolv.conf
    

    If you see it pointing to something like /run/systemd/resolve/stub-resolv.conf, that means systemd-resolved is handling your DNS settings.

  • Configure DNS via systemd-resolved

    1. Open the resolved configuration file with a text editor:
      sudo nano /etc/systemd/resolved.conf
      
    2. Uncomment the DNS line and add reliable DNS servers (like Google's or Cloudflare's):
      DNS=8.8.8.8 8.8.4.4 1.1.1.1
      
    3. Save the file (press Ctrl+O, then Enter, then Ctrl+X to exit nano).
    4. Restart the systemd-resolved service to apply changes:
      sudo systemctl restart systemd-resolved
      
    5. Verify the DNS settings are active:
      resolvectl status
      
      Look for the "DNS Servers" line to confirm your chosen servers are listed.

Next, let's rule out other common issues:

  • Check basic network connectivity
    First, make sure you're actually connected to your network (Wi-Fi signal is strong, Ethernet cable is plugged in). Then ping your router's gateway (replace 192.168.1.1 with your actual gateway IP—you can find it via ip route):

    ping 192.168.1.1
    

    If this fails, your issue is with the network connection itself, not DNS. Try restarting your router or reconnecting to the network.

  • Check firewall settings
    Sometimes ufw (Ubuntu's default firewall) can block DNS traffic. Check its status:

    sudo ufw status
    

    If it's active, ensure UDP and TCP port 53 (used for DNS) is allowed:

    sudo ufw allow 53
    sudo ufw reload
    
  • Check for incorrect proxy settings
    A misconfigured proxy can block internet access. Check if any proxy variables are set:

    echo $HTTP_PROXY $HTTPS_PROXY
    

    If you see values here that shouldn't be there, unset them with:

    unset HTTP_PROXY HTTPS_PROXY
    

    You can also check proxy settings in the system settings > Network > Network Proxy, set it to "None" if needed.

After trying these steps, test your internet access again by pinging a domain:

ping google.com

If this works, you should be able to run system updates with:

sudo apt update && sudo apt upgrade

Let me know if any of these steps resolve your issue, or if you run into specific error messages along the way—I'll help you troubleshoot further!

备注:内容来源于stack exchange,提问作者Claude Mutela

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.23 07:29:10