I'm running on Ubuntu 22 Linux. When I try to manually fix my /etc/resolv.conf file using
sudo vi /etc/resolv.conf
# or
sudo cp $HOME/tmp/working-resolv.conf /etc/resolv.conf
The command appears to hang before executing the command, the error message produced is
sudo: unable to resolve host my-hostname: Temporary failure in name resolution
Why is sudo trying to do a DNS name lookup? And how can I configure it to not do that?
Background:
If you are wondering why my DNS name queries are failing, they are failing due to an error condition that happens in my companies VPN scripts that leave my Linux host unable to resolve any hostnames via DNS.
I've tracked the problem down to my /etc/resolv.conf file is pointing to the companies DNS server which is only accessible when I'm connected via the VPN.
This is generally fine except when my VPN stops working and the company tells me I'm forced to reboot in order to get my system to be usable again.
I don't like the idea of having to reboot because it completely disrupts my workflow during the day. So, I'm trying to figure out how to properly reset the VPN when it gets "messed up".