Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-15-2012, 10:02 AM   #1
LQ Newbie
Registered: Dec 2011
Posts: 1

Rep: Reputation: Disabled
A solution to VPN resolve.conf being overwritted by dhclient in Ubuntu 10.4


If anyone has found a better way to do this, I'd love to hear.

Problem: After switching from DSL to cable internet, my resolve.conf is now periodically overwritted (I'm not sure why this didn't happen with DSL). This causes problems with my VPN connection, as I suddenly can't resolve servers/hosts at work.

Reading through dhclient documentation I found the "hooks" scripts, which can either be placed in a directory, or a single "dhcp-enter-hooks" file in /etc/dhcp3. This file is sourced by /sbin/dhclient-script prior to actually doing anything, and since it's sourced, an "exit" will stop the script.

My solution is pretty simple. The VPN creates an interface called "tun0" on my system, so my script checks for that interface and exits if found. I'll post the script below.

I tested it both with and without VPN connected, and it seems to work well.

Rob Greenbank
Adaptive Computing

# Exit the dcclient script if VPN is up. On this system, the VPN
# is "tun0", so exit if an error is NOT returned on "ifconfig tun0"

ifconfig -a | grep -q ${VPN_IF}

if [ $? = 0 ]; then
exit 0


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: StrongVPN on Ubuntu: Simple VPN Solution That Works LXer Syndicated Linux News 0 03-10-2010 02:40 AM
Unable to resolve ulr. /et/resolve.conf looks fine? TheBrick Linux - Networking 3 02-14-2008 05:13 AM
Dhclient and resolv.conf kellinjar Linux - Networking 1 10-13-2006 06:23 AM
dhclient.conf specs raypen Linux - Networking 0 05-29-2006 05:39 PM
/etc/hosts, /etc/resolve.conf and /etc/host.conf config probs below_average Linux - Networking 1 12-08-2004 11:07 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:37 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration