Setting up dnsmasq for a local network

Solution 1:

Refer to the DNSmasq documentation, especially the dnsmasq manpage and sample configuration file. The local keyword tells DNSmasq to perform those domain lookups with local data. This affects requests send to DNSmasq for foo.localnet and bar.localnet, for example. I don't think this is what you want.

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

To force host/subdomain lookups to resolve to a specific address, you'd probably want to use the address keyword. The second example below should allow web1.devbox and web2.devbox and web73872.devbox to all resolve to the address specified.

# Add domains which you want to force to an IP address here.
# The example below send any host in doubleclick.net to a local
# webserver.
address=/doubleclick.net/127.0.0.1

# for your example
address=/devbox/192.168.3.99

I use DNSmasq at home to handle simple DNS stuff for my LAN; in that case, local and the associated domain and expand-hosts keywords are appropriate. The DNSmasq server is my primary nameserver, so all requests go through it; any nonlocal addresses are passed back to the ISP's nameserver. You might consider that configuration if possible.

Solution 2:

You can also set short hostnames in /etc/hosts

192.168.3.99 website1
192.168.3.99 website2
192.168.3.99 website3
192.168.3.100 website4

and tell dnsmasq to expand all names in /etc/hosts to the .devbox domain.

local=/localnet/
expand-hosts
domain=devbox

website3.devbox should resolve.

This enables you to define DNS names via /etc/hosts only, which I find more convenient than dnsmasq address= entries.

This approach has the disadvantage that all names managed like this must be in the same domain.