how to automatically disable unreachable primary DNS?
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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
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.
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.
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)
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.
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.