VPN disconnected: resolv.conf not refreshed
Posted
by
cwall
on Ask Ubuntu
See other posts from Ask Ubuntu
or by cwall
Published on 2012-06-03T19:29:20Z
Indexed on
2012/06/07
10:48 UTC
Read the original article
Hit count: 301
networking
|vpn
I connect to VPN using vpnc. When VPN disconnects, either via time out or the session limit is reached, VPN is terminated, but resolve.conf continues to contain references to my VPN network.
resolv.conf before VPN is connected:
nameserver 127.0.0.1
search mylocalnetwork
resolv.conf after VPN is connected and remains once VPN is lost:
nameserver X.X.X.X
nameserver X.X.X.Z
nameserver 127.0.0.1
search internal.mycompany.com mylocalnetwork
In 10.04, when VPN lost, I'd run this script to refresh resolve.conf:
7$ cat bin/refreshResolvconf.sh
#!/bin/bash
#if [ -e /etc/resolvconf/run/interface/tun0 -a "`pidof vpnc`" == "" ]; then /sbin/resolvconf -d tun0; fi
if [ -e /etc/resolvconf/run/interface/tun0 -a "`pidof vpnc`" == "" ]
then
/sbin/resolvconf -d tun0;
echo "Refreshed resolv.conf"
fi
But, resolveconf changed in 12.04 changed, so this script is no longer applicable.
To resolve, I manually edit resolve.conf or turn off/on my connection via "gnome-control-center network".
Anyone else have the same problem? How can resolv.conf be updated post-VPN disconnect?
© Ask Ubuntu or respective owner