LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-28-2001, 03:19 PM   #1
Supp0rtLinux
Member
 
Registered: Dec 2001
Location: Carlsbad
Distribution: LFS 4.0 (www.linuxfromscratch.org)
Posts: 44

Rep: Reputation: 15
Angry Resolv.conf issues when switching from eth to ppp


I normally use DHCP on a LAN at work and home. Everything normally works fine when switching, except when I try to switch to a dial up acct via PPP.

Here's the main issue: after a fresh install and set as DHCP client, resolv.conf is filled with the domain, seach, and nameserver info provided by the DHCP server. If I issue an "ifdown eth0" (or ifconfig eth0 down"), resolv.conf is not wiped out, only the search part is gone. The domain and nameserver (3 or them) entries remain. When I connect w/ PPP, the ISP's nameserver entries are appended to the bottom of resolv.conf. Resolv.conf is only designed to handle 3 nameservers, so it never sees the two added by the dialup ISP, and simply times out on anything I hit by name. This is further complicated by the fact that I am behind a f/w with 1 to 1 NAT'ting... so my internal name server is on the 172.16.*.* network and unreachable when dialed up.

So... aside from changing the ifdown script to cat resolv.conf to /dev/null... anyone know how to have resolv.conf purged when shutting down eth0? It would be nice to have an ip release function in the TCP/IP protocol stack... or something more easily scripted. I'm looking for something I can do enterprise-wide w/o major changes...

Last edited by Supp0rtLinux; 12-28-2001 at 03:23 PM.
 
Old 12-28-2001, 04:13 PM   #2
Supp0rtLinux
Member
 
Registered: Dec 2001
Location: Carlsbad
Distribution: LFS 4.0 (www.linuxfromscratch.org)
Posts: 44

Original Poster
Rep: Reputation: 15
Smile

Guess I fixed it myself... though I'm still interested in a "cleaner" fix... and preferably a distribution independent one.

Here's my fix:
/etc/sysconfig/network-scripts/ifdown symlinks to /sbin/ifdown. I simply added these two lines to the end of /sbin/ifdown immediately before the final exit:
cp /etc/resolv.conf /etc/resolv.conf.bak
echo "" > /etc/resolv.conf
Testing showed that then issuing "ifdown eth0" resulted in a blank resolv.conf. Dialing up created two nameserver entries in resolv.conf appended with #kppp entry. Diconnecting left a blank resolv.conf (I guess kppp doesn't suffer the same issue as it properly removes its entries). Issuing "ifup eth0" created a resolv.conf with correct information from the DHCP server.

I am using RH 7.2. I'm not sure if ifdown and ifup are RH-centric or Linux standard, but I do know that the rc kill scripts use ifup and ifdown to start and stop network services, so my change should work across reboots.

Last edited by Supp0rtLinux; 12-28-2001 at 04:15 PM.
 
Old 12-30-2001, 08:05 PM   #3
infinity6
Member
 
Registered: Dec 2001
Posts: 66

Rep: Reputation: 15
The way you fixed it is fine. I have also heard of editing the ifup script and editing the PEERDNS line to read the way you want it. This is probably more of a hassle for you, though, since you already have the configuration you want, and wouldn't want to overwrite it. You can also set all the entries the way you want them in your /etc/resolve and then make the file immutable (I forget the exact command, sorry.) Hope that helps.
 
  


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
resolv.conf dns issues billbob Linux - Software 3 09-30-2005 12:20 PM
resolv.conf stanleytiew Linux - Newbie 2 05-13-2005 04:25 PM
resolv.conf albundy Linux - Software 5 12-14-2004 03:12 PM
resolv.conf?? wrat Linux - Newbie 3 06-14-2004 04:37 PM
resolv.conf ricemark20 Linux - Networking 12 11-11-2003 04:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:56 PM.

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
Open Source Consulting | Domain Registration