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

<projectname>.dev.net

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:

server=/dev.net/172.18.0.1

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

How can I configure the same behaviour for resolved?

share|improve this question
up vote 1 down vote accepted

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:

server=/dev.net/172.18.0.1
share|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

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:

DNS=127.0.1.1
FallbackDNS=127.0.1.1

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).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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