当前位置:   article > 正文

ubuntu无法解析域名“cn.archive.ubuntu.com“,修改DNS配置_127.0.0.53 无法解析

127.0.0.53 无法解析

系统:Ubuntu18.04

  1. 错误:1 http://cn.archive.ubuntu.com/ubuntu focal InRelease 无法解析域名“cn.archive.ubuntu.com"
  2. ....
  3. ....
  4. ....

(1)临时解决方案

sudo vim /etc/resolv.conf

将127.0.0.53改成自己的ip(系统重启后又会变成默认值)

  1. # This file is managed by man:systemd-resolved(8). Do not edit.
  2. #
  3. # This is a dynamic resolv.conf file for connecting local clients to the
  4. # internal DNS stub resolver of systemd-resolved. This file lists all
  5. # configured search domains.
  6. #
  7. # Run "resolvectl status" to see details about the uplink DNS servers
  8. # currently in use.
  9. #
  10. # Third party programs must not access this file directly, but only through the
  11. # symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
  12. # replace this symlink by a static file or a different symlink.
  13. #
  14. # See man:systemd-resolved.service(8) for details about the supported modes of
  15. # operation for /etc/resolv.conf.
  16. nameserver 127.0.0.53
  17. options edns0 trust-ad

(2)修改DNS,一劳永逸

sudo vim /etc/systemd/resolved.conf

取消DNS注释,添加值114.114.114.114和8.8.8.8

  1. # This file is part of systemd.
  2. #
  3. # systemd is free software; you can redistribute it and/or modify it
  4. # under the terms of the GNU Lesser General Public License as published by
  5. # the Free Software Foundation; either version 2.1 of the License, or
  6. # (at your option) any later version.
  7. #
  8. # Entries in this file show the compile time defaults.
  9. # You can change settings by editing this file.
  10. # Defaults can be restored by simply deleting this file.
  11. #
  12. # See resolved.conf(5) for details
  13. [Resolve]
  14. DNS= 114.114.114.114
  15. DNS= 8.8.8.8
  16. #FallbackDNS=
  17. #Domains=
  18. #LLMNR=no
  19. #MulticastDNS=no
  20. #DNSSEC=no
  21. #DNSOverTLS=no
  22. #Cache=no-negative
  23. #DNSStubListener=yes
  24. #ReadEtcHosts=yes

重启服务,使配置生效

  1. systemctl restart systemd-resolved
  2. systemctl enable systemd-resolved

ok~

本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号