我安装了一个DNSMasq的Ubuntu16.04主机(10.0.10.2),它只为DNS服务,在同一个子网上安装了几个Windows主机,在同一个子网上安装了另外几个Linux主机。我的默认网关是为DNS服务器分发DHCP和10.0.10.2。
Windows框没有定义DNS搜索后缀或域,但我希望它们能够解析我在DNSMasq服务器上的/etc/host中定义的主机,而不必指定域或搜索后缀,但事实证明这是很困难的。Wireshark认为,在执行ping或尝试导航到Linux主机上的web服务时,Windows主机总是希望附加.local。
我的/etc/host文件如下:
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 0,box 1,box 2?
发布于 2018-08-31 03:17:29
您的resolv.conf不应该有外部DNS服务器,以确保dnsmasq正在解析所有DNS请求。改为:
nameserver 127.0.0.1要允许解析外部DNS名称,请使用dnsmasq作为全局DNS服务器,方法是告诉它使用某些外部DNS服务器。添加到DNSmasq配置文件:
-服务器直接指定上游服务器的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/host解析,添加到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=localhttps://unix.stackexchange.com/questions/465901
复制相似问题