0

I Have an Ubuntu 16.04 host (10.0.10.2) with DNSMasq installed which is only serving up DNS, and a couple Windows hosts on the same subnet, as well as a couple other Linux hosts on the same subnet. My default gateway is handing out DHCP as well as handing out 10.0.10.2 for a DNS server.

The Windows boxes do not have a DNS search suffix or domain defined, but I want to be able to have them resolve hosts that I've defined in my /etc/hosts on the DNSMasq server WITHOUT having to specify domains or search suffixes, but this is proving to be difficult. According to Wireshark, the Windows hosts always want to append .local when performing a ping or trying to navigate to a web service on the Linux hosts.

My /etc/hosts file is as follows:

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

My DNSMasq config is:

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

And my resolv.conf is:

nameserver 127.0.0.1
nameserver 8.8.8.8

Is there something I'm missing to allow the Windows hosts to just be able to resolve box-linux-0, box-linux-1, box-linux-2?

1

Your resolv.conf should not have external DNS servers to ensure that dnsmasq is resolving all DNS requests. Change to:

nameserver 127.0.0.1

To allow the resolution of external DNS names, use dnsmasq as the global DNS server by telling it to use some external DNS server. Add to DNSmasq config file:

--server Specify IP address of upstream servers directly.

server=8.8.8.8

To make dnsmasq to only resolve names that could actually be global dns names add to DNSmasq config file:

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

To ensure that local names are resolved by /etc/hosts add to DNSmasq file:

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

You could try this option (may be useful or not):

# 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.