我的 google cloud VM 无法解析外部 URL,请参见屏幕截图。
重新启动 systemd-resolved 后出现以下错误
systemd-resolved.service - Network Name Resolution
Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2020-02-13 10:25:59 UTC; 41s ago
Docs: man:systemd-resolved.service(8)
https://www.freedesktop.org/wiki/Software/systemd/resolved
https://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers
https://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients
Main PID: 10316 (systemd-resolve)
Status: "Processing requests..."
Tasks: 1 (limit: 4915)
CGroup: /system.slice/systemd-resolved.service
└─10316 /lib/systemd/systemd-resolved
Feb 13 10:26:38 dev.seconize.co systemd-resolved[10316]: Failed to open /etc/hosts: Permission denied
Feb 13 10:26:38 dev.seconize.co systemd-resolved[10316]: Failed to start query: Permission denied
Feb 13 10:26:40 dev.seconize.co systemd-resolved[10316]: Failed to open /etc/hosts: Permission denied
Feb 13 10:26:40 dev.seconize.co systemd-resolved[10316]: Failed to start query: Permission denied
Feb 13 10:26:40 dev.seconize.co systemd-resolved[10316]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with
Feb 13 10:26:40 dev.seconize.co systemd-resolved[10316]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with
Feb 13 10:26:40 dev.seconize.co systemd-resolved[10316]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with
Feb 13 10:26:40 dev.seconize.co systemd-resolved[10316]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with
Feb 13 10:26:40 dev.seconize.co systemd-resolved[10316]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with
Feb 13 10:26:40 dev.seconize.co systemd-resolved[10316]: Server returned error NXDOMAIN, mit
答案1
正如评论中所解释的那样@sashank此问题的原因是文件权限错误/etc/hosts
。修复权限后,重新启动systemd-resolved
服务终于解决了该问题。