Skip to main content
Share Your Experience: Take the 2024 Developer Survey
19 votes

Restricting dnsmasq's DHCP server to one interface

For those who like me are confusing on why port 53 is still open for all interfaces regardless which option you put in to limit it. There is one more option that need to be turned on. -z, --bind-...
Jin Chen's user avatar
  • 191
18 votes

Bind dnsmasq DNS to just localhost (

I had to add bind-interfaces to the config file, so that interface and listen-address had the desired effect. E.g.: interface= bind-interfaces dnsmasq will always listen on lo, so you don't have to ...
shapecatcher's user avatar
16 votes

How to I make a domain resolve to different IP's when resolved from internal network and external network?

In BIND 9, you can define multiple "views": in effect, BIND shows one version of a DNS zone to specified clients and another version to others. This seems to be exactly what you'll need. Here is a ...
telcoM's user avatar
  • 4,618
14 votes

Resolve a domain name to CNAME alias locally using dnsmasq

You can add the following to your configuration file in dnsmasq:, as specified in the man page: --cname=<cname>,[&...
Tommiie's user avatar
  • 5,675
13 votes

dnsmasq doesn't automatically reload when entry is added to /etc/hosts

There are two ways to cause dnsmasq to reload a hosts file: As Aaron Copley noted in his comment, send SIGHUP to dnsmasq. From the man page: When it receives a SIGHUP, dnsmasq clears its cache and ...
Jeffery To's user avatar
11 votes

Separate Servers for TFTP and DHCP for PXE Boot

From the dnsmasq example config # An example of dhcp-boot with an external TFTP server: the name and IP # address of the server are given after the filename. # Can fail with old PXE ROMS. Overridden ...
mbrandeis's user avatar
  • 306
11 votes

dnsmasq: how to increase TTL?

Dnsmasq has a --min-cache-ttl=[seconds] parameter, where seconds ≤ 3600 (1 hour).
Magda's user avatar
  • 111
11 votes

Is it possible to override a single domain name using dnsmasq?

Add this line to /etc/dnsmasq.conf: addn-hosts=/etc/dnsmasq.hosts Then insert your domain names into /etc/dnsmasq.hosts: Don't forget the ...
Jon Musselwhite's user avatar
10 votes

Find out which DNS server answered your query

See this in short, nslookup set the query type to SOA single line: nslookup -querytype=soa ...
Phillip Williams's user avatar
9 votes

Find out which DNS server answered your query

I want to know what exact server in the end had the answer. Is that possible? This is not achievable. You will not find the specific authoritative server that was consulted named anywhere in the ...
Andrew B's user avatar
  • 33.2k
9 votes

How does DNSMasq integrate with my router?

DNSmasq does not need to communicate with your router. The DNSmasq service just took over the service of DNS and DHCP and your router does not have to provide that anymore. Since you have disabled the ...
Thomas's user avatar
  • 4,305
8 votes

dnsmasq reading /etc/hosts, but not using it

I know this is from 2011, but since it still has no accepted answer: Today, I had a similar problem. Curl worked to get the expected response from a haproxy lxc with the respective header, but ...
Jan Alleman's user avatar
8 votes

Configure DC & Firewall/ Router such that clients can use Internet even if DC is down?

You solve this by having more than one domain controller running DNS in your environment. A domain-joined client should use only domain controllers for DNS.
MDMarra's user avatar
  • 101k
8 votes

NetworkManager & dnsmasq - ignore auto DNS settings

I'm not using dnsmasq, but I had a similar issue. The solution for me was: Put the DNS servers you want in /etc/resolv.conf (ref) # IPv4 nameservers: nameserver nameserver # IPv6 ...
tsj's user avatar
  • 208
7 votes

How to get Netplan to set the DNS server in /etc/resolv.conf based on info coming from the DHCP server?

The same issue I faced too. Netplan uses systemd-resolvd for name resolution and most of time I found the /etc/resolve.conf file is a symlink to /run/systemd/resolve/stub-resolv.conf and which uses ...
Mashkoor Qadir's user avatar
6 votes

dnsmasq: how to increase TTL?

You can actually bypass the 3600 second --min-cache-ttl check by exploiting an integer overflow bug in the dnsmasq C source code, without any need for recompiling. Here is a value which works: Via ...
25931858's user avatar
6 votes

Setting up dnsmasq for a local network

You can also set short hostnames in /etc/hosts website1 website2 website3 website4 and tell dnsmasq to expand all names in /etc/hosts to the ....
teknopaul's user avatar
  • 659
5 votes

How to resolve all .dev domains to localhost on Windows

I have resolved this situation using Acrylic DNS Proxy. It's a free, open-source software for Windows that allows you to wildcard a folder as local top domain registry. Download Acrylic DNS Proxy ...
Josh's user avatar
  • 151
5 votes

Is it possible to add a wildcard CNAME into dnsmasq?

I've checked v2.77 and found that wildcard CNAME is working there. You should add to config cname=*,, but your dnsmasq should be authoritative server for domain(in this ...
Alexander Tolkachev's user avatar
4 votes

dnsmasq failed to restart

4 11:04:42 dnsmasq[18806]: dnsmasq: bad dhcp-range at line 4 o...f That looks useful to me - did you read it? It kind of seems like there is a problem with your config. Hint: Some lines were ...
user9517's user avatar
  • 116k
4 votes

Configure DC & Firewall/ Router such that clients can use Internet even if DC is down?

From your router (or whatever is handling DNS resolution), you can delegate queries for ad-related names, say all Those for the domain, to your domain controllers. This would allow ...
EEAA's user avatar
  • 110k
4 votes

Bind dnsmasq DNS to just localhost (

Yes you can do that The dnsmasq man page says this about the --interface argument: -i, --interface=<interface name> Listen only on the specified interface(s). Dnsmasq automatically ...
Ryan Babchishin's user avatar
4 votes

How to disable open recursive dns in dnsmasq?

As far as I know, dnsmasq doesn't support a setting like that. In fact, you shouldn't even use it as an open DNS server, it's not meant for that, dnsmasq is only meant for local networks. If you want ...
Broco's user avatar
  • 2,029
4 votes

DNSMASQ config for captive portal

when I use address=/#/, the internet requests that go from internal scripts also fail It seems that your internal scripts use to resolve DNS names the same local dnsmasq server as you ...
Slipeer's user avatar
  • 3,313
4 votes

dnsmasq not responding DHCP requests that don't follow a DHCP discover

The answer is to use --dhcp-authoritative option in dnsmasq. The problem was that I was restarting the dnsmasq server each time, so it had no lease file, but dhclient had its own lease file. Not being ...
Ricky Robinson's user avatar
4 votes

Configure LXC to use specific DNS server instead of DNSMASQ

Okay, I think I got it. I'll accept this answer, but mark my words I'll post another question if down the road this turns out not to have worked. I'm still running 3 (!) DNS servers on this computer:...
jcarpenter2's user avatar
4 votes

Resolve DNS for a docker container with dnsmasq

You can use the host's local DNS resolver (e.g. dnsmasq) from your Docker containers if they are on a user defined network. In that case a container's /etc/resolv.conf will have the nameserver 127.0.0....
Eugene Yarmash's user avatar
4 votes

How to resolve dns in multiple name servers?

"if its not able to resolve it should try to resolve using the second name server " Yeah, except that is not how DNS works. If server 1 says "can not resolve" THAT IS IT. They are supposed to be ...
TomTom's user avatar
  • 52k
4 votes

DNSmasq on 2 interfaces

You need to specify dnsmasq which interface to use what network. You can do this with below change in your dnsmasq.conf file: dhcp-range=ap0,,,,12h dhcp-range=...
ChandanK's user avatar
  • 291
4 votes

DNS Speed tests - are they reliable or sensible?

You are over thinking things. DNS is intended to be a distributed service that works off of cached information. Don't change DNS records often, and use longer-lived TTLs to allow ISPs and other ...
ivanivan's user avatar
  • 1,498

Only top scored, non community-wiki answers of a minimum length are eligible