1

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.

John
  • 467
  • 1
  • 5
  • 10

0 Answers0