#StackBounty: #networking #dns #openvpn How to remove nameservers from resolv.conf after vpn disconnect?

Bounty: 50

I have this resolv.conf even after disconnecting from VPN server (connection was established using openvpn --config <path>.ovpn):

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers
nameserver 10.4.X.X
nameserver 10.4.Y.Y
nameserver 127.0.0.53
search Z.ac.in

I want to get rid of search Z.ac.in and the 10.4 ns. However, I can’t find them in /etc/resolvconf/resolv.conf.d/{head,base,tail}. I even did grep 10.4.X.X inside the /etc/resolvconf directory with no result. Similarly, my /etc/network/interfaces file is mostly empty:

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

For now I have just been restarting my pc to remove them. But how to remove them properly from the resolv.conf file?


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.