我的“stub-resolve.conf”在哪裡?

我的“stub-resolve.conf”在哪裡?

我想開始systemd-resolved在 Oracle Linux 7.6 上使用。

我想在僅作為內容的/etc/resolv.conf符號連結的模式下使用它。/run/systemd/resolve/stub-resolv.confnameserver 127.0.0.53

我已經安裝systemd-networkdsystemd-resolved打包了。我已啟用相關服務並停用了NetworkManager服務network

但是我的安裝systemd-resolved不包含此存根檔案/run/systemd/resolve/stub-resolv.conf。它僅包含/run/systemd/resolve/resolv.conf.

你能告訴我為什麼我stub-resolv.conf失蹤了嗎?

答案1

我在 Ubuntu 20.04 LTS 上多次遇到同樣的問題,這只是因為 systemd-resolved.service 被自動或故意停止。啟動服務後,檔案 /run/systemd/resolv/stub-resolv.conf 檔案又回來了。

答案2

我在 Debian 9 上觀察到同樣的問題。

 o   A static file /usr/lib/systemd/resolv.conf is provided that lists the 127.0.0.53 DNS stub (see above) as only DNS server. This file may be symlinked from /etc/resolv.conf in order to connect all local clients that bypass local DNS APIs to systemd-resolved. This mode of operation is recommended.

這實際上是不正確的,文件位於: /lib/systemd/resolv.conf 這是一個普通的靜態文件,指向本地存根伺服器,沒有搜尋網域等。

如果升級到 Debian 10 版本,systemd-resolved 將從 232 移至 241。

我猜您正在使用與 Debian 9 類似的 systemd-resolved 版本。

相關內容