I am using Ubuntu 20.04 and systemd-resolved to resolve dns queries. Machine is attached to 1 interface.

      dhcp4: true
      set-name: eth0
        addresses: [,]
        search: [domain.first, domain.second]
  version: 2

Resolvectl picking one of DNS server as current dns server. My challenge here is that I have one dns server which is only resolving queries of domain.first and another is only resolving queries of domain.second.

Whenever Resolvectl picking as current dns server, queries of search domain.first are successful but queries of search domain.second are failing (which is obvious as it should be resolved by

Is there way to setup resolvectl so that it should resolve queries based on domain search and its respective dns server .i.e. resolve to different dns servers based on search domain

I am aware that bind9 are providing this functionality but I want to achieve similar with systemd-resolved resolver.

1 Answer 1


The closest systemd-resolved feature I am aware of is "split dns", but I believe that only works with multiple network interfaces (e.g. a physical adapter and a vpn adapter).

I see some suggestions to use dnsmasq to achieve your goal of conditional forwarding servers.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .