.local で終わるドメイン名は解決されません。

.local で終わるドメイン名は解決されません。

私のLinux(Ubuntu)デスクトップで.localホストをチェックするのに奇妙な問題があります。 (プリンタが動作していないことに気づきました。プリンタのIPアドレスをmdnsを使用して確認しましたが、動作しないことがわかりました。)そして他のコンピュータにpingを試みました。結果:

ping: zoe.local: Name or service not known

avahi-browseはIPアドレスを確認できます

= enp0s31f6 IPv4 zoe [xx:xx:xx:xx:xx:xx]                       Workstation          local
   hostname = [zoe.local]
   address = [192.168.3.221]
   port = [9]
   txt = []

その後、内容を確認しました/etc/nsswitch.conf。普通のようです。

# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd:         compat systemd
group:          compat systemd
shadow:         compat
gshadow:        files

hosts:          files mdns4_minimal [NOTFOUND=return] dns myhostname mymachines
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis

/etc/resolv.conf は /run/resolvconf/resolv.conf へのシンボリックリンクで、内容は標準的に見えます。

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.

nameserver 127.0.0.53
search intern

libnss-mdnsもインストールされます。

同じネットワーク上の2番目のシステムでは、.localアドレス解決が正しく機能します。次に、straceを使用して2つのpingコマンドを比較しました。 systemd-resolvedの結果が異なることがわかりました。ループバックインターフェイスからトラフィックをキャプチャしました。興味深いことに、systemd-resolvdは.localドメインのSOAを報告します。次のステップでは、ジオコーディングはルーターに.localアドレスを要求します。これにより上記のエラーが発生します。

Wiresharkキャプチャは次のようになります。

1   0.000000000 127.0.0.1   127.0.0.53  DNS 65  Standard query 0x70d2 SOA local
2   0.001437    127.0.0.53  127.0.0.1   DNS 113 Standard query response 0x459c SOA local SOA router.intern

2番目のコンピュータのローカルsystemdリゾルバがSOAを報告せず、mdnsアドレス解決が正しく機能します。

1   0.000000000 127.0.0.1   127.0.0.53  DNS 65  Standard query 0x70d2 SOA local
2   0.027250385 127.0.0.53  127.0.0.1   DNS 65  Standard query response 0x70d2 No such name SOA local

DNSキャッシュをフラッシュしようとしましたが、systemd-resolve --flush-caches違いはありませんでした。

systemd-resolvdが奇妙に動作するようです。ここで何が起こっているのか知っている人はいますか? systemdが解決する問題を解決するためにSOAを使用するのはなぜですか?

systemd-resolve --status私が見るには大丈夫に見えます:

Global
       LLMNR setting: no                  
MulticastDNS setting: no                  
  DNSOverTLS setting: no                  
      DNSSEC setting: no                  
    DNSSEC supported: no                  
          DNS Domain: intern              
          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 6 (vmnet8)
      Current Scopes: none
DefaultRoute setting: no  
       LLMNR setting: yes 
MulticastDNS setting: no  
  DNSOverTLS setting: no  
      DNSSEC setting: no  
    DNSSEC supported: no  

Link 5 (vmnet1)
      Current Scopes: none
DefaultRoute setting: no  
       LLMNR setting: yes 
MulticastDNS setting: no  
  DNSOverTLS setting: no  
      DNSSEC setting: no  
    DNSSEC supported: no  

Link 4 (virbr0-nic)
      Current Scopes: none
DefaultRoute setting: no  
       LLMNR setting: yes 
MulticastDNS setting: no  
  DNSOverTLS setting: no  
      DNSSEC setting: no  
    DNSSEC supported: no  

Link 3 (virbr0)
      Current Scopes: none
DefaultRoute setting: no  
       LLMNR setting: yes 
MulticastDNS setting: no  
  DNSOverTLS setting: no  
      DNSSEC setting: no  
    DNSSEC supported: no  

Link 2 (enp0s31f6)
      Current Scopes: DNS                     
DefaultRoute setting: yes                     
       LLMNR setting: yes                     
MulticastDNS setting: no                      
  DNSOverTLS setting: no                      
      DNSSEC setting: no                      
    DNSSEC supported: no                      
  Current DNS Server: 192.168.3.1             
         DNS Servers: 192.168.3.1             
                      fe80::2a0:57ff:fe24:94c9
          DNS Domain: ~.                      
                      intern 

ベストアンサー1

修正する:

次の問題が見つかりました。https://github.com/lathiat/nss-mdns/issues/75

私のルーター/ ISPは.localドメインのSOAを提供します。 mdnsの解決を防ぎますunicast SOA heuristic/etc/mdns.allow以下を追加しました。

.local.
.local

mdns4_minimalの代わりにmdns4に切り替えると機能します。

hosts:          files mdns4 [NOTFOUND=return] dns myhostname mymachines

おすすめ記事