brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: resolvectl revert undoes the DNS settings you changed by hand on a link

Network and access
~/tips/tip-dns-resolvectl-revert

resolvectl dns eth0 192.168.1.53

Resets the DNS settings of one network interface back to its defaults.

After a few experiments with resolvectl dns and resolvectl domain, I want my network back to what it was without a reboot. There is a command for that.

Say you tried a different resolver on one interface, with example values:

resolvectl dns eth0 192.168.1.53
resolvectl domain eth0 '~example.com'

The manual says a domain with a ~ prefix is a route-only domain for that interface, so queries for example.com are sent to this link. To drop both changes again:

resolvectl revert eth0

The manual says that after a revert all per-interface DNS settings are reset to their defaults, undoing all effects of dns, domain, default-route, llmnr, mdns, dnssec, dnsovertls and nta. The manual lists the command as added in systemd version 239.

Check the result with the status command for that link:

resolvectl status eth0

The manual also notes that when a network interface disappears, its configuration is lost automatically, so an explicit revert is not necessary in that case. It is for links that stay up.

The caveat: changes made with resolvectl dns are runtime settings to begin with. They do not survive a reboot, and the network manager may overwrite them when it reconfigures the link. Permanent settings belong in the network configuration of that tool, and a revert only undoes what you set by hand.

Further reading: resolvectl manual

More Network and access tips scp -3 alice@server-a:/var/backups/db.sql.gz bob@server-b:/srv/restore/ tailscale exit-node suggest tailscale lock sign nodekey:1abddef1 tlpub:abcdef12 wg genpsk > peer1.psk Table = off All Network and access tips (163) All topics

Link