0

This is a school assignment and I'm having trouble with my DNS bind configuration. I'm supposed to setup a DNS server and I need to set SOA, NS and glue record, A records for www, mail and for the name server for the subdomain, and a CNAME.

I'm trying to setup a DNS server for the following domain: mcduckcorp.duckburg.cali.

I have three different db files, mcduckcorp.db, duckburg.db and cali.db. I did a check with the command "named-checkzone" and here is the result:

mcduckcorp.db:

dns_master_load: /etc/bind/mcduckcorp.db:1: extra input text
dns_master_load: /etc/bind/mcduckcorp.db:16: www.mcduckcorp.duckburg.cali: CNAME and other data
zone mcduckcorp.duckburg.cali/IN: loading from master file /etc/bind/mcduckcorp.db failed: extra input text
zone mcduckcorp.duckburg.cali/IN: not loaded due to errors

duckburg.db:

dns_master_load: /etc/bind/duckburg.db:1: extra input text
zone duckburg.cali/IN: loading from master file /etc/bind/duckburg.db failed: extra input text
zone duckburg.cali/IN: not loaded due to errors

cali.db

dns_master_load: /etc/bind/cali.db:1: extra input text
zone cali/IN: loading from master file /etc/bind/cali.db failed: extra input text
zone cali/IN: not loaded due to errors

And here are the configuration-files:

mcduckcorp.db:

$TTL 30 d
$ORIGIN mcduckcorp.duckburg.cali. 
@ IN SOA ns1.mcduckcorp.duckburg.cali. mail.mcduckcorp.duckburg.cali. (
            2019092700 ;serial
            86400 ;refresh
            7200 ;retry
            3600000 ;expiration
            172800) ;minimum

@ IN NS ns1.mcduckcorp.duckburg.cali.
ns1.mcduckcorp.duckburg.cali.   IN   A   192.168.1.10
mail.mcduckcorp.duckburg.cali.  IN   A   192.168.1.10
www.mcduckcorp.duckburg.cali.   IN   A   192.168.1.10

www   IN   CNAME   squirrel

duckburg.db:

$TTL 30 d
$ORIGIN duckburg.cali.
@ IN SOA ns1.duckburg.cali. mail.duckburg.cali. (
                        2019092700 ;serial
                        86400 ;refresh
                        7200 ;retry
                        3600000 ;expiration
                        172800) ;minimum

@ IN NS ns1.duckburg.cali.
ns1.duckburg.cali.              IN   A   192.168.1.10
mail.mcduckcorp.duckburg.cali.  IN   A   192.168.1.10
www.mcduckcorp.duckburg.cali.   IN   A   192.168.1.10

subdomain   IN   NS   ns1.mcduckcorp.duckburg.cali.
ns1.mcduckcorp.duckburg.cali.   IN   A   192.168.1.10

www   IN   CNAME   squirrel

cali.db:

$TTL 30 d
$ORIGIN cali.
@ IN SOA ns1.cali. mail.cali. (
                        201909700 ;serial
                        86400 ;refresh
                        7200 ;retry
                        3600000 ;expiration
                        172800) ;minimum

@ IN NS ns1.cali.
ns1.cali.                       IN   A   192.168.1.10
mail.mcduckcorp.duckburg.cali.  IN   A   192.168.1.10
www.mcduckcorp.duckburg.cali.   IN   A   192.168.1.10

subdomain   IN   NS   ns1.duckburg.cali.
ns1.duckburg.cali.              IN   A   192.168.1.10

www   IN   CNAME   squirrel

I've obviously made a (or a few) mistakes but I'm not sure what's wrong. Any help would be appreciated!

  • @Christopher I doubt there would be a registrar involved in a school assignment. – Rui F Ribeiro Sep 27 '19 at 13:40
  • there should not be a space between the 30 and the d on the $TTL lines. – cas Sep 27 '19 at 13:50
  • 1
    also, in mcduckcorp.db you first define www.mcduckcorp.duckburg.cali. as an A record with IP address 192.168.1.10. Later you define it as a CNAME pointing to squirrel.mcduckcorp.duckburg.cali.. a CNAME record can not have any other record types - not an A or MX or NS or anything else. A CNAME is an alias pointing to another domain name, and ALL of the info is defined by the record it is an alias for. – cas Sep 27 '19 at 13:54
  • 1
    btw, you should never use a domain you don't own. even in examples. use subdomains of example.org, example.com, example.net - they are guaranteed never to be assigned to anyone and can safely be used for examples, assignments, etc. – cas Sep 27 '19 at 14:02
  • Thanks for the help guys! I'm gonna try your solutions asap! – xypo Sep 27 '19 at 14:25
0

There are a few obvious problems with your zone files:

  1. You should never use domains that don't belong to you, even for examples and assignments. They may not exist now, but they may do in future.

    Use example.org, example.com, example.net for examples and homework assignments etc. These domains are guaranteed never to be allocated to anyone and are safe to use by anyone. The exist for precisely this purpose.

  2. There should not be a space between the 30 and the d on the $TTL lines.

  3. in mcduckcorp.db you first define www.mcduckcorp.duckburg.cali. as an A record with IP address 192.168.1.10.

    Later you define it as a CNAME pointing to squirrel.mcduckcorp.duckburg.cali. This can't work.

    A CNAME defines an alias pointing to another domain name. The record looks like:

    alias-name IN CNAME canonical-name
    

    The alias-name can not have any other data records, not A or MX or NS or anything else - it's just an alias pointing somewhere else (to the canonical-name). In other words, the alias "inherits" all the data of the name it points to, and can not modify it in any way (no additions, deletions, or edits).

Your assignment requires you to show examples of A records and CNAME records. Try making an A record for the domain itself and then making www an alias pointing to it. e.g.

    @   IN A     192.168.1.10
    www IN CNAME @

www would "inherit" all the records associated with @ (the $ORIGIN, the domain itself). That includes the A record, and any NS or MX or TXT and whatever other records might exist.

An NS record is mostly irrelevant here, but an MX record can be useful if, e.g., the mail server for domain.example.com is configured to also handle mail for www.domain.example.com.

Alternatively, you could make an A record for www, and then make squirrel an alias pointing to that. e.g.

    www      IN A     192.168.1.10
    squirrel IN CNAME www

Here, squirrel inherits everything from www, which only has an A record.

  • It seems to work now without any errors! I really appreciate your help! I'm gonna point it out to my teacher about using another domain too :) – xypo Sep 28 '19 at 11:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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