My LAN setup is quite basic:
- A router connected to the ISP's modem and the internet
- My development pc directly connected to the router
The router provides DHCP but does not run its own DNS server. In fact, there is no DNS server hosted anywhere on my LAN (typical home network setup). The router is configured to send the ISP's DNS servers as part of the DHCP lease information.
I set up a VirtualBox machine on my development PC and installed Debian Squeeze (6.0.4) on it. The VirtualBox network mode is
Bridged Adapter to simulate a standalone server on my LAN. Being a VirtualBox server instead of a physical server is not really important, but I mention it for completeness.
Every time a network operation executes a DNS reverse lookup of a LAN ip prior to executing, the server has long delays. Some examples of slow network operations:
- SSH connection to the server from my dev PC
- Connection to admin port of Glassfish server
netstat -nlis very fast)
Starting MTA: exim4on boot takes a long time to complete
Some of these have workarounds like adding my dev pc's Ip to
/etc/hosts or adding a command-specific option to avoid doing DNS reverse lookups. Obviously, using
/etc/hosts only goes so far because it is at odds with DHCP.
However, I can't help but think that I'm missing something. Do I really need to setup a DNS server somewhere on my LAN? That seems like a huge and useless effort for my needs and I can't believe there isn't another option in a DHCP environment like mine.
I searched the net a lot for this and maybe I don't have the right search terms, but I can't find the solution...
update 1 following BillThor's answer
Using host (dig gives the same results):
# ip of stackoverflow.com $ time host -v 220.127.116.11 Trying "18.104.22.168.in-addr.arpa" ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 15537 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;22.214.171.124.in-addr.arpa. IN PTR ;; ANSWER SECTION: 126.96.36.199.in-addr.arpa. 143 IN PTR stackoverflow.com. Received 74 bytes from 192.168.1.1#53 in 15 ms real 0m0.020s user 0m0.008s sys 0m0.000s # ip of dev pc $ time host -v 192.168.1.50 Trying "188.8.131.52.in-addr.arpa" ;; connection timed out; no servers could be reached real 0m10.004s user 0m0.004s sys 0m0.000s
My /etc/resolv.conf (was automatically created during installation)
Both host and dig return very fast for a public ip but take 10s to timeout for a LAN ip. I guess 10s is my current timeout value.
dev-pc in /etc/hosts file:
$ time getent hosts 192.168.1.50 192.168.1.50 dev-pc real 0m0.001s user 0m0.000s sys 0m0.000s
dev-pc in /etc/hosts file:
$ time getent hosts 192.168.1.50 real 0m10.012s user 0m0.004s sys 0m0.000s
It looks more and more like I'll have to find piecewise program options or parameters for each one trying to do reverse DNS lookups! None of the machines (virtual or not) can act as a DNS server on my LAN since they are not always up. Unfortunately, the router's firmware doesn't include a DNS server.