Monday, August 29, 2016

Slow name resolution after vpnc connection times out

I've had this issue with an Ubuntu 14.04 install for a while. After leaving the laptop to suspend with a vpnc connection open, problems would arise. I would come back and log into the pc, but validating th password takes around 10 seconds! Subsequent calls to sudo do the same.

The 10 second timeout is caused by name resolution trying to resolve hostnames via a VPN-only name server. The culprit is vpnc which failed to clean up the name resolution configuration when the VPN connection failed. More details here:

 As suggested in the link above, the cure is to run
sudo /sbin/resolvconf -d tun0

possibly via a cron script to facilitate automatic cleanup.