I use Ubuntu for development. And I've build my dev env with using dnsmasq for resolving my dev hostnames, usually it's:


So I set up my own DNS server for getting proper IP address (I'm using docker)

I used to create conf file in /etc/NetworkManager/dnsmasq.d with content:


Thus dnsmasq redirects all dns-resolve request to for *.dev.net domains.

How can I configure the same behaviour for resolved?


It is not possible to configure different upstream servers for i.e. dev.net with systemd-resolved.service

What worked for me (on Ubuntu 17.04) is to install and configure a dnsmasq server alongside the systemd-resolved.service

The steps needed would be:

package installation:

apt install dnsmasq -y

start and enable dnsmasq service:

systemctl start dnsmasq
systemctl enable dnsmasq

add a configuration file inside /etc/dnsmasq.d/ like this:

| improve this answer | |
  • I am planning to disable systemd-resolved as well. Thank you for confirming there is no chances to make it workable with desired configuration. – Alex Kapustin May 1 '17 at 2:57

it is now possible, under ubuntu 18.04 (systemd --version -> 237) to configure dns per link: sudo systemd-resolve --interface lxdbr0 --set-dns --set-domain lxd

| improve this answer | |

Ok, so here is how I resolved this:

First, installed dnsmasq:

sudo apt-get install dnsmasq

added dns=dnsmasq to /etc/NetworkManager/NetworkManager.conf's [main] section.

Edited /etc/systemd/resolved.conf to add:


in the [Resolve] section.

Copy all needed configuration to /etc/NetworkManager/dnsmasq.d/.

After reboot everything should be fine (or just restart NetworkManager & systemd-resolved).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.