I would like to configure my Ubuntu 18.04.2 (LTS) machine to always use the Google DNSs, no matter what the network. I'm experiencing DNS issues with some VPN connections, e.g. if I connect to a VPN from my home WiFi, no names resolve after that. I've had this problem in the past, and back then setting the nameservers in
/etc/resolv.conf and making it immutable did the trick.
However, with netplan I haven't found any instructions for declaring DNSs globally. I don't want to do it per network, as the use case is exactly that whenever I'm connected to some unknown wifi, I want to be able to use my VPNs.
After ~1 h of googling around, I haven't found anything that would resolve my problem. I can only find instructions for defining the nameservers for a specific wifi adapter, which also requires me to define access-points, which I don't want to do. Any pointers how to proceed?
Edit: I resolved the most pressing issue by setting the DNS servers for my VPN connections from the network-manager VPN settings GUI, but still it would be practical to figure this out, as I don't necessarily want to do this separately for each VPN.