AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1281534
Accepted
Tschösi
Tschösi
Asked: 2020-10-10 14:27:47 +0800 CST2020-10-10 14:27:47 +0800 CST 2020-10-10 14:27:47 +0800 CST

systemd-resolve 似乎没有查询指定的 DNS 服务器

  • 772

编辑:在我输入这个问题的过程中,它显然已自行修复,现在它按预期工作。我仍然对为什么会发生这种情况感兴趣:)

我的设置如下:

我在 address 有一个本地 DNS 服务器(准确地说是 pihole)192.168.1.200。我的家庭网络中的 address 也有一台服务器192.168.1.300。我的域example.com指向我的公共 IP 5.5.5.5。pihole 有一些自定义的 DNS 条目,因此当我在本地网络中时,example.com解析为192.168.1.300而不是5.5.5.5(以避免 NAT 出现问题)我已将我的 wifi 的 DNS 服务器设置为192.168.1.200. (也是在路由器里设置的……)

现在不知何故,我仍然从 systemd-resolve 获得 5.5.5.5 IP。

我已经用 sudo systemd-resolve --flush-caches

sudo systemd-resolve --statistics返回缓存大小为 0

systemd-resolve --status | grep "DNS Servers"节目192.168.1.200

现在是有趣的部分:

dig example.com返回5.5.5.5

而 dig example.com @192.168.1.200返回192.168.1.300

这怎么可能?如何让 systemd-resolve 实际查询我设置的 DNS 服务器?

更多信息:

  • ls -al /etc/resolv.conf返回 lrwxrwxrwx 1 root root 39 Sep 26 2019 /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
  • 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)

  • grep -i dns /etc/systemd/resolved.conf返回
#DNS=
#FallbackDNS=
#MulticastDNS=no
#DNSSEC=no
#DNSStubListener=yes
networking dns systemd-resolved
  • 1 1 个回答
  • 567 Views

1 个回答

  • Voted
  1. Best Answer
    Tschösi
    2020-10-28T05:15:34+08:002020-10-28T05:15:34+08:00

    解决我的问题的是运行sudo /etc/init.d/dns-clean restart

    • 1

相关问题

  • 如何设置 VLAN 转发?

  • 如何将主机 Ubuntu 上的 VPN (tun0) 网络适配器映射到 VirtualBox 来宾 Windows?

  • 如何限制下载/上传带宽?

  • 如何通过 Windows 网络共享文件?

  • 面板小程序以文本形式显示当前网络流量?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve