Score:0

Using custom nameservers

my flag

In Godaddy I have a domain example1.com and www.example1.com with valid A record to my Centos 7 server's IP.

I 've created hostnames for that domain, ns1.example1.com, ns2.example1.com with the same server IP.

I have another doamin example2.com in Godaddy in which I want to use the custom nameservers. So I put in the nameserver field ns1.example1.com and ns2.example1.com.

In my server's named.conf

  zone "example2.com" IN {
     type master;
     file "/etc/named/foo.zone";
     allow-update { none; };
 };

In foo.zone:

 $TTL 600
 @                    3600 SOA   example2.com (
        example2.com.     ; address of responsible party
        2016072701                 ; serial number
        3600                       ; refresh period
        600                        ; retry period
        604800                     ; expire time
        1800                     ) ; minimum ttl
        86400 NS    example2.com.
        14400 A 1.2.3.4
        mail  14400 A     1.2.3.4

I expected then that example2.com and mail.example2.com to resolve to 1.2.3.4.

What am I doing wrong ?

Thanks a lot.

HBruijn avatar
in flag
In many cases mentioning the actual domain name is essential for the community to be able to help diagnose DNS issues. This may be one too. Please refer to [this Q&A](http://meta.serverfault.com/q/963/37681) for our recommendations with regards to how and what (not) to obfuscate in your questions.
Score:2
in flag

Too long for a comment


What am I doing wrong ?

You can validate syntax of zone files with named-checkzone zone-name /path/to/zone.file i.e.

named-checkzone example2.com  /etc/named/foo.zone 

You can validate the syntax for your named.conf configuration file with named-checkconf:

named-checkconf /path/to/named.conf

Note that a valid syntax can still result in logical/functional errors and incorrectly behaving resource records.


@                    3600 SOA   example2.com (  ;<=== MISSING FIELD

In the SOA record a field is missing.

The first field is called the MNAME record. The MNAME record must be a name-server that will respond authoritatively for your domain.

The second field is the RNAME record, the email address of the administrator responsible for this zone. (As usual, the email address is encoded as a name. The part of the email address before the @ becomes the first label of the name; the domain name after the @ becomes the rest of the name. In zone-file format, dots in labels are escaped with backslashes; thus the email address [email protected] would be represented in a zone file as john\.doe.example.com.)


Be careful with zone file shorthand

      86400 NS    example2.com. ; STARTING A LINE WITH A BLANK IS VALID SHORTHAND

@  IN 86400 NS    example2.com. ; This is less likely to misbehave

It might be an artefact of how you formatted your question, but the formatting of zone files has meaning (starting a line with a blank name for example makes the line a continuation of the previous resource record name) and having mail aligned with 14400 is wrong.

      14400 A 1.2.3.4
      mail  14400 A     1.2.3.4  ; this alignment is incorrect
mail  14400 A     1.2.3.4        ; there should be no space/tab before mail
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.