My laptop is running Ubuntu 20.10. It's connected to a network with a fairly normal internet connection - the router provides DHCP, DNS etc.
But another host on the network (not the router) provides a VPN connection to another network. I've configured the router so that traffic to that remote network gets bounced via the host providing the VPN connection. This all works.
Now I'm trying to configure DNS for that remote network. I don't want all my DNS queries going via the VPN, for a whole host of reasons (it's slow, not always up, not private etc etc). But I want to configure queries for a specific domain (call it example.com
) to go via a DNS server on the VPN.
I've dug around my router settings but it seems it's not possible to configure a per-domain DNS server on the router. So I'll have to configure it on the laptop instead.
How can I do this in recent versions of Ubuntu? Basically I want all DNS queries to be handled by the DNS server provided in my DHCP lease, except example.com, which I want handled by 192.168.88.4.
Where do I even start looking? As far as I can tell, the local DNS server is provided by systemd-resolved; I can't see any mention of domain-specific servers in its documentation.
I know I can configure dnsmasq to do this; should I stop systemd-resolved and configure dnsmasq instead to provide the local DNS service? In which case, how do I tell NetworkManager (or is it netplan these days?) to update the dnsmasq configuration when it gets a DHCP lease?
Or is there some way of telling NetworkManager about this directly?
systemd-resolved
has a Split DNS feature that can do this.https://fedoramagazine.org/systemd-resolved-introduction-to-split-dns/