Docker cannot resolve DNS on private network [closed]

Docker populates /etc/resolv.conf by copying the host’s /etc/resolv.conf, and filtering out any local nameservers such as 127.0.1.1. If there are no nameservers left after that, Docker will add Google’s public DNS servers (8.8.8.8 and 8.8.4.4). According to the Docker documentation: Note: If you need access to a host’s localhost resolver, you must modify your DNS … Read more

DNS not working within docker containers when host uses dnsmasq and Google’s DNS server are firewalled?

A clean solution is to configure docker+dnsmasq so than DNS requests from the docker container are forwarded to the dnsmasq daemon running on the host. For that, you need to configure dnsmasq to listen to the network interface used by docker, by adding a file /etc/NetworkManager/dnsmasq.d/docker-bridge.conf: $ cat /etc/NetworkManager/dnsmasq.d/docker-bridge.conf listen-address=172.17.0.1 Then restart network manager to … Read more

Wildcard subdomains with dnsmasq

While the accepted answer may have solved the author’s problem, it is misleading as it suggests that the leading dot would match subdomains only, which is not true. dnsmasq ignores any leading dots, so that address=/domain.tld/192.168.0.1 is equivalent to address=/.domain.tld/192.168.0.1 or even address=/……domain.tld/192.168.0.1 As of now (dnsmasq v2.76), there is unfortunately no way to specify … Read more

Don’t automatically include all subdomains in DNSMasq address

host-record=example.com,1.2.3.4 The dnsmasq man page says: –host-record=<name>[,<name>….][<IPv4-address>],[<IPv6-address>] Add A, AAAA and PTR records to the DNS. This adds one or more names to the DNS with associated IPv4 (A) and IPv6 (AAAA) records. A name may appear in more than one host-record and therefore be assigned more than one address. Only the first address creates … Read more

dnsmasq – Multiple forwarding servers for domain entries?

Well in your example you’re only pointing out facebook, but I guess you would have the same need for every hostname you might visit dnsmasq provides the option –all-servers –all-servers By default, when dnsmasq has more than one upstream server available, it will send queries to just one server. Setting this flag forces dnsmasq to … Read more

Restricting dnsmasq’s DHCP server to one interface

The man page explains it quite nicely. If it’s just DHCP you don’t want to run on wlan0 then you can use –no-dhcp-interface=wlan0. If you don’t want dnsmasq to listen at all on wlan0 then you can use –except-interface=wlan0. If you only want dnsmasq to listen on eth0 then you can use –interface=eth0.

How to configure a static wildcard subdomain with dnsmasq

I do the exact same thing on my dev server(s) so that I can have an rsynced mirror locally and on the off-site server with identical configs. Here’s what you need in your dnsmasq.conf (make sure you restart it) assuming your webserver’s internal interface is 192.168.0.3: address=/.server.mydomain.com/192.168.0.3 This will create a wildcard entry for *.server.mydomain.com … Read more

Resolve a domain name to CNAME alias locally using dnsmasq

You can add the following to your configuration file in dnsmasq: cname=somedomain.com,some-balancer-1213231237.ap-southeast-2.elb.amazonaws.com as specified in the man page: –cname=<cname>,[<cname>,]<target>[,<TTL>] Return a CNAME record which indicates that <cname> is really <target>. There are significant limitations on the target; it must be a DNS name which is known to dnsmasq from /etc/hosts (or additional hosts files), from … Read more

Per-client DNS servers with DNSMasq

Setup reservations for the specific hosts using the dhcp-host option. Use tag options to flag those for a special set of options. This is completely un-tested, but I suspect your config might look something like this. Check the man page for full details. dhcp-host=00:15:99:27:f8:98,set:specialhosts,192.168.32.20 dhcp-host=00:51:99:72:8f:89,set:specialhosts,192.168.32.21 dhcp-option=tag:specialhosts,option:dns-server,8.8.8.8,8.8.4.4

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 payload of a DNS reply. There are CHAOS queries that exist for the purpose of identifying the specific recursive server … Read more