
dns-options
可以使用以下命令將連線名稱變更myname
為值value
nmcli con modify myname ipv4.dns-options value
使用互動模式,我得到了一個簡短的描述dns-options
。
nmcli> describe ipv4.dns-options
=== [dns-options] ===
[NM property description]
Array of DNS options. NULL means that the options are unset and left at the default. In this case NetworkManager will use default options. This is distinct from an empty list of properties.
問題: 字段的價值是什麼dns-options
?dns-option
答案1
透過對 NetworkManager 原始碼樹的一些挖掘(libnm-core/nm-setting-ip-config.c
並尋找NDOTS
)和知識resolv.conf(5)
,這些選項似乎與可以在 中設定的選項相同/etc/resolv.conf
,例如
-bash-4.2$ grep options /etc/resolv.conf
options rotate
options timeout:1
options attempts:3
答案2
我會贊成@thrig 的答案,但我還沒有足夠的聲譽。我最近必須配置 DNS 輪換和超時。我發現您必須使用引號在單一命令中列出它們:
nmcli con modify <interface_name> ipv4.dns-options "timeout:1 rotate"
這顯示/etc/resolv.conf
如下:
# Generated by NetworkManager
nameserver 1.1.1.1
nameserver 8.8.8.8
options timeout:1 rotate