如何更改 eth0 的 DNS?

如何更改 eth0 的 DNS?

根用户:

systemd-resolve --status

输出:

Global
          DNS Domain: openstacklocal
          DNSSEC NTA: 10.in-addr.arpa
                      16.172.in-addr.arpa
                      168.192.in-addr.arpa
                      17.172.in-addr.arpa
                      18.172.in-addr.arpa
                      19.172.in-addr.arpa
                      20.172.in-addr.arpa
                      21.172.in-addr.arpa
                      22.172.in-addr.arpa
                      23.172.in-addr.arpa
                      24.172.in-addr.arpa
                      25.172.in-addr.arpa
                      26.172.in-addr.arpa
                      27.172.in-addr.arpa
                      28.172.in-addr.arpa
                      29.172.in-addr.arpa
                      30.172.in-addr.arpa
                      31.172.in-addr.arpa
                      corp
                      d.f.ip6.arpa
                      home
                      internal
                      intranet
                      lan
                      local
                      private
                      test

Link 2 (eth0)
      Current Scopes: DNS
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
         DNS Servers: 192.168.16.2
                      192.168.16.3
          DNS Domain: openstacklocal

我需要更改 eth0 的 DNS。我做了以下操作:

cd /etc/systemd/network
nano 20-wired.network

输入:

[Match]
Name=eth0

[Network]
DNS=1.1.1.1, 192.168.16.2, 192.168.16.3

已保存。

service systemd-networkd restart
service systemd-resolved restart

然后:systemd-resolve --status

什么都没变。我做错了什么?如何更改 eth0 的 DNS?另外:

systemd-resolve --interface eth0 --set-dns 1.1.1.1

输出:

Please configure DNS settings for systemd-networkd managed interfaces directly in their .network files.

相关内容