email and dns

I am back again trying to solve an email/dns problem.  I run a mail server on my small lan ,and have a quasi-permanent connection to the internet.  This means that although my isp is supposed to be providing 24/7 uptime, their service has these strange 60-90 second blackouts every 15-20 minutes they cannot solve.

This affects me because when someone tries to check their email at the same time one of the blackouts are occuring, it causes the response to be really slow.  jlevie pointed out a way to cure the other problem I was having by suggesting I correctly maintain an /etc/hosts file.  But with the blackouts, my pop server has a delay because I think that it is trying to do a reverse lookup of itself.  Here is a sample tcpdump output. is the machine running qmail. is my machine checking for email. is my isp's dns server.

20:14:41.731133 eth0 < > . 1:1(0) ack 1 win 17520 (DF)
20:14:41.732146 eth0 > > 61116+ PTR? (42)
20:14:41.748817 eth0 < > 61116 NXDomain 0/1/0 (104)

So my basic question is what entry, if any, can I place in my /etc/hosts file that will prevent the reverse lookup? (or give the correct response?) I have tried various combinations to little avail.  I would rather not set up a dns server on my lan.  I have only 12 nodes and the changes here are very infrequent at best.

Who is Participating?
jlevieConnect With a Mentor Commented:
Okay, so the hostname search order is correct. So either something isn't quite right with the hosts file or there's something in the POP daemon that insists on using DNS. Your hosts file should look like:     localhost.localdomain localhost     host1.domain.tld host1     host2.domain.tld host2

replacing "domain.tld" with your domain name. The hostname that the email server is set to needs to point to one of those entries in the hosts file.

If you still have problems during the outages with the hosts file set up correctly, then the only recourse that I know of will be to set up a local DNS. That's not at all difficult for a small LAN and you would gain a small reduction in link traffic since the local DNS will cache answers. If you don't know how to set up a local DNS I'd be willing to build the configuration for you.
Check /etc/nsswitch.conf and make sure that files occurs before dns. It should look like:

hosts:      files nisplus nis dns

The important bits are that files is listed before dns. It doesn't matter about nisplus or nis in this case.

Have you considered that the "blackouts" might be a local problem rather than at your ISP? Is the Linux box the Internet gateway or does something else do that (if so what?)? If it is the gateway what version of Linux is it running and what kind of Internet link do you have (cable modem, SDSL, dialup, T1, etc)?
mattbriceAuthor Commented:
The file /etc/nsswitch already has files ahead of dns.  Any other ideas with respect to /etc/hosts or other files?  What should  my hosts file look like given the information in my original comment?

As far as the blackouts are concerned, they are caused by my isp's system.  I don't use dsl, cable, or dial-up. Because of my location, the only service that I could get (other than a basic dial-up account) was their microwave wireless system. (Which is also very inexpensive) When it works, it is very quick. They have a lot of their wireless customers complaining about the same thing and are aware of the problem.  They just don't know of a solution.

Thanks for the help,

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 If you not be sure about the name resolves, do like:

1, run "linuxconf" by root, and find out the domain name server config, and make a right turn between the hosts and systemdns.

2, edit your /etc/hosts file, add a line like:
    ~~~~~~~~~~~~~ is Your email server's IP.

3, check whether the system worked well:
   first, "ping" the domain name about your email server, If the IP address been given is correct, it's OK. Second, run "nslookup" and fill your email server's domain name "" after the prompt ">", get the result, if it also worked, That's OK.

Good Luck :)
mattbriceAuthor Commented:
I have tried the adding the ip of the email server, but it does not seem to make a difference.  I am running qmail + vpopmail.  I do not have the time right this moment to install the dns, but I will be thinking about it.  I have read that djbdns is a good choice, and also authored by the same man who wrote qmail.  

I really appreciate the comments so far.

mattbriceAuthor Commented:
Thanks for all the help.  I decided to follow your advise and set up a local DNS server.  It turned out to be a fairly simple task.  I used djbdns and although I don't have a the features working, it has made checking email lightning fast without sacrificing browsing speed.  

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.

All Courses

From novice to tech pro — start learning today.