1

I am using openconnect to connect to vpn and vpn-slice for vpn splitting. openconnect modifies /etc/resolv.conf after start, but that doesn't help with vpn domain names resolving.

To work around that, I configured NetworkManager to use dnsmasq for domain name resolving.

/etc/NetworkManager/NetworkManager.conf

[main]
plugins=ifupdown,keyfile
dns=dnsmasq

[ifupdown]
managed=false

[device]
wifi.scan-rand-mac-address=no

And configured dnsmasq to use inner vpn dns to resolve custom domain names.

/etc/NetworkManager/dnsmasq.d/myvpn

server=/.vpn.domain/192.168.213.104

And that work perfectly on Ubuntu 18.04

I have tried to do the same with another laptop and failed. That other laptop has Ubuntu 20.04 installed.

There, domain names are not resolved even though configuration is the same (if I didn't completely miss something, I really hope I did). If I add domain names to /etc/hosts, everything starts working. But there's a lot of names, so, I'd prefer to use dnsmasq

Here's the difference between those two machines

With Ubuntu 18.04, where everything works, /etc/resolv.conf and /run/NetworkManager/resovl.conf are identical and contain the following lines only

/etc/resolv.conf

#Generated  by NetworkManager
nameserver 127.0.1.1

which is dnsmasq

With Ubuntu 20.04 /run/Networkmanager/resolv.conf and /etc/resolv.conf are different. /etc/resolv.conf contains a lot of stuff and /run/NetworkManager/resolv.conf contains same lines as the on on Ubuntu 18.04

/etc/resolv.conf

 This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "resolvectl status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.

nameserver 127.0.0.53
options edns0 trust-ad

which is systemd-resolved

/run/NetworkManager/resolv.conf

#Generated  by NetworkManager
nameserver 127.0.1.1

which is dnsmasq

Also with Ubuntu 18.04 directory /etc/dnsmasq.d exists and contains two files

/etc/dnsmasq.d/network-manager

# Tell any system-wide dnsmasq instance to make sure to bind to interfaces
# instead of listening on 0.0.0.0
# WARNING: changes to this file will get lost if network-manager is removed.
bind-interfaces     

/etc/dnsmasq.d/ubuntu-fan

# ensure that any system dnsmasq does not bind to fan-*
bind-interfaces
except-interface=fan-* 

With Ubuntu 20.04 directory /etc/dnsmasq.d doesn't even exist

dnsmasq is running on both machines.

ps aux | grep dnsmasq
nobody     31355  0.0  0.0  14788  4280 ?        S    09:47   0:00 /usr/sbin/dnsmasq --no-resolv --keep-in-foreground --no-hosts --bind-interfaces --pid-file=/run/NetworkManager/dnsmasq.pid --listen-address=127.0.1.1 --cache-size=0 --clear-on-reload --conf-file=/dev/null --proxy-dnssec --enable-dbus=org.freedesktop.NetworkManager.dnsmasq --conf-dir=/etc/NetworkManager/dnsmasq.d

I seem to be missing some detail, but I have little experience with this kind of stuff and don't know how to diagnose it. Would appreciate any help with that.

1 Answer 1

0

I'm using Ubuntu 20.04, kernel 5.4.0-73-generic and I've got this working for me.

All I had to do was adding the line

dns=dnsmasq

to /etc/NetworkManager/NetworkManager.conf

and create a /etc/NetworkManager/dnsmasq.d/custom-dns file with the contents below:

server=/.mydomain.test/205.251.196.172

I then restarted the network manager with

sudo service network-manager restart

and it works

:~$ nslookup -type=TXT something.mydomain.test
Server:     127.0.1.1
Address:    127.0.1.1#53

something.mydomain.test text = "test value"

I hope it helps.

You must log in to answer this question.

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