Required to call `systemd-resolve` each time I connect to VPN

cn flag

Whenever I connect to a VPN using OpenVPN I have to run the following command or I cannot access some websites:

sudo systemd-resolve --set-dns= --interface=wlp111s0

Is there a way to permanently fix this so that I don't have to run the command every time I connect to the VPN?

In my /etc/openvpn/client.conf I have the following dhcp-option set, where "" are specific DNS servers:

dhcp-option DOMAIN-ROUTE .
dhcp-option DNS
dhcp-option DNS
dhcp-option DNS
dhcp-option DNS

In my attempts to fix this I have tried adding and corresponding 2606:4700:4700::1111 to my IPv4 and IPv6 network settings (i.e. through the GUI).

I have tried adding them as name servers in /etc/resolv.conf

Out of desperation I have also added it to my /etc/network/interfaces file using this:

auto lo
iface lo inet loopback

iface wlp111s0 inet dhcp

So far none of them have worked.

I am running Ubuntu 18.04.06

Does anyone know why I have to manually set the DNS each time?
Does anyone know how to fix this?

heynnema avatar
ru flag
You probably shouldn't use the DNS servers that you refer to, but rather, use the DNS servers provided by your VPN... else you get what is known as a DNS leak. See and to confirm this.
cn flag
@heynnema Good information, thanks!

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.