РЕДАКТИРОВАТЬ (tl; dr)
Кажется, я идентифицировал часть проблема здесь , поскольку, по крайней мере, различия в /etc/resolv.conf
и связанных файлах исчезли.
Но я все еще не могу подключиться через Wi-Fi, поэтому, вероятно, другая разница сохраняется.
Я хочу идентифицировать их и действовать в соответствии с ними.
Я намеренно выбрал такое же название, как этот OP .
У меня две системы Ubuntu, server1
и server2
, очень похожие во всем с уважением.
Обе системы подключены к одному и тому же маршрутизатору через Wi-Fi.
Я сравнил две системы, чтобы помочь отследить проблему.
В server2
у меня только начали возникать проблемы с разрешением имен DNS. Я был подключен к VPN, и сервер был перезагружен, поэтому я полагаю этот PostScriptum может описать этот случай.
server2
не имеет resolvconf
] и я установил его как результат.
В то время /etc/resolv.conf
начал указывать на /run/resolvconf/resolv.conf
(обратите внимание на модификацию дату ниже) вместо /run/systemd/resolve/stub-resolv.conf
.
Для этого мне пришлось вручную добавить сервер имен 8.8.8.8 в вверху в / etc / resolv.conf
, подключите проводное подключение к Интернету, и я смогу немедленно sudo apt update
и т. д.
Примечание:
На данный момент проблема с правами доступа к файлам, указанная в ссылки выше нет. Если он появится в следующий раз, когда я подключусь к VPN или отключусь от нее, я с этим разберусь.
Я перечисляю ниже: 1) что отличается в server1
и server2
,
2) что такое же в обоих (с любым
, заменяющим имя сервера),
и 3) , что почти одинаково (с несущественными различиями, как я понимаю).
Почему РАЗНИЦА № 3
ниже? ( nameserver :: 1
).
Как исправить server2
, если возможно, оставив его с той же конфигурацией, что и server1
?
Я мог бы попробовать изменить /etc/resolvconf/resolv.conf.d/tail
на server2
, но поскольку этот файл пуст на server1
, это действие может замаскировать другие проблемы, даже в случае успеха.
Думаю, если бы я мог исправить только РАЗЛИЧИЯ №1-4 ниже, это решило бы проблему. Но все 4 файла указаны как динамически созданные. Я не смог определить, кто это / был ответственен за «создание» различий и за то, как это исправить.
Dig
:
[server1]$ dig google.com
; <<>> DiG 9.16.1-Ubuntu <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64202
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;google.com. IN A
;; ANSWER SECTION:
google.com. 94 IN A 216.58.202.46
;; Query time: 36 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: mar ago 10 03:44:51 -03 2021
;; MSG SIZE rcvd: 55
vs.
[server2]$ dig google.com
; <<>> DiG 9.16.1-Ubuntu <<>> google.com
;; global options: +cmd
;; connection timed out; no servers could be reached
/etc/resolv.conf
и связанные файлы:
[server1]$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 127.0.0.53
search fibertel.com.ar <--- DIFFERENCE #1
[server1]$ cat /run/systemd/resolve/stub-resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "resolvectl status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 127.0.0.53
options edns0 trust-ad
search fibertel.com.ar <--- DIFFERENCE #2
[server1]$ cat /run/systemd/resolve/resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients directly to
# all known uplink DNS servers. This file lists all configured search domains.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 192.168.0.1 <--- DIFFERENCE #3
search fibertel.com.ar <--- DIFFERENCE #3
[server1]$ cat /run/resolvconf/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 127.0.0.53
search fibertel.com.ar <--- DIFFERENCE #4
[server1]$ ll /etc/resolv.conf
lrwxrwxrwx 1 root root 29 feb 1 2021 /etc/resolv.conf -> ../run/resolvconf/resolv.conf
[server1]$ ll /run/resolvconf/resolv.conf
-rw-r--r-- 1 root root 327 ago 9 20:59 /run/resolvconf/resolv.conf
vs.
[server2]$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 127.0.0.53
[server2]$ cat /run/systemd/resolve/stub-resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "resolvectl status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 127.0.0.53
options edns0 trust-ad
[server2]$ cat /run/systemd/resolve/resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients directly to
# all known uplink DNS servers. This file lists all configured search domains.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver ::1 <--- DIFFERENCE #3
[server2]$ cat /run/resolvconf/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 127.0.0.53
[server2]$ ll /etc/resolv.conf
lrwxrwxrwx 1 root root 29 ago 9 22:38 /etc/resolv.conf -> ../run/resolvconf/resolv.conf
[server2]$ ll /run/resolvconf/resolv.conf
-rw-r--r-- 1 root root 304 ago 10 03:13 /run/resolvconf/resolv.conf
[any]$ uname -a
Linux <serverN> 5.11.0-25-generic #27~20.04.1-Ubuntu SMP Tue Jul 13 17:41:23 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
[any]$ dpkg -l | grep resolvconf
ii resolvconf 1.82 all name server information handler
[any]$ cat /etc/netplan/01-network-manager-all.yaml
# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
[any]$ cat /etc/NetworkManager/NetworkManager.conf
[main]
plugins=ifupdown,keyfile
[ifupdown]
managed=false
[device]
wifi.scan-rand-mac-address=no
[any]$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 <serverN>
# 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
[any]$ cat /etc/nsswitch.conf
...
[any]$ cat /etc/systemd/networkd.conf
...
[any]$ ss -plnt | grep ':53'
LISTEN 0 4096 127.0.0.53%lo:53 0.0.0.0:*
[any]$ sudo systemctl status resolvconf.service
...
[any]$ /lib/systemd/network/
...
[server1]$ lsb_release -a
LSB Version: core-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
[server2]$ lsb_release -a
LSB Version: core-11.1.0ubuntu2-noarch:printing-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
Связанное :
Файл /etc/resolv.conf представляет собой символическую ссылку на /run/systemd/resolve/stub-resolv.conf. Проверьте:
ls -al /etc/resolv.conf
Если это не так, исправьте его:
sudo rm /etc/resolv.conf
sudo ln -s /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
Ваш netplan yaml указывает, что вы используете Network Manager. Здесь вы можете внести изменения в DNS-серверы имен.