Domain-Name-System

Google云虛擬機:無法解析外部網址

  • February 18, 2020

我的Google云虛擬機無法解析外部 URL,請看截圖。

在此處輸入圖像描述 解決這個問題的任何幫助,非常感謝

建議附上 resolv.conf 的截圖 在此處輸入圖像描述

重新啟動 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

正如*@sashank*在評論中解釋的那樣,這個問題的原因是文件權限錯誤/etc/hosts。修復權限後重新啟動systemd-resolved服務終於解決了問題。

引用自:https://serverfault.com/questions/1002902