Ubuntu 20 DNS服务出错导致无法解析网址 Failed to fetch , Temporary failure resolving

目录

问题:

解决方法1

解决方法2

1、检查状态

2、重新连接服务

3、重启服务 

4、确认状态 


问题:

DNS 服务出错导致,无法连接远程服务器 

# apt-get update
Err:1 http://apt.postgresql.org/pub/repos/apt focal-pgdg-testing InRelease
  Temporary failure resolving 'apt.postgresql.org'
Err:2 https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal pgadmin4 InRelease
  Temporary failure resolving 'ftp.postgresql.org'
Err:3 http://it.archive.ubuntu.com/ubuntu focal InRelease
  Temporary failure resolving 'it.archive.ubuntu.com'
Err:4 http://nightly.odoo.com/12.0/nightly/deb ./ InRelease
  Temporary failure resolving 'nightly.odoo.com'
Err:5 http://apt.postgresql.org/pub/repos/apt focal-pgdg InRelease
  Temporary failure resolving 'apt.postgresql.org'
Err:6 http://it.archive.ubuntu.com/ubuntu focal-updates InRelease
  Temporary failure resolving 'it.archive.ubuntu.com'
Err:7 http://security.ubuntu.com/ubuntu focal-security InRelease
  Temporary failure resolving 'security.ubuntu.com'
Err:8 http://it.archive.ubuntu.com/ubuntu focal-backports InRelease
  Temporary failure resolving 'it.archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://it.archive.ubuntu.com/ubuntu/dists/focal/InRelease  Temporary failure resolving 'it.archive.ubuntu.com'
W: Failed to fetch http://it.archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease  Temporary failure resolving 'it.archive.ubuntu.com'
W: Failed to fetch http://it.archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease  Temporary failure resolving 'it.archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
W: Failed to fetch http://nightly.odoo.com/12.0/nightly/deb/./InRelease  Temporary failure resolving 'nightly.odoo.com'
W: Failed to fetch https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal/dists/pgadmin4/InRelease  Temporary failure resolving 'ftp.postgresql.org'
W: Failed to fetch http://apt.postgresql.org/pub/repos/apt/dists/focal-pgdg-testing/InRelease  Temporary failure resolving 'apt.postgresql.org'
W: Failed to fetch http://apt.postgresql.org/pub/repos/apt/dists/focal-pgdg/InRelease  Temporary failure resolving 'apt.postgresql.org'
W: Some index files failed to download. They have been ignored, or old ones used instead.

解决方法1

resolvconf -u

 手动更新DNS 服务,但是重启后需要重新执行这个命令。

解决方法2

1、检查状态

systemd-resolve --status
# systemd-resolve --status
Failed to get global data: Unit dbus-org.freedesktop.resolve1.service not found.

2、重新连接服务

sudo ln -sf /lib/systemd/system/systemd-resolved.service /etc/systemd/system/dbus-org.freedesktop.resolve1.service

3、重启服务 

sudo systemctl restart systemd-resolved.service

4、确认状态 

~# systemd-resolve --status
Global
       LLMNR setting: no
MulticastDNS setting: no
  DNSOverTLS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
  Current DNS Server: 8.8.8.8
         DNS Servers: 8.8.8.8
          DNSSEC NTA: 10.in-addr.arpa
                      16.172.in-addr.arpa
                      168.192.in-addr.arpa
                      17.172.in-addr.arpa
                      18.172.in-addr.arpa
                      19.172.in-addr.arpa
                      20.172.in-addr.arpa
                      21.172.in-addr.arpa
                      22.172.in-addr.arpa
                      23.172.in-addr.arpa
                      24.172.in-addr.arpa
                      25.172.in-addr.arpa
                      26.172.in-addr.arpa
                      27.172.in-addr.arpa
                      28.172.in-addr.arpa

 

 

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值