DNS timeout slows down system when Internet Connection is not available.


Every day after work hours, we turn off our ADSL modem.  When this happens, our normally okay Linux servers will respond slowly when we ssh or telnet to them.  Likewise, some daemons, such as ntpd, will not able to sync time even with our internal servers.  It seems to me this problem is caused by Linux still try to query external DNS servers although we are already using internal IP addresses.  

When I remove all DNS settings inside resolve.conf, this problem goes away.  However, we do need working resolve.conf.

What should I do?  Thanks.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi anonp,
You could create a couple of CRON entries to replace the resolv.conf when the ADSL line is switched off and on.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
i found a solution for this problem. dyndns client :)
Make sure the clients have a /etc/hosts file and that the /etc/nsswitch.conf file has a "hosts: files dns" entry.
The hosts file should contain all local IP's & names. The "hosts: files dns" entry makes sure that the hosts file is queried first.
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

/etc/hosts is a reasonable idea, but requires keeping all the hosts in sync.

Alternately, you can setup your own DNS server on the internal network and have all the systems resolve through it rather than going out to the Internet.
Gabriel OrozcoSolution ArchitectCommented:
configure your DSL client (tipically Roaring Penguin) to not modify your /etc/resolv.conf and setup a DNS caché with bind (It comes already configured as dns cache on most distros this days)
anonpAuthor Commented:

Thank you for your answers.

Is there a simpler solution?  I really don't want to setup up bind just to get around this.

In regard to using cron to modify the resolve.conf, I don't want to set that up in every computer.  Same problem applies to chaning the host files.

Other ideas?  Thanks.
You can try to use the "search" directive in resolv.conf. Set it to the local domain.
Gabriel OrozcoSolution ArchitectCommented:
to have bind doing dns cache is generally only matter of do a "service named start" or "chkconfig 345 named on" (I don't remember the exact order)

but no more than that... why be afraid of bind? it's more or less simple to use.
A simpler solution is not to disconnect your Internet connection.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Networking

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.