My Profile Photo

Sheogorath's Blog

DNS CNAME shenanigans

Today I learned that using CNAMES in combination with /etc/hosts can be a really powerful tool and a cheap way to build a split-DNS setup. The way it works, is by using a CNAME for the target domain(e.g. and adding the reference (e.g. with a local IP into /etc/hosts. As a result, you’ll get the IP locally set for as target for

I came across this, while searching for an easy way to redirect traffic to a local IP, while exposing the same service on a public IP. I decided to test how systemd-resolved would behave and it behaved exactly as I wanted, which might be the easiest solution for my problem for now.