====== Ubuntu - VPN - ExpressVPN - Revert to internal DNS upon ExressVPN disconnect ======
ExpressVPN has a bug in that it does not revert the /etc/resolv.conf DNS settings back to the internal one when the VPN is disonnected.
* This results in internet queries still trying to use the ExpressVPN DNS, which is cannot access due to the VPN being off.
----
===== Disconnect from ExpressVPN =====
expressvpn disconnect
----
===== Check which DNS server is being used =====
systemd-resolve --status
returns:
Global
LLMNR setting: no
MulticastDNS setting: no
DNSOverTLS setting: no
DNSSEC setting: no
DNSSEC supported: no
Current DNS Server: 10.100.0.1
DNS Servers: 10.100.0.1
DNS Domain: expressvpn
**NOTE:** The **Current DNS Server** line should be pointing to the internal DNS, but here it shows this still points to the ExpressVPN DNS even though the VPN is disconnected.
----
===== Fix this issue =====
==== Check the status of the systemd-resolv service ====
sudo systemctl status systemd-resolved.service
returns:
● systemd-resolved.service - Network Name Resolution
Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2022-03-17 19:28:19 GMT; 4 days ago
Docs: man:systemd-resolved.service(8)
https://www.freedesktop.org/wiki/Software/systemd/resolved
https://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers
https://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients
Main PID: 1160 (systemd-resolve)
Status: "Processing requests..."
Tasks: 1 (limit: 77016)
Memory: 7.6M
CGroup: /system.slice/systemd-resolved.service
└─1160 /lib/systemd/systemd-resolved
Mar 17 19:28:19 bigmamba systemd[1]: Starting Network Name Resolution...
Mar 17 19:28:19 bigmamba systemd-resolved[1160]: Positive Trust Anchors:
Mar 17 19:28:19 bigmamba systemd-resolved[1160]: . IN DS 20326 8 2 e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104237c7f8ec8d
Mar 17 19:28:19 bigmamba systemd-resolved[1160]: Negative trust anchors: 10.in-addr.arpa 16.172.in-addr.arpa 17.172.in-addr.arpa 18.172.in-addr.arpa 19.172.in-addr.arpa 20.172.in-addr.arpa 21.172.in-addr.arpa 22.172.in-addr.arpa 23.172.in-addr.arpa 24.172.in-addr.arpa 25.172.in-addr.arpa 26.172.in-addr.arpa 27.172.in-addr.arpa 28.172.in-addr.arpa 29.172.in-addr.arpa 30.172.in->
Mar 17 19:28:19 bigmamba systemd-resolved[1160]: Using system hostname 'bigmamba'.
Mar 17 19:28:19 bigmamba systemd[1]: Started Network Name Resolution.
Mar 17 19:30:37 bigmamba systemd-resolved[1160]: Flushed all caches.
Mar 20 10:47:01 bigmamba systemd-resolved[1160]: Flushed all caches.
**NOTE:** This shows the service is running. Good.
----
==== Restart the systemd-resolv service ====
sudo systemctl restart systemd-resolved.service
----
===== Check again which DNS server is being used =====
systemd-resolve --status