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
resolvconftrying to solve? What was wrong with having DHCP clients likedhcpcdorsystemd-networkdmodify/etc/resolv.confdirectly?
- Why? What problem is
resolvconfdoesn't run as a systemd service, so the dhcp client service needs to detect, and triggerresolveconfwhen a DHCP server supplies us with a new DNS server to use- What info does the dhcp client (
dhcpcd) provideresolvconf? Just the new DNS servers it learned about from the DHCP server?
- What info does the dhcp client (
- Where does
systemd-resolvedcome in?- It's not enabled by default
- If you enable it, does it work with
resolveconf, or replace it?
- Where does
systemd-networkdcome 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.networkusing theDNSparameter, does it informresolvconfof this? Does it try to modify/etc/resolv.confdirectly? Does it expectsystemd-resolvedto 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.