LinuxQuestions.org
Visit Jeremy's Blog.
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 10-08-2003, 04:59 PM   #1
Eabin
LQ Newbie
 
Registered: Oct 2003
Posts: 5

Rep: Reputation: 0
how to automatically disable unreachable primary DNS?


hi all!

I get my network-information via DHCP. The problem is, my provider's DHCP server sends a primary DNS that is down. The secondary works well. So if i swap the two entries in /etc/resolv.conf, everything is fine. but after next reboot, order is wrong again.

Windows XP just ignores the broken DNS, and uses the secondary all the time, but all linux apps insist on connecting to first DNS first, and i get a 5 to 30 seconds delay in connections to any server Is it possible to tell linux networking that is should disable the broken DNS entry somehow? i mean, isn't this the purpose of a secondary DNS?

thanks in advance,
-erwin
 
Old 10-08-2003, 10:33 PM   #2
mlp68
Member
 
Registered: Jun 2002
Location: NY
Distribution: Gentoo,RH
Posts: 333

Rep: Reputation: 40
I had the same problem once. I'm sure there's a more solid solution, but this crude thing worked for me:

usually there's a hook for a program or script
/sbin/ifup-local to be run at the end of the interface configuration (look at the end of
/etc/sysconfig/network-scripts/ifup-post -- if such an executable exists, it's being run. ).

Ok. Put the following script as /sbin/ifup-local, make it executable.

Quote:
#! /bin/sh
# mlp -- remove the first stale DNS entry from /etc/resolv.conf

[ "$1" != "eth0" ] && exit 0

TEMPFILE=`mktemp -q /tmp/$$.XXXXXX`

for ns in `/bin/cat /etc/resolv.conf | /bin/grep nameserver | /usr/bin/awk '{print $2}' ` ; do


if ! /bin/ping -q -n -c 1 $ns >/dev/null 2>&1 ; then

/bin/grep -v $ns /etc/resolv.conf > $TEMPFILE
/bin/cat $TEMPFILE > /etc/resolv.conf
/bin/rm -f $TEMPFILE
exit 0

fi

done
Ok, it cannot handle 2 stale out of 3 name servers, assumes that there's only one stale one, but probably it's good enough.

It also assumes that you can actually ping the nameserver.

Hope it helps,
mlp
 
Old 10-09-2003, 01:38 AM   #3
gamu829
Member
 
Registered: Sep 2002
Location: Portland, OR, US
Distribution: Fedora 2
Posts: 47

Rep: Reputation: 15
Another possible solution is to send your ISP an email every hour or so telling them their DHCP server(s) are giving out dead DNS servers. Tell them this is unacceptable and that if they can't fix it, that you can find another ISP.

Greg
 
Old 10-09-2003, 05:48 AM   #4
Looking_Lost
Senior Member
 
Registered: Apr 2003
Location: Eire
Distribution: Slackware 12.0, OpenSuse 10.3
Posts: 1,120

Rep: Reputation: 45
If your using dhcpcd you can add the -R option to it and it won't modify your resolv.conf everytime it's used, it'll leave the entries the way you have them.

Then shout at your ISP
 
Old 10-09-2003, 08:53 AM   #5
Eabin
LQ Newbie
 
Registered: Oct 2003
Posts: 5

Original Poster
Rep: Reputation: 0
thanks for you suggestions, they will do the job. (except threatening my ISP, because where i live there's no alternative broadband ISP )

but i'm still wondering if there is a "clean" solution to the problem, so it works as flawlessly as windows (i always thought linux is far superior when it comes to networking)
 
Old 10-09-2003, 09:29 AM   #6
rufius
Member
 
Registered: Oct 2002
Location: Miami, FL
Distribution: Ubuntu
Posts: 184

Rep: Reputation: 30
Linux is superior, but it requires a bit more hands on than Windows, Windows is made for the dummy user that needs the computer to do it for them, so therefore problems with DNS are done in the background. Linux though takes everything very... "literally" so to speak therefore it is superior, but the basis of its superiority is the control you can have over the OS because you're fixing the aforementioned problems yourself rather than relying on automation to do it for you.
 
Old 10-09-2003, 05:48 PM   #7
Eabin
LQ Newbie
 
Registered: Oct 2003
Posts: 5

Original Poster
Rep: Reputation: 0
i don't mean to start a flamewar or something, but the best thing(TM) would seem to have all the control you have now - if you want to. but still the system shouldn't get painfully slow if something happens, that is to be forseen - because there is actually a reason for a second DNS, and this is not slowing down ping times
 
  


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
primary - secondary DNS jsheffie Solaris / OpenSolaris 2 08-01-2005 06:55 AM
not possible multiple primary dns server? blackzone Linux - Networking 1 01-19-2005 12:11 AM
Do I leave primary and seconday DNS blank for a DNS Server? imsam Linux - Networking 3 10-25-2004 01:48 PM
primary DNS and DDNS linuxJaver Slackware 0 10-06-2003 11:31 PM
Primary and Secondary DNS dilberim82 Linux - Networking 3 07-13-2001 10:50 AM

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

All times are GMT -5. The time now is 09:27 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