1

I have a flimsy grasp of DNS. Nonetheless, in order to install a local development copy of Wordpress MU, I needed to create a fake domain, which I called local.dev. It and all subdomains simply resolve to 127.0.0.1. Apache then directs to the correct folder.

I installed PowerDNS, and got it working properly with a MySQL backend. I didn't feel comfortable, but since it worked, I didn't ask any more questions. The bizarre thing is it requires an internet connection to resolve correctly, and now I need to use it offline.

If I am offline, Chrome provies the error:

Error 105 (net::ERR_NAME_NOT_RESOLVED): The server could not be found.

/etc/hosts

127.0.0.1 localhost

/etc/resolv.conf

nameserver 127.0.0.1
nameserver 8.8.8.8
nameserver 8.8.8.4

When I dig, I get the same thing, on or offline:

dig local.dev

; <<>> DiG 9.6.1-P2 <<>> local.dev
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10635
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;local.dev.         IN  A

;; ANSWER SECTION:
local.dev.      120 IN  A   127.0.0.1

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Thu Apr 22 15:32:51 2010
;; MSG SIZE  rcvd: 43

nslookup doesn't find local.dev in either case

nslookup local.dev
;; Got recursion not available from 127.0.0.1, trying next server
;; Got recursion not available from 127.0.0.1, trying next server
Server:     8.8.8.8
Address:    8.8.8.8#53

** server can't find local.dev: NXDOMAIN

PowerDNS config (comments removed):

allow-recursion=127.0.0.1
allow-recursion-override=on

If you need more information, I am happy to provide it.

Fletcher Moore
  • 123
  • 1
  • 7

3 Answers3

1

Forget PowerDNS. Just add the necessary entries to your hosts file. Something like this:

127.0.0.1 local.dev

If you have a small-ish number of subdomains, this is much more simple than trying to maintain a DNS service.

EEAA
  • 108,414
  • 18
  • 172
  • 242
0

It sounds like you either need an local hosts entry for your DNS server, or your PowerDNS is set to resolve addresses externally before checking its internal database.

kmarsh
  • 3,103
  • 15
  • 22
  • This sounds promising. I don't understand what you mean by the first possibility, and I do not know how to check the later. Any more advice would be very helpful. – Fletcher Moore Apr 22 '10 at 11:35
  • I can't tell you much on how to do anything until you tell me what operating systems you are running. On Linux/Unix the local hosts entries are usually in /etc/hosts. I don't run PowerDNS but it seems a mighty large hammer for a very small nail. – kmarsh Apr 22 '10 at 13:30
  • 1
    I'm using Ubuntu 9.10. My hosts file only has 127.0.0.1\tlocalhost. My /etc/resolv.conf nameserver 127.0.0.1\nnameserver 8.8.8.8\nnameserver 8.8.8.4 My understanding is should I type local.dev in the browser, first the hosts file is checked, nothing is found, then the nameservers are used in resolv.conf in order. Since mine is first, I assumed the internet would never be consulted. However, it completely failes to resolve without the internet, which makes little sense to me. PowerDNS probably is overkill. – Fletcher Moore Apr 22 '10 at 17:57
  • Is powerDns running on the system with 127.0.0.1 in /etc/hosts, is that where you are running Chrome, and is PowerDNS OK with serving 127.0.0.1 or is it restricted to your netmask? Most applications follow /etc/nsswitch.conf for order of checking. (nslookup does not) Either "files" or "dns" (or ldap, nis, etc) could be first. – kmarsh Apr 22 '10 at 18:20
  • BTW local.dev won't necessarily resolve to the localhost entry in /etc/hosts. – kmarsh Apr 22 '10 at 18:21
  • PowerDNS, Apache, MySQL, Chrome and everything are running on the same computer. My nsswitch.conf line looks like this hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4. – Fletcher Moore Apr 22 '10 at 19:23
  • I've added some more at the bottom. – Fletcher Moore Apr 22 '10 at 19:34
  • OK, PowerDNS is not doing what it should. So, now you need PowerDNS support from somebody that knows that package (I don't), or install a simpler package that is more familiar to users here, like dnsmasq. – kmarsh Apr 23 '10 at 15:15
0

I just noticed this happening for we as well. I have host entries for several projects (~30) on which I am working. E.G.:

127.0.0.1 localhost.example.com
127.0.0.1 localhost.mydomain.com
127.0.0.1 localhost.some-other-project.net

...and so on.

When I am not connected to a network I cannot resolve these names in Google Chrome. Works fine in Firefox and Lynx. I can ping localhost.example.com just fine. It seems that it is Google Chrome's HostResolver that is refusing to use the hosts file.

I am using Gogole Chrome 5.0.357.53 on Ubuntu 10.04. (But a quick Google search suggests that this is happening in Windows as well)

Follow these steps to reproduce (required webserver running on localhost and responding to "localhost.example.com"):

  • Add hosts file entry for: 127.0.0.1 localhost.example.com
  • Disconnect form network (unplug newtork cables, turn off wireless
    radio, etc)
  • Open Google Chrome
  • Go to: chrome://net-internals/hostresolver.trace
  • Click "Enable tracing"
  • Open new tab to localhost.example.com to see this error:

--

Error 105 (net::ERR_NAME_NOT_RESOLVED): The server could not be found.
  • Reload chrome://net-internals/hostresolver.trace tab. Shows:

--

t=2085005:  "Received request r608 for {hostname='localhost.example.com', port=80, priority=1, speculative=1, address_family=0, allow_cached=1, referrer=''}"
t=2085005:  "Created job j325 for {hostname='localhost.example.com', address_family=1}"
t=2085005:  "Attached request r608 to job j325"
t=2085005:  "Starting job j325"
t=2085005:  "[resolver thread] Running job j325"
t=2085006:  "[resolver thread] Completed job j325"
t=2085006:  "Completing job j325 (took 0 milliseconds)"
t=2085006:  "Finished request r608 with error=-105"
t=2085207:  "Received request r609 for {hostname='clients1.google.com', port=80, priority=3, speculative=0, address_family=0, allow_cached=1, referrer=''}"
t=2085207:  "Created job j326 for {hostname='clients1.google.com', address_family=1}"
t=2085207:  "Attached request r609 to job j326"
t=2085207:  "Starting job j326"
t=2085207:  "[resolver thread] Running job j326"
t=2085207:  "[resolver thread] Completed job j326"
t=2085207:  "Completing job j326 (took 0 milliseconds)"
t=2085207:  "Finished request r609 with error=-105"
t=2085869:  "Received request r610 for {hostname='localhost.example.com', port=80, priority=0, speculative=0, address_family=0, allow_cached=1, referrer=''}"
t=2085869:  "Finished request r610 with error=-105"
t=2085889:  "Received request r611 for {hostname='linkhelp.clients.google.com', port=80, priority=2, speculative=0, address_family=0, allow_cached=1, referrer=''}"
t=2085889:  "Created job j327 for {hostname='linkhelp.clients.google.com', address_family=1}"
t=2085889:  "Attached request r611 to job j327"
t=2085889:  "Starting job j327"
t=2085889:  "[resolver thread] Running job j327"
t=2085889:  "[resolver thread] Completed job j327"
t=2085889:  "Completing job j327 (took 0 milliseconds)"
t=2085889:  "Finished request r611 with error=-105