Score:1

/etc/resolv.conf not getting properly regenerated after VPN disconnect

jp flag

I'm running Ubuntu 20.04.3 LTS.

After booting, and before connecting to my VPN, my /etc/resolv.conf looks like this:

# 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

It gets changed when I connect to my VPN and looks like this:

# Perimeter81 Custom DNS
nameserver 10.127.248.1

But then when I disconnect from the VPN, it doesn't get regenerated properly, it ends up with just a comment in it:

# Generated by resolvconf

...and of course then lookups don't work. I have to disconnect/reconnect from my wifi, and then it goes back to what it was originally.

So it seems like whatever is triggered on VPN disconnect to regenerate resolv.conf is doing something different than whatever sets it up in the first place. How do I fix it?

Nate T avatar
it flag
20.04.3? I didn't know that it existed. Did it come out recently? I am on '".2 myself. Did "'.3 add any features? I'll have to look into it.
jp flag
I have no idea when it came out. I just ran `lsb_release -a` and that's what it reported
Nate T avatar
it flag
I may have it as well. I updated recently. Ill check when I get home. I am looking into your issue. Not sure if I'll find anything, but for now try using `find` to search for `.aclocal` directory. Cannot remember it's location, but I seem to remember that this is the local storage location for your DNS. you could possibly edit there. I am fairly certain name/ip resolution looks there for its values. Like I said, not meant to be a solution, just a string to tug at if you run out of leads. The command is `sudo find / -name *aclocal` not sure if it is a dotfile or not, hence the asterisk.
Nate T avatar
it flag
I guess you could say it is to `resolvconf` what `.bash_history` is to `.bashrc`
heynnema avatar
ru flag
Do you connect via an application, or a CLI command line? Do you have .ovpn scripts?
mangohost

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.