最近,当我使用 ping 或 apt update 时,我的 Ubuntu 服务器开始出现“名称解析暂时失败”的错误。
服务器通过以太网插入,之前我从未遇到过任何 DNS 问题,我不确定是什么引发了这个问题。
$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp57s0f1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
link/ether 80:fa:5b:6c:4b:56 brd ff:ff:ff:ff:ff:ff
3: wlp0s20f3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 3c:f0:11:fe:9c:8c brd ff:ff:ff:ff:ff:ff
inet 192.168.0.70/24 brd 192.168.0.255 scope global dynamic noprefixroute wlp0s20f3
valid_lft 81468sec preferred_lft 81468sec
inet6 2001:8003:d115:be00:e9a4:d508:1d9c:db9f/64 scope global temporary dynamic
valid_lft 44458sec preferred_lft 44458sec
inet6 2001:8003:d115:be00:b2c2:134d:8605:dbe6/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 44458sec preferred_lft 44458sec
inet6 fe80::6d19:c8c7:ba10:706b/64 scope link noprefixroute
valid_lft forever preferred_lft forever
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:c0:a1:30 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
ping4-c1www.google.com返回:
ping4: www.google.com: Temporary failure in name resolution
ping:
ping: google.com: Temporary failure in name resolution
/etc/systemd/resolv.conf:
[Resolve]
# Some examples of DNS servers which may be used for DNS= and FallbackDNS=:
# Cloudflare: 1.1.1.1#cloudflare-dns.com 1.0.0.1#cloudflare-dns.com 2606:4700:4700::1111#cloudflare-dns.com 2606:4700:4700::1001#cloudflare-dns.com
# Google: 8.8.8.8#dns.google 8.8.4.4#dns.google 2001:4860:4860::8888#dns.google 2001:4860:4860::8844#dns.google
# Quad9: 9.9.9.9#dns.quad9.net 149.112.112.112#dns.quad9.net 2620:fe::fe#dns.quad9.net 2620:fe::9#dns.quad9.net
DNS=1.1.1.1
FallbackDNS=8.8.8.8
#Domains=
#DNSSEC=no
#DNSOverTLS=no
#MulticastDNS=no
#LLMNR=no
#Cache=no-negative
#CacheFromLocalhost=no
#DNSStubListener=yes
#DNSStubListenerExtra=
#ReadEtcHosts=yes
#ResolveUnicastSingleLabel=no
主机名和主机:
josh@goose:~$ cat /etc/hostname
goose
josh@goose:~$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 goose
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
我已经尝试了此帖子评论中的所有建议Ubuntu 20.04 有线名称解析暂时失败
任何帮助都将不胜感激,我肯定我做了一些愚蠢的事情
编辑:
josh@goose:~$ dig google.com
;; communications error to 1.1.1.1#53: connection refused
;; communications error to 1.1.1.1#53: connection refused
;; communications error to 1.1.1.1#53: connection refused
; <<>> DiG 9.18.18-0ubuntu2-Ubuntu <<>> google.com
;; global options: +cmd
;; no servers could be reached
josh@goose:~$ dig @1.1.1.1 google.com
;; communications error to 1.1.1.1#53: connection refused
;; communications error to 1.1.1.1#53: connection refused
;; communications error to 1.1.1.1#53: connection refused
; <<>> DiG 9.18.18-0ubuntu2-Ubuntu <<>> @1.1.1.1 google.com
; (1 server found)
;; global options: +cmd
;; no servers could be reached
josh@goose:~$ dig @8.8.8.8 google.com
;; communications error to 8.8.8.8#53: connection refused
;; communications error to 8.8.8.8#53: connection refused
;; communications error to 8.8.8.8#53: connection refused
; <<>> DiG 9.18.18-0ubuntu2-Ubuntu <<>> @8.8.8.8 google.com
; (1 server found)
;; global options: +cmd
;; no servers could be reached
josh@goose:~$ cat /etc/resolv.conf
nameserver 1.1.1.1
josh@goose:~$ ip r
default via 192.168.0.1 dev eno1 proto dhcp src 192.168.0.43 metric 100
1.1.1.1 via 192.168.0.1 dev eno1 proto dhcp src 192.168.0.43 metric 100
8.8.8.8 via 192.168.0.1 dev eno1 proto dhcp src 192.168.0.43 metric 100
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1
172.20.0.0/16 dev br-69d42fdb989f proto kernel scope link src 172.20.0.1 linkdown
172.21.0.0/16 dev br-5e38ac7d290e proto kernel scope link src 172.21.0.1 linkdown
172.23.0.0/16 dev br-6505df725908 proto kernel scope link src 172.23.0.1 linkdown
172.25.0.0/16 dev br-2f731feeedb8 proto kernel scope link src 172.25.0.1 linkdown
172.26.0.0/16 dev br-526004ac228d proto kernel scope link src 172.26.0.1
172.27.0.0/16 dev br-193bc6e3f760 proto kernel scope link src 172.27.0.1 linkdown
172.28.0.0/16 dev br-0f6713744985 proto kernel scope link src 172.28.0.1 linkdown
172.31.0.0/16 dev br-392c0aaed7be proto kernel scope link src 172.31.0.1
192.168.0.0/24 dev eno1 proto kernel scope link src 192.168.0.43 metric 100
192.168.0.1 dev eno1 proto dhcp scope link src 192.168.0.43 metric 100
192.168.32.0/20 dev br-5912277b1486 proto kernel scope link src 192.168.32.1 linkdown
192.168.48.0/20 dev br-d811c4e31395 proto kernel scope link src 192.168.48.1
192.168.64.0/20 dev br-124eed87e585 proto kernel scope link src 192.168.64.1
192.168.80.0/20 dev br-aaa96d8c554f proto kernel scope link src 192.168.80.1 linkdown
192.168.144.0/20 dev br-ba40c893c371 proto kernel scope link src 192.168.144.1 linkdown
josh@goose:~$ ping 1.1.1.1
PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
From 192.168.0.43 icmp_seq=1 Destination Port Unreachable
ping: sendmsg: Operation not permitted