Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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...

share|improve this question

closed as off topic by mdpc, joeqwerty, Magellan, Wesley, Ward Dec 23 '12 at 8:46

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
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 1: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 3:14
    
Thanks for that link, I will most definently read it! –  Andreas Bizzozero Dec 23 '12 at 3:15
    
This is the link the author is referring to, I deleted the comment that had it. docstore.mik.ua/orelly/networking_2ndEd/dns/ch09_04.htm –  slm Dec 23 '12 at 4: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 5:59

1 Answer 1

up vote 0 down vote accepted

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.
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.