我正在尝试在装有 Ubuntu 20.04 的 Raspberry Pi 上安装 Pi-Hole 和 Nextcloud。NextCloud 通常安装在 Ubuntu 上,而我正尝试在容器中安装 Pi-Hole,以避免与 Web 服务器发生任何冲突。
我正在遵循这个指南:https://rsw.io/how-to-install-pi-hole-in-a-docker-container-on-a-raspberry-pi/
这是我得到的错误
Status: Downloaded newer image for pihole/pihole:latest
Creating pihole ...
Creating pihole ... error
ERROR: for pihole Cannot start service pihole: driver failed programming external connectivity on endpoint pihole (56f233c57287a526a4e6adc3038d9359cda06ba8b51c0157146c42171cc47106): Error starting userland proxy: listen tcp4 0.0.0.0:53: bind: address already in use
ERROR: for pihole Cannot start service pihole: driver failed programming external connectivity on endpoint pihole (56f233c57287a526a4e6adc3038d9359cda06ba8b51c0157146c42171cc47106): Error starting userland proxy: listen tcp4 0.0.0.0:53: bind: address already in use
ERROR: Encountered errors while bringing up the project.
端口 53 已被 systemd-resolve 使用:
root@ubuntu:/home/ubuntu/pi-hole# sudo lsof -iTCP -sTCP:LISTEN -P -n +c 10
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
systemd-re 41186 systemd-resolve 13u IPv4 167233 0t0 TCP 127.0.0.53:53 (LISTEN)
我曾经(愚蠢地)尝试停止 system-re 进程,但是这破坏了所有的 DNS。
请问 systemd-resolve 进程做什么?我该怎么做才能避免与端口 53 冲突?
答案1
systemd.resolved 正在使用端口 53。本文介绍如何修复
http://web.archive.org/web/20220612212822/https://www.bklynit.net/ubuntu-20-04-lts-docker-pihole/
根据本文
步骤 5:停止 systemd-resolve 监听端口 53 -
编辑/etc/systemd/resolved.conf
-取消注释该行DNSStubListener
并将“是”更改为“否”。
使用以下命令重启 systemd-solved:
sudo systemctl restart systemd-resolved.service
通过删除指向 systemd stub-resolv.conf 的符号链接并将其替换为指向完整 resolv.conf 的链接来修复本地 DNS 解析
sudo rm /etc/resolve.conf
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf