5

I just finished setting up PowerDNS to avoid having to remember all my IP addresses and it seems to work pretty fine, most host names resolve just fine but not the one running PowerDNS (named musicbox, IP 192.168.1.22). When I try to ping it from any other computer I only get an error message about unknown host. Using dig I get the correct IP address. Running ping musicbox.local also works fine but not ping musicbox.

#dig musicbox.local

; <<>> DiG 9.9.5-3-Ubuntu <<>> musicbox.local
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 45271
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

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

;; ANSWER SECTION:
musicbox.local.         3600    IN      A       192.168.1.22

;; Query time: 5 msec
;; SERVER: 192.168.1.22#53(192.168.1.22)
;; WHEN: Sun Dec 07 19:54:23 CET 2014
;; MSG SIZE  rcvd: 48

This is my bindbackend.conf:

  one "local" {
  type master;
  file "/etc/powerdns/bind/local.zone";
  allow-update { none; };
  };

This is my zone file, local.zone:

$ORIGIN local     ; base for unqualified names
$TTL 1h                 ; default time-to-live
@                       IN      SOA ns.local hostmaster.local (
                                1; serial
                                1d; refresh
                                2h; retry
                                4w; expire
                                1h; minimum time-to-live
                        )
                        IN      NS      ns
                        IN      A       192.168.1.22
musicbox                IN      CNAME   ns
haddock                 IN      A       192.168.1.29
tintin                  IN      A       192.168.1.68
snowy                   IN      A       192.168.1.99
castafiore              IN      A       192.168.1.73

All host names but musicbox resolve just fine. How do I fix that annoying last piece of my puzzle?

Zarkov
  • 61
  • 4

1 Answers1

0

musicbox is an alias to ns:

musicbox                IN      CNAME   ns

However, there is no A entry for ns, therefore musicbox does not resolve. All other host names have A entries, therefore they are resolved just fine.

You can either add an A entry for ns...

ns          IN    A    [ns' IP]

... or an A entry for musicbox directly:

musicbox    IN    A    [musicbox's IP]

From what I can tell from your file, I'm assuming your ns host is 192.168.1.22 (referred to as @, local, in your zone file). While you do define your host's IP, there is no assocation made between your host (@, local) and ns. I would recommend the following changes:

$ORIGIN local
$TTL 1h
@                       IN      SOA ns.local. hostmaster.local. (
                                1; serial
                                1d; refresh
                                2h; retry
                                4w; expire
                                1h; minimum time-to-live
                        )

                        IN      NS      ns

                        IN      A       192.168.1.22
ns                      IN      A       192.168.1.22

haddock                 IN      A       192.168.1.29
tintin                  IN      A       192.168.1.68
snowy                   IN      A       192.168.1.99
castafiore              IN      A       192.168.1.73
musicbox                IN      CNAME   ns

This file will make the following associations:

  • local. is at 192.168.1.22.
  • ns.local. is at 192.168.1.22.
  • haddock.local. is at 192.168.1.29.
  • tintin.local. is at 192.168.1.68
  • snowy.local. is at 192.168.1.99.
  • castafiore.local. is at 192.168.1.73.
  • musicbox.local. is at 192.168.1.22 (alias of ns.local.).

(don't forget the terminating .s whenever you're using full domains such as ns.local.)

John WH Smith
  • 15,880
  • Thanks John, but unfortunately it makes no difference. I still can't reach musicbox without appending .local. Funny thing is that local turns out to be a valid host name, directing to 192.168.1.22 if I use my Linux server but not when using my Windows machine. – Zarkov Dec 08 '14 at 18:00
  • One should not mix cnames with any other type of resource record set, so one part of this answer is either incomplete (remove the cname) or wrong. – JdeBP Oct 23 '20 at 11:16
  • And the right answer is of course not to treat local. as if one owned it. There are at least two other claimants, one of which is no doubt interfering here. – JdeBP Oct 23 '20 at 11:20