Linux Labs

Networking / Stage 9 of 14

Why the address works and the name does not

Not running Starting usually ~20 s
Leave the lesson

Step 5 of 8 · theory · 4 min

resolv.conf on a stock Ubuntu

On this machine /etc/resolv.conf is a plain file: the exercise setup wrote it. On an Ubuntu server it is usually set up differently.

There /etc/resolv.conf is a symbolic link to a file of the systemd-resolved service, and it says nameserver 127.0.0.53. That is the address of the service itself, on the same machine: programs ask it, and it forwards the questions to the real DNS servers. resolvectl status prints their list.

bash
ls -l /etc/resolv.conf     # a link to a systemd-resolved file
resolvectl status          # the real DNS servers, per interface

The service rewrites the linked file itself, so a manual edit there does not last. On such a machine DNS servers are set in the network settings — for example, in Netplan, which you met in the addressing module.

Check yourself 1 question

On an Ubuntu server /etc/resolv.conf links to a systemd-resolved file that says nameserver 127.0.0.53. What does that mean?

  • The address is indeed on this machine: systemd-resolved listens there and forwards questions to the real servers. resolvectl status shows which.

  • The servers are set in the systemd-resolved settings, not in this file. resolvectl status shows whether there are any.

  • systemd-resolved maintains the file and will overwrite the edit. On such a machine you change servers where the service takes them from — for example, in the Netplan settings.

127.0.0.53 is systemd-resolved's address: programs ask it, and it forwards the questions to the DNS servers in its settings. resolvectl status prints those servers.

Key points

  • 127.0.0.53 in resolv.conf is systemd-resolved on the same machine; resolvectl status shows the real servers.
  • Change a setting where it is taken from: a file maintained by a service gets rewritten.
Ubuntu 24.04
Loading…