I am using DNSmasq both for my local clients and some internet services. One service I provide is a dynDNS server. It receives IP updates via HTTP and writes it as simple hosts file but without domain. The domain is attached by DNSmasq due to the following minimal config:
interface=eth0 # internal
interface=eth1 # external
no-dhcp-interface=eth1
dhcp-range=192.168.1.2,192.168.1.254,12h
domain=mydomain.eu
no-hosts
addn-hosts=/etc/hosts.dyndns # hosts file created by my dynDNS server
expand-hosts
# Server/VMs
host-record=server,192.168.1.1
host-record=server.mydomain.eu,<externalIP>
cname=dns.mydomain.eu,server.mydomain.eu
address=/mydomain.eu/<externalIP> # wildcard subdomains
The problem is: The domain is delivered by DHCP to my local clients, too. If some of it asks for server
the client extends its request to the domain server.mydomain.eu
which is answered by DNSmasq to be <externalIP>
. Due to the topology of my connection to the internet that involves several issues. Instead it should be resolved to 192.168.1.1
.
How to make DNSmasq to distinguish between requests from local network and internet? Or is it possible to use domain
just for expanding hosts files?