Quantcast
Viewing latest article 6
Browse Latest Browse All 10

DNS Domains and Subdomains in one VirtualBox server? [closed]

Image may be NSFW.
Clik here to view.
Question

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. Image may be NSFW.
Clik here to view.
:(

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. Image may be NSFW.
Clik here to view.
: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 dagardomain.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…

Image may be NSFW.
Clik here to view.
Answer

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.
Answered by slm

Viewing latest article 6
Browse Latest Browse All 10

Trending Articles