好的,我有一台 Debian 物理机和一台 Ubuntu 虚拟机。我的问题是为什么 Ubuntu 使用 127.0.0.53 进行解析,而不是通过 DHCP 分配的 DNS 服务器(8.8.8.8)。但我的 Debian 机器确实使用通过 DHCP 分配的 DNS 服务器。两者都使用 NetworkManager 服务,但 Ubuntu 似乎要求它使用 systemd-resolved 服务,我无法理解,因为它们都使用 NetworkManager,并且只有 Ubuntu 似乎依赖于 systemd-resolved。
Ubuntu
## VERIFICATION OF SERVICES UP
vm@ubuntu1804:~$ systemctl status NetworkManager | grep Active
Active: active (running) since Fri 2023-06-09 16:21:08 BST; 21h ago
vm@ubuntu1804:~$ systemctl status systemd-resolved | grep Active
Active: active (running) since Sat 2023-06-10 13:45:08 BST; 14min ago
## VERIFICATION OF /etc/resolv.conf FILE
vm@ubuntu1804:~$ cat /etc/resolv.conf | grep name
nameserver 127.0.0.53
## VERIFICATION OF PROFILE CONFIG
vm@ubuntu1804:~$ nmcli con show | grep DYN
DYNAMIC 4223e640-3e14-43c1-9b70-e59241ff8f79 ethernet enp6s0
vm@ubuntu1804:~$ nmcli con show DYNAMIC | grep "ipv4.dns:\|DNS"
ipv4.dns: --
IP4.DNS[1]: 8.8.8.8
## VERIFICATION OF /etc/nsswitch.conf FILE
vm@ubuntu1804:~$ cat /etc/nsswitch.conf | grep hosts
hosts: files mdns4_minimal [NOTFOUND=return] dns myhostname
德比安
## VERIFICATION OF SERVICES UP
debian@debian:~/Desktop$ systemctl status NetworkManager | grep Active
Active: active (running) since Fri 2023-06-09 15:37:15 BST; 22h ago
debian@debian:~/Desktop$ systemctl status systemd-resolved | grep Active
Active: inactive (dead)
## VERIFICATION OF /etc/resolv.conf FILE
debian@debian:~/Desktop$ cat /etc/resolv.conf | grep name
nameserver 8.8.8.8
## VERIFICATION OF PROFILE CONFIG
debian@debian:~/Desktop$ nmcli con show | grep BR
BR0-PROFILE 1cd1c4bd-21bd-45de-9536-c22c261869da bridge BR0-INT
debian@debian:~/Desktop$ nmcli con show BR0-PROFILE | grep "ipv4.dns:\|DNS"
ipv4.dns: --
IP4.DNS[1]: 8.8.8.8
## VERIFICATION OF nsswitch.conf FILE
debian@debian:~/Desktop$ cat /etc/nsswitch.conf | grep hosts
hosts: files mdns4_minimal [NOTFOUND=return] dns myhostname mymachines