我搭建了一个 Ubuntu Server 18.04 服务器来玩 Docker 和其他一些东西。当我最初安装服务器时,我遇到了一些 Netplan 问题,无法让 DNS(我自己的服务器)正常工作,但最后我还是去了那里,一切都运行正常。
我还想做其他几件事,我觉得这需要安装 GUI,所以我使用 安装了 Ubuntu-Desktop apt install --no-install-recommends Ubuntu-Desktop
。重启后,就有了 GUI,我就可以登录了。太棒了!
但是,我的 DNS 不再工作了,而且我没有记录我第一次对其进行排序时所做的事情!如果我对本地主机执行 nslookup,我会得到:;; reply from unexpected source: 127.0.0.1#53, expected 127.0.0.53#53
与往常一样,我的第一反应是向 Google 寻求帮助,但我真的不明白各种建议,所以不想在终端中疯狂地开始输入命令。
到目前为止,我所做的只是确认我的 netplan 配置仍然存在并重新应用它。我还安装了 resolvconf,这是建议之一。如果我打开,/etc/resolv.conf
我会看到Generated by NetworkManager
。我更熟悉 CentOS,除了我第一次安装时所做的事情之外,我对 Netplan 没有任何经验。
任何建议和解释都将不胜感激......
更新 1:我想知道这是否与在此系统上安装 Docker 有关?
更新2:根据要求,以下是这些命令的输出:
$ dpkg -l *dnsmasq*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-===========================-==================-==================-============================================================
un dnsmasq <none> <none> (no description available)
ii dnsmasq-base 2.79-1 amd64 Small caching DNS proxy and DHCP/TFTP server
un dnsmasq-base-lua <none> <none> (no description available)
$ ls -al /etc/resolv.conf
lrwxrwxrwx 1 root root 39 May 8 16:06 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf
$ cat /etc/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 "systemd-resolve --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
search home.domain
$cat /etc/netplan/*.yaml
network:
version: 2
renderer: networkd
ethernets:
enp2s0:
dhcp4: no
dhcp6: yes
addresses: [192.168.1.6/24]
gateway4: 192.168.1.1
nameservers:
addresses:
- 192.168.1.3
search:
- home.domain
$ cat /etc/network/interfaces
# ifupdown has been replaced by netplan(5) on this system. See
# /etc/netplan for current configuration.
# To re-enable ifupdown on this system, you can run:
# sudo apt install ifupdown
auto eth0
iface etho inet static
address 192.168.1.6
netmask 255.255.255.0
netowrk 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 192.168.1.3
dns-domain home.domain
dns-search home.domain
更新 3:Heynnema 尝试帮助我。我们根据他的评论更正了 /etc/network/interfaces 文件,并卸载了我们认为是移除 Pi-hole 安装后遗留的 dnsmasq-base。现在 nslookup 尝试 127.0.0.1 时返回失败。
更新 4:输出ps auxw |grep systemd
root 474 0.0 0.2 118876 33216 ? S<s May08 0:01 /lib/systemd/systemd-journald
root 519 0.0 0.0 47160 5784 ? Ss May08 0:02 /lib/systemd/systemd-udevd
systemd+ 747 0.0 0.0 141924 3348 ? Ssl May08 0:00 /lib/systemd/systemd-timesyncd
systemd+ 881 0.0 0.0 71968 5996 ? Ss May08 0:00 /lib/systemd/systemd-networkd
root 987 0.0 0.0 70604 6192 ? Ss May08 0:01 /lib/systemd/systemd-logind
message+ 1041 0.0 0.0 51620 6140 ? Ss May08 0:04 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
gdm 1789 0.0 0.0 76984 7948 ? Ss May08 0:07 /lib/systemd/systemd --user
neild+ 8004 0.0 0.0 77024 7928 ? Ss May08 0:07 /lib/systemd/systemd --user
neild+ 26628 0.0 0.0 13136 1072 pts/0 S+ 19:37 0:00 grep --color=auto systemd
更新 5:我设法让 systemd-solved 再次工作,从而使 /etc/resolv.conf 存在,方法是运行systemctl enable systemd-resolved.service
然后systemctl start systemd-resolved.service
nslookup 现在;; reply from unexpected source: 127.0.0.1#53, expected 127.0.0.53#53
再次给出
更新 6:发现了问题,但不知道为什么它才开始出现问题。所以我让 Docker 与 Pi-Hole 容器一起运行(我听说你们都长大了!)它使用端口 53 并阻止 systemd 正常工作。docker-proxy 进程改用该端口。
当我停止 docker 服务并重新启动 systemd-resolve 时,一切都按预期工作,所以我暂时删除了我的 Pi-Hole 容器。
有没有办法让两者协同工作?