I have a couple of Windows laptops, a Raspberry Pi 4 running Ubuntu, and an x86 box also running Ubuntu. Using DHCP reservation on my WiFi router (Apple Airport) I have given them all static IP addresses. Then on each machine I edited the hosts file and entered the names and IP addresses of all machines.

I would like to improve that last part. I would like to run a DNS service on my Raspberry Pi so that I can avoid manually editing and updating the hosts file on each machine. I want to do it in such a way that if my home DNS service is down I can still access the Internet for web browsing etc. In other words, if my Raspberry Pi goes down it should not take my home internet with it. I also don't want to have to configure each PC to point it to the Raspberry Pi as the DNS service.

So basically I want to run a DNS service on my Raspberry Pi, such that if the Pi is up all Windows PCs and other Ubuntu boxes discover the DNS service and use it for resolving local names, and if the Pi is down, the only thing that won't work is local name resolution.

This seems like a need a lot of people would have, so hopefully someone has invented something to solve this problem.

2 Answers 2


Configure your DHCP server to give out two addresses for the DNS server. The first one should be the IP address of your Raspberry Pi. The second should be the IP address of your ISP's nameserver (or of a public nameserver like or

The rpi needs to be running a DNS resolver like unbound or dnsmasq. It should be configured to:

  1. respond to queries from your local network only
  2. provide forward (name) and reverse (ip address) DNS lookups for the hosts on your LAN.

If you run dnsmasq, be sure to disable its DHCP functionality - you don't want two dhcp servers on the same network unless they are configured exactly the same.

Note that DNS lookups will be significantly slower when your rpi is down.

  • BTW, your Apple Airport should be capable of providing name resolution for your local hosts via Bonjour, so you probably don't even need to do this with your rpi.
    – cas
    Oct 24, 2021 at 0:22
  • If two DNS server addresses are given out, only the first one will be used. The second one will only be used if the first one is experiencing downtime. See serverfault.com/questions/501550/… Oct 24, 2021 at 0:33
  • 1
    yes, that is the point of giving out two addresses. the OP wanted DNS to still work if the rpi was down.
    – cas
    Oct 24, 2021 at 0:35
  • A couple of clarifying questions: (1) Does DNS service support chaining? If I use dnsmasq it will be able to resolve local names, and then forward non-local requests to ISP's nameserver? (2) I see in dnsmasq documentation that it is capable of giving out DNS addresses during a DHCP address request. Is that how nameservers are typically discovered? Oct 24, 2021 at 0:45
  • 1
    1. yep, that's what a DNS resolver does. they can configured to either do all lookups itself, or forward requests it doesn't know the answer for to another DNS server (e.g. your ISP, or a public one like 2. both dnsmasq and unbound can also resolve local hostnames for machines on your LAN (e.g. with a domain name of .local). 3. DNS resolvers can be set with either a static configuration (e.g. in /etc/resolv.conf on a linux machine) OR the DNS-server address(es) can be given out by a DHCP server when it gives the client machines their own IP addresses.
    – cas
    Oct 24, 2021 at 1:00

The standard DNS server on *nix is usually done by BIND - https://en.wikipedia.org/wiki/BIND

Here are a nice couple of articles describing the process in details: https://opensource.com/article/17/4/introduction-domain-name-system-dns and https://opensource.com/article/17/4/build-your-own-name-server


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.