1

I have been tasked by my instructor to setup a DNS server. But I don't really know if I'm doing it the right way. I am unable to resolve/ping/nslookup the name server. Syslog sais the ns1 is lame. :(

I am using four Ubuntu clients with VirtualBox, one of them configured to be the DNS server. I've set up an bridged virtual network and all hosts are able to ping eachother. I use these IP addresses inside the DNS configuration. Everything seems to be alright but I cannot reach the ns1.example.com even though it's supposed to be the main DNS.

The task: Setup DNS server with a domain and a subdomain. Main domain: SOA, NS for both domain and subdomain, glue record and A record for the subdomain. Subdomain: SOA, NS, glue and A records. Should also have mail and www records.

Please tell me my errors here. I'm constantly reading new stuff and changing the configuration but I can never get to the point where nslookup works for all the addresses, unless I remove the subdomain and add sub.domain.com as a simple A record, but that wont cut it. :P

named.conf.local

zone "domain.com"
{
        type master;
        file "/etc/bind/zones/domain.com.db";
};

zone "sub.domain.com"
{
        type master;
        file "/etc/bind/zones/sub.domain.com.db";
};

zone "0.168.192.in-addr.arpa"
{
        type master;
        file "/etc/bind/zones/0.168.192.in-addr.arpa";
};

domain.com.db

$TTL 3D; TTL default, 3 dagar

domain.com.  IN      SOA     ns1.domain.com. admin.domain.com. (
2012122104; Serialnumber
28800;
3600;
604800;
38400
)

; Maindomain name servers
domain.com.                   IN      NS      ns1.domain.com.
sub.domain.com.               IN      NS      ns2.sub.domain.com.
; Main domain A records
ns1.domain.com.               IN      A       192.168.1.92
ns2.sub.domain.com.           IN      A       192.168.1.84

sub.domain.com.db

$TTL 3D

$ORIGIN sub.domain.com.

@  IN      SOA     ns2.sub.domain.com. admin.sub.domain.com. (
2012122104; Serialnumber
28800;
3600;
604800;
38400
)

; Sub-domain
                IN      NS      ns2.sub.domain.com.
domain.com.     IN      NS      ns1.domain.com.

; Mailserver for subdomain
                IN      MX 10   mail.sub.domain.com.

; A records for subdomain
ns2             IN      A       192.168.1.84
ns1.domain.com. IN      A       192.168.1.92

; Glue records for subdomain
mail            IN      A       192.168.1.89
www             IN      A       192.168.1.72

; Canonical names for subdomain
stuff        IN      CNAME   www

in-addr.arpa

$TTL 3D
@ IN SOA ns1.domain.com. admin.domain.com. (
2012122103;
28800;
604800;
604800;
86400
);

        IN  NS  ns1.domain.com.
        IN  NS  ns2.sub.domain.com.
92      IN  PTR ns1.domain.com.
92      IN  PTR ns2.sub.domain.com.
74      IN  PTR www.sub.domain.com.
89      IN  PTR mail.sub.domain.com.

Happy Holidays! ;>

Edit: I have comined it into one file, using ORIGIN$ and I can reach the ns1, but none of the subs...

  • Thanks, slm! I'm using bridged settings on all hosts on VirtualBox. I can ping everybody on the network, I need to change the resolv.conf settings on every boot though, so the settings is not optimal. But I don't think thats the problem here. I'm pretty sure it's the multiple NS that is cause me pain, since it worked fine with just one. :/ – Andreas Bizzozero Dec 23 '12 at 01:50
  • I'm supposed to create a NS record for the domain and the subdomain, so perhaps only one NS is enought! When you do the $ORIGIN for your subdomains, do you specify the TLD or the sub domain itself? I saw an example where the subdomain where located in the main domain zonefile, the TLD had a $ORIGIN domain.com and the subdomain section started with $ORIGIN sub.domain.com, therefor I tried it and made just one zonefile. But the problem I got then was that the sub.domain.com where not loaded since it was not the top level domain? I have no idea how to fix that. – Andreas Bizzozero Dec 23 '12 at 03:14
  • This is the link the author is referring to, I deleted the comment that had it. http://docstore.mik.ua/orelly/networking_2ndEd/dns/ch09_04.htm – slm Dec 23 '12 at 04:01
  • I am voting to close this question because ServerFault does not allow homework questions to be asked. This site is for professionals with problems that exist in professional environments. No schools labs or home networks allowed. – Wesley Dec 23 '12 at 05:59
  • Aight, well I think I can manage. I was directed here from another overflow site. Thanks SLM for all the help! – Andreas Bizzozero Dec 23 '12 at 10:48

1 Answers1

0

I maintain a single name server but have several sub-domains so I use the $ORIGIN trick mentioned in the O'Reilly DNS & Bind book referenced here.

/var/named/chroot/var/named/data/db.192.168.1

$ORIGIN .
$TTL 604800 ; 1 week
1.168.192.in-addr.arpa      IN SOA  ns.me.local. hostmaster.me.local. (
                            2000075001 ; serial
                            28800      ; refresh (8 hours)
                            7200       ; retry (2 hours)
                            604800     ; expire (1 week)
                            86400      ; minimum (1 day)
                            )
                    NS      ns.me.local.
$ORIGIN 1.168.192.in-addr.arpa.
1                   PTR     mulder.me.local.
101                 PTR     flanders.me.local.
102                 PTR     lisa.me.local.
....
....

/var/named/chroot/var/named/data/db.me.local

$ORIGIN .
$TTL 604800 ; 1 week
me.local            IN SOA  ns.me.local. hostmaster.me.local. (
                            2000075000 ; serial
                            28800      ; refresh (8 hours)
                            7200       ; retry (2 hours)
                            3600000    ; expire (5 weeks 6 days 16 hours)
                            86400      ; minimum (1 day)
                            )
                    NS      ns.me.local.
                    A       192.168.1.1
                    MX      10 mail.me.local.
                    MX      20 me.local.
                    TXT     "v=spf1 mx/24 ~all"
$ORIGIN me.local.
apu                 A       192.168.1.112
                    HINFO   "VZ12" "VZ12"
                    MX      10 mail
                    TXT     "v=spf1 redirect=me.local"
bart                A       192.168.1.103
                    HINFO   "VZ3" "VZ3"
                    MX      10 mail
                    TXT     "v=spf1 redirect=me.local"
...
...
$INCLUDE            "data/subdomain-somedom1.org.sub"
$INCLUDE            "data/subdomain-somedom2.org.sub"

/var/named/chroot/var/named/data/subdomain-somedom1.org.sub

$ORIGIN somedom1.org.me.local.
blogs               CNAME   blogs.me.local.

/var/named/chroot/var/named/data/subdomain-somedom2.org.sub

$ORIGIN somedom2.org.me.local.
bender              CNAME   bender.me.local.
farnsworth          CNAME   farnsworth.me.local.
fry                 CNAME   fry.me.local.
leela               CNAME   leela.me.local.
slm
  • 7,615
  • 16
  • 56
  • 76