トップ 一覧 Farm 検索 ヘルプ RSS ログイン

Diary/2026-2-16の変更点

  • 追加された行はこのように表示されます。
  • 削除された行はこのように表示されます。
!systemd-resolved
になってから,DNS設定が必要なときにはアドホックに対応していた
(/etc/resolv.confを一時的に書き換えたりしてた)のだけど,
VPNなんかでいろんな環境を利用することも増えてきたので,そろそろちゃんとした手順を覚えておきたい.
覚えるべきは resolvectl コマンド.
このコマンドの存在は,man systemd-resolved でもわかる.
簡単には,
 resolvectl status
で,
 Global
          Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
   resolv.conf mode: stub
 
 Link 2 (wlp0s20f3)
     Current Scopes: DNS
          Protocols: +DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
 Current DNS Server: 192.168.100.1
        DNS Servers: 192.168.100.1
 
 Link 3 (docker0)
     Current Scopes: none
          Protocols: -DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
 
 Link 5 (vboxnet0)
     Current Scopes: none
          Protocols: -DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
とかでてくる.
書き換えければ,たとえば,
 resolvectl dns 2 8.8.8.8
と,dnsコマンド使って,リンク先にDNSサーバーを設定できる 
 resolvectl status
で見てみると,
 Global
          Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
   resolv.conf mode: stub
 
 Link 2 (wlp0s20f3)
     Current Scopes: DNS
          Protocols: +DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
 Current DNS Server: 8.8.8.8
        DNS Servers: 8.8.8.8
 
 Link 3 (docker0)
     Current Scopes: none
          Protocols: -DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
 
 Link 5 (vboxnet0)
     Current Scopes: none
          Protocols: -DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
と,書き換わっていることがわかる.
同様に,domainコマンドでドメイン名(resolv.confのsearch)の設定ができる.