Linux 53 端口被 systemd-resolve 占用

  1. 先停用 systemd-resolved 服务
    systemctl stop systemd-resolved

     

  2. 编辑 /etc/systemd/resolved.conf 文件
    vi /etc/systemd/resolved.conf

     

  3. 换下面说明更改,然后按一下“esc”键,再输入“:wq”(不要输入引号),回车保存
    [Resolve]
    DNS=8.8.8.8  #取消注释,增加dns
    #FallbackDNS=
    #Domains=
    #LLMNR=no
    #MulticastDNS=no
    #DNSSEC=no
    #Cache=yes
    DNSStubListener=no  #取消注释,把yes改为no

     

  4. 最后运行下面命令即可
    ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf

     

最直接的办法

systemctl stop systemd-resolved
systemctl disable systemd-resolved

#删除后重新创建resolv.conf
rm -rf /etc/resolv.conf

 

对于 Debian 11

systemd-resolved 是一个网络名字解析服务,它在 Debian 11 上默认启用。如果你需要释放 53 端口,你可以禁用 systemd-resolved 服务。但请注意,这将停止使用 systemd-resolved 进行 DNS 解析,你需要提供其他 DNS 解析方法

首先,备份 /etc/resolv.conf 文件,因为我们将对其进行修改:

cp /etc/resolv.conf /etc/resolv.conf.backup

接下来,停止并禁用 systemd-resolved 服务:

systemctl stop systemd-resolved
systemctl disable systemd-resolved

现在,编辑 /etc/resolv.conf 文件,将你的 DNS 服务器添加到该文件中。例如,如果你想使用 Google 的公共 DNS 服务器,可以在文件中添加以下内容:

nameserver 1.1.1.1

将上述内容粘贴到文件中,保存并关闭。最后,重启你的网络服务

systemctl restart networking

 

声 明 1 bujj博客:www.bujj.org
2 原创文章,转载请注明转自bujj博客:www.bujj.org
3 当前页网址:https://www.bujj.org/index.php/2022/01/28/285/
THE END
分享
二维码
< <上一篇
下一篇>>