ドメインなしでWindowsホストにDNSサービスを提供するようにDNSMasqを取得するにはどうすればよいですか?

ドメインなしでWindowsホストにDNSサービスを提供するようにDNSMasqを取得するにはどうすればよいですか?

DNSMasqがインストールされているUbuntu 16.04ホスト(10.0.10.2)があります。ただ同じサブネット上の複数のWindowsホストと同じサブネット上の他の複数のLinuxホストにDNSサービスを提供します。私のデフォルトゲートウェイは、DHCPとDNSサーバー用の10.0.10.2を展開しています。

Windowsシステムには、定義されたDNS検索サフィックスまたはドメインはありませんが、ドメインまたは検索サフィックスを指定せずにDNSMasqサーバーの/ etc / hostsで定義されたホストを確認できるようにしたいが、これは困難であることがわかりました。 Wiresharkによると、WindowsホストはLinuxホストでWebサービスをpingまたは閲覧しようとしたときに常に.localが追加されると予想しています。

私の/etc/hostsファイルは次のとおりです。

127.0.0.1 localhost
10.0.10.2 box-linux-0 box-linux-0.local
10.0.10.3 box-linux-1 box-linux-1.local
10.0.10.3 box-linux-2 box-linux-2.local
10.0.10.7 box-windows-0 box-windows-0.local
10.0.10.5 box-windows-1 box-windows-1.local

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

私のDNSMasq構成は次のとおりです。

strict-order
port=53
resolv-file=/etc/resolv.conf
log-queries
log-facility=/var/log/dnsmasq.log

私のresolv.confは次のようになります。

nameserver 127.0.0.1
nameserver 8.8.8.8

Windowsホストがbox-linux-0、box-linux-1、box-linux-2を確認できるようにすることはありませんか?

ベストアンサー1

dnsmasqがすべてのDNS要求を解決できるように、resolv.confには外部DNSサーバーがあってはなりません。に変更:

nameserver 127.0.0.1

外部DNSの名前解決を許可するには、dnsmasqに外部DNSサーバーを使用するように指示し、dnsmasqをグローバルDNSサーバーとして使用します。 DNSmasq構成ファイルに追加:

--server はアップストリームサーバーの IP アドレスを直接指定します。

server=8.8.8.8

dnsmasq が実際にグローバル DNS 名である可能性のある名前のみを確認するには、DNSmasq 構成ファイルに以下を追加します。

# Never forward plain names (without a dot or domain part)
domain-needed
# Never forward addresses in the non-routed address spaces.
bogus-priv

/etc/hosts でローカル名を解決するには、DNSmasq ファイルに以下を追加します。

# Add local-only domains here, queries in these domains are answered
# from /etc/hosts or DHCP only.
local=/local./

次のオプションを試すことができます(動作する場合も動作しない場合もあります)。

# Set this (and domain: see below) if you want to have a domain
# automatically added to simple names in a hosts-file.
expand-hosts

# Set the domain for dnsmasq. this is optional, but if it is set, it
# does the following things.
# 1) Allows DHCP hosts to have fully qualified domain names, as long
#     as the domain part matches this setting.
# 2) Sets the "domain" DHCP option thereby potentially setting the
#    domain of all systems configured by DHCP
# 3) Provides the domain part for "expand-hosts"
domain=local

おすすめ記事