0

How does DNS work on a Raspberry Pi (a recent version of Raspbian)?

From what I understand:

  • When I write a program and want to connect to somedomain.com, I don't specify what DNS server to use. I use a library function built into the language that asks the kernel to resolve the domain
  • The kernel ALWAYS uses /etc/resolv.conf
  • For some reason, in modern version of Linux, this is auto-generated by resolvconf
    • Why? What problem is resolvconf trying to solve? What was wrong with having DHCP clients like dhcpcd or systemd-networkd modify /etc/resolv.conf directly?
  • resolvconf doesn't run as a systemd service, so the dhcp client service needs to detect, and trigger resolveconf when a DHCP server supplies us with a new DNS server to use
    • What info does the dhcp client (dhcpcd) provide resolvconf? Just the new DNS servers it learned about from the DHCP server?
  • Where does systemd-resolved come in?
    • It's not enabled by default
    • If you enable it, does it work with resolveconf, or replace it?
  • Where does systemd-networkd come in?
    • It's not enabled by default
    • If you enable it (and disable dhcpcd), and specify a static DNS server in /etc/systemd/network/eth0.network using the DNS parameter, does it inform resolvconf of this? Does it try to modify /etc/resolv.conf directly? Does it expect systemd-resolved to be running?

On the surface, it seems like things were a lot simpler when it was just a single file and none of these tools had to interact with each other.

2
  • You are asking for a tutorial on Linux networking.
    – Milliways
    Dec 23 '21 at 21:14
  • 1
    @Milliways Linux has dozens of different network packages that all do different things. Some work together. Others compete. This is a question about a very specific part of Linux networking (client-side DNS), a very specific tool (resolvconf), and about a specific implementation of it (on Raspbian). Even using the exact same tools, other distributions probably do things a bit differently. I want to know how the RPi does it, hence raspberrypi.stackexchange.com. This question can definitely be answered in the short answer format of SE.
    – John
    Dec 24 '21 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.