LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


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

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


Hi,

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

--------------/etc/dhcp3/dhclient-enter-hooks---------------
#
# 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"
VPN_IF="tun0"

ifconfig -a | grep -q ${VPN_IF}

if [ $? = 0 ]; then
exit 0
fi
 
  


Reply


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 01:40 AM
Unable to resolve ulr. /et/resolve.conf looks fine? TheBrick Linux - Networking 3 02-14-2008 04:13 AM
Dhclient and resolv.conf kellinjar Linux - Networking 1 10-13-2006 05:23 AM
dhclient.conf specs raypen Linux - Networking 0 05-29-2006 04:39 PM
/etc/hosts, /etc/resolve.conf and /etc/host.conf config probs below_average Linux - Networking 1 12-08-2004 10:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:36 AM.

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