There is any difference between this zone syntax?












1














I'd like to build bind zone files via Ansible. To decide how to structure the jinja2 template I need to know if there is any difference in any of these zone configurations:



1.) good old fashioned way:



$ORIGIN foo.bar.
@ IN SOA dns.foo.bar. hostmaster.foo.bar. (
2018111601
3H
1H
604800
86400)

86400 IN NS ns01.foo.bar.
86400 IN NS ns02.foo.bar.

www IN A 10.0.0.1


-



2.) Do I have to specify $ORIGIN if the zone name is already foo.bar?



from named.conf:



zone "foo.bar" in{
type master;
file "zones/foo.bar";
};


from zones/foo.bar:



@       IN      SOA     dns.foo.bar. hostmaster.foo.bar. (
2018111601
3H
1H
604800
86400)

86400 IN NS ns01.foo.bar.
86400 IN NS ns02.foo.bar.

www IN A 10.0.0.1


-



3.) Split-up apex and use '@' multiple times



$ORIGIN foo.bar.
@ IN SOA dns.foo.bar. hostmaster.foo.bar. (
2018111601
3H
1H
604800
86400)

www IN A 10.0.0.1

@ 86400 IN NS ns01.foo.bar.
@ 86400 IN NS ns02.foo.bar.


-



4.) No use of '@' placeholder



foo.bar.       IN      SOA     dns.foo.bar. hostmaster.foo.bar. (
2018111601
3H
1H
604800
86400)

foo.bar. 86400 IN NS ns01.foo.bar.
foo.bar. 86400 IN NS ns02.foo.bar.

$ORIGIN foo.bar.
www IN A 10.0.0.1


-



I always want this as answer:



$ dig foo.bar ANY +noall +answer
foo.bar. 1784 IN SOA dns.foo.bar. hostmaster.foo.bar. 2018121401 10800 3600 604800 86400
foo.bar. 86384 IN NS ns01.foo.bar.
foo.bar. 86384 IN NS ns02.foo.bar.

$ dig www.foo.bar +short
10.0.0.1


Question:




  • Do all variants results in the same dns answer?










share|improve this question



























    1














    I'd like to build bind zone files via Ansible. To decide how to structure the jinja2 template I need to know if there is any difference in any of these zone configurations:



    1.) good old fashioned way:



    $ORIGIN foo.bar.
    @ IN SOA dns.foo.bar. hostmaster.foo.bar. (
    2018111601
    3H
    1H
    604800
    86400)

    86400 IN NS ns01.foo.bar.
    86400 IN NS ns02.foo.bar.

    www IN A 10.0.0.1


    -



    2.) Do I have to specify $ORIGIN if the zone name is already foo.bar?



    from named.conf:



    zone "foo.bar" in{
    type master;
    file "zones/foo.bar";
    };


    from zones/foo.bar:



    @       IN      SOA     dns.foo.bar. hostmaster.foo.bar. (
    2018111601
    3H
    1H
    604800
    86400)

    86400 IN NS ns01.foo.bar.
    86400 IN NS ns02.foo.bar.

    www IN A 10.0.0.1


    -



    3.) Split-up apex and use '@' multiple times



    $ORIGIN foo.bar.
    @ IN SOA dns.foo.bar. hostmaster.foo.bar. (
    2018111601
    3H
    1H
    604800
    86400)

    www IN A 10.0.0.1

    @ 86400 IN NS ns01.foo.bar.
    @ 86400 IN NS ns02.foo.bar.


    -



    4.) No use of '@' placeholder



    foo.bar.       IN      SOA     dns.foo.bar. hostmaster.foo.bar. (
    2018111601
    3H
    1H
    604800
    86400)

    foo.bar. 86400 IN NS ns01.foo.bar.
    foo.bar. 86400 IN NS ns02.foo.bar.

    $ORIGIN foo.bar.
    www IN A 10.0.0.1


    -



    I always want this as answer:



    $ dig foo.bar ANY +noall +answer
    foo.bar. 1784 IN SOA dns.foo.bar. hostmaster.foo.bar. 2018121401 10800 3600 604800 86400
    foo.bar. 86384 IN NS ns01.foo.bar.
    foo.bar. 86384 IN NS ns02.foo.bar.

    $ dig www.foo.bar +short
    10.0.0.1


    Question:




    • Do all variants results in the same dns answer?










    share|improve this question

























      1












      1








      1







      I'd like to build bind zone files via Ansible. To decide how to structure the jinja2 template I need to know if there is any difference in any of these zone configurations:



      1.) good old fashioned way:



      $ORIGIN foo.bar.
      @ IN SOA dns.foo.bar. hostmaster.foo.bar. (
      2018111601
      3H
      1H
      604800
      86400)

      86400 IN NS ns01.foo.bar.
      86400 IN NS ns02.foo.bar.

      www IN A 10.0.0.1


      -



      2.) Do I have to specify $ORIGIN if the zone name is already foo.bar?



      from named.conf:



      zone "foo.bar" in{
      type master;
      file "zones/foo.bar";
      };


      from zones/foo.bar:



      @       IN      SOA     dns.foo.bar. hostmaster.foo.bar. (
      2018111601
      3H
      1H
      604800
      86400)

      86400 IN NS ns01.foo.bar.
      86400 IN NS ns02.foo.bar.

      www IN A 10.0.0.1


      -



      3.) Split-up apex and use '@' multiple times



      $ORIGIN foo.bar.
      @ IN SOA dns.foo.bar. hostmaster.foo.bar. (
      2018111601
      3H
      1H
      604800
      86400)

      www IN A 10.0.0.1

      @ 86400 IN NS ns01.foo.bar.
      @ 86400 IN NS ns02.foo.bar.


      -



      4.) No use of '@' placeholder



      foo.bar.       IN      SOA     dns.foo.bar. hostmaster.foo.bar. (
      2018111601
      3H
      1H
      604800
      86400)

      foo.bar. 86400 IN NS ns01.foo.bar.
      foo.bar. 86400 IN NS ns02.foo.bar.

      $ORIGIN foo.bar.
      www IN A 10.0.0.1


      -



      I always want this as answer:



      $ dig foo.bar ANY +noall +answer
      foo.bar. 1784 IN SOA dns.foo.bar. hostmaster.foo.bar. 2018121401 10800 3600 604800 86400
      foo.bar. 86384 IN NS ns01.foo.bar.
      foo.bar. 86384 IN NS ns02.foo.bar.

      $ dig www.foo.bar +short
      10.0.0.1


      Question:




      • Do all variants results in the same dns answer?










      share|improve this question













      I'd like to build bind zone files via Ansible. To decide how to structure the jinja2 template I need to know if there is any difference in any of these zone configurations:



      1.) good old fashioned way:



      $ORIGIN foo.bar.
      @ IN SOA dns.foo.bar. hostmaster.foo.bar. (
      2018111601
      3H
      1H
      604800
      86400)

      86400 IN NS ns01.foo.bar.
      86400 IN NS ns02.foo.bar.

      www IN A 10.0.0.1


      -



      2.) Do I have to specify $ORIGIN if the zone name is already foo.bar?



      from named.conf:



      zone "foo.bar" in{
      type master;
      file "zones/foo.bar";
      };


      from zones/foo.bar:



      @       IN      SOA     dns.foo.bar. hostmaster.foo.bar. (
      2018111601
      3H
      1H
      604800
      86400)

      86400 IN NS ns01.foo.bar.
      86400 IN NS ns02.foo.bar.

      www IN A 10.0.0.1


      -



      3.) Split-up apex and use '@' multiple times



      $ORIGIN foo.bar.
      @ IN SOA dns.foo.bar. hostmaster.foo.bar. (
      2018111601
      3H
      1H
      604800
      86400)

      www IN A 10.0.0.1

      @ 86400 IN NS ns01.foo.bar.
      @ 86400 IN NS ns02.foo.bar.


      -



      4.) No use of '@' placeholder



      foo.bar.       IN      SOA     dns.foo.bar. hostmaster.foo.bar. (
      2018111601
      3H
      1H
      604800
      86400)

      foo.bar. 86400 IN NS ns01.foo.bar.
      foo.bar. 86400 IN NS ns02.foo.bar.

      $ORIGIN foo.bar.
      www IN A 10.0.0.1


      -



      I always want this as answer:



      $ dig foo.bar ANY +noall +answer
      foo.bar. 1784 IN SOA dns.foo.bar. hostmaster.foo.bar. 2018121401 10800 3600 604800 86400
      foo.bar. 86384 IN NS ns01.foo.bar.
      foo.bar. 86384 IN NS ns02.foo.bar.

      $ dig www.foo.bar +short
      10.0.0.1


      Question:




      • Do all variants results in the same dns answer?







      dns bind bind9






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 19 '18 at 3:31









      Mario Nette

      112




      112






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Answer: yes, they're all the same. Though note I haven't actually loaded these zones in to a DNS server to confirm; e.g., I may have missed a typo when reading the question. Load them in to a DNS server, allow zone transfers, and then transfer them — you should get the exact same result.



          Details:




          • If you check “Other Zone File Directives” in the BIND9 manual, $ORIGIN defaults to the zone you specify in named.conf. Mainly you'd using $ORIGIN in manually-written files e.g., to make it easier to deal with subdomains ($ORIGIN subdmain.domain.com., then define all your records for the subdomain).


          • Same section tells you that @ is a shortcut for the current origin. So spelling it out is exactly the same thing.



          • When you specify two records for the same name in a row without repeating the name, the second record just implicitly uses the last one's name. To quote RFC 1035 (which calls the name the record's owner):




            The last two forms represent RRs. If an entry for an RR begins with a blank, then the RR is assumed to be owned by the last stated owner. If an RR entry begins with a <domain-name>, then the owner name is reset.




            (BTW: $ORIGIN and @ are in the RFC as well, so they should apply to servers other than BIND that use the same zone file format. I just used the BIND manual to get terminology newer than 1987.)




          These are all convenience features of the "master file" format — they have nothing to do with the DNS wire protocol. They don't even survive loading the file into BIND (if you have bind rewrite the zone file, e.g., due to allowing DNS updates, then you'll find it'll rewrite the file much closer to your #4).






          share|improve this answer























          • Alright, thanks for your answer. :)
            – Mario Nette
            Dec 19 '18 at 5:26











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f489817%2fthere-is-any-difference-between-this-zone-syntax%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Answer: yes, they're all the same. Though note I haven't actually loaded these zones in to a DNS server to confirm; e.g., I may have missed a typo when reading the question. Load them in to a DNS server, allow zone transfers, and then transfer them — you should get the exact same result.



          Details:




          • If you check “Other Zone File Directives” in the BIND9 manual, $ORIGIN defaults to the zone you specify in named.conf. Mainly you'd using $ORIGIN in manually-written files e.g., to make it easier to deal with subdomains ($ORIGIN subdmain.domain.com., then define all your records for the subdomain).


          • Same section tells you that @ is a shortcut for the current origin. So spelling it out is exactly the same thing.



          • When you specify two records for the same name in a row without repeating the name, the second record just implicitly uses the last one's name. To quote RFC 1035 (which calls the name the record's owner):




            The last two forms represent RRs. If an entry for an RR begins with a blank, then the RR is assumed to be owned by the last stated owner. If an RR entry begins with a <domain-name>, then the owner name is reset.




            (BTW: $ORIGIN and @ are in the RFC as well, so they should apply to servers other than BIND that use the same zone file format. I just used the BIND manual to get terminology newer than 1987.)




          These are all convenience features of the "master file" format — they have nothing to do with the DNS wire protocol. They don't even survive loading the file into BIND (if you have bind rewrite the zone file, e.g., due to allowing DNS updates, then you'll find it'll rewrite the file much closer to your #4).






          share|improve this answer























          • Alright, thanks for your answer. :)
            – Mario Nette
            Dec 19 '18 at 5:26
















          1














          Answer: yes, they're all the same. Though note I haven't actually loaded these zones in to a DNS server to confirm; e.g., I may have missed a typo when reading the question. Load them in to a DNS server, allow zone transfers, and then transfer them — you should get the exact same result.



          Details:




          • If you check “Other Zone File Directives” in the BIND9 manual, $ORIGIN defaults to the zone you specify in named.conf. Mainly you'd using $ORIGIN in manually-written files e.g., to make it easier to deal with subdomains ($ORIGIN subdmain.domain.com., then define all your records for the subdomain).


          • Same section tells you that @ is a shortcut for the current origin. So spelling it out is exactly the same thing.



          • When you specify two records for the same name in a row without repeating the name, the second record just implicitly uses the last one's name. To quote RFC 1035 (which calls the name the record's owner):




            The last two forms represent RRs. If an entry for an RR begins with a blank, then the RR is assumed to be owned by the last stated owner. If an RR entry begins with a <domain-name>, then the owner name is reset.




            (BTW: $ORIGIN and @ are in the RFC as well, so they should apply to servers other than BIND that use the same zone file format. I just used the BIND manual to get terminology newer than 1987.)




          These are all convenience features of the "master file" format — they have nothing to do with the DNS wire protocol. They don't even survive loading the file into BIND (if you have bind rewrite the zone file, e.g., due to allowing DNS updates, then you'll find it'll rewrite the file much closer to your #4).






          share|improve this answer























          • Alright, thanks for your answer. :)
            – Mario Nette
            Dec 19 '18 at 5:26














          1












          1








          1






          Answer: yes, they're all the same. Though note I haven't actually loaded these zones in to a DNS server to confirm; e.g., I may have missed a typo when reading the question. Load them in to a DNS server, allow zone transfers, and then transfer them — you should get the exact same result.



          Details:




          • If you check “Other Zone File Directives” in the BIND9 manual, $ORIGIN defaults to the zone you specify in named.conf. Mainly you'd using $ORIGIN in manually-written files e.g., to make it easier to deal with subdomains ($ORIGIN subdmain.domain.com., then define all your records for the subdomain).


          • Same section tells you that @ is a shortcut for the current origin. So spelling it out is exactly the same thing.



          • When you specify two records for the same name in a row without repeating the name, the second record just implicitly uses the last one's name. To quote RFC 1035 (which calls the name the record's owner):




            The last two forms represent RRs. If an entry for an RR begins with a blank, then the RR is assumed to be owned by the last stated owner. If an RR entry begins with a <domain-name>, then the owner name is reset.




            (BTW: $ORIGIN and @ are in the RFC as well, so they should apply to servers other than BIND that use the same zone file format. I just used the BIND manual to get terminology newer than 1987.)




          These are all convenience features of the "master file" format — they have nothing to do with the DNS wire protocol. They don't even survive loading the file into BIND (if you have bind rewrite the zone file, e.g., due to allowing DNS updates, then you'll find it'll rewrite the file much closer to your #4).






          share|improve this answer














          Answer: yes, they're all the same. Though note I haven't actually loaded these zones in to a DNS server to confirm; e.g., I may have missed a typo when reading the question. Load them in to a DNS server, allow zone transfers, and then transfer them — you should get the exact same result.



          Details:




          • If you check “Other Zone File Directives” in the BIND9 manual, $ORIGIN defaults to the zone you specify in named.conf. Mainly you'd using $ORIGIN in manually-written files e.g., to make it easier to deal with subdomains ($ORIGIN subdmain.domain.com., then define all your records for the subdomain).


          • Same section tells you that @ is a shortcut for the current origin. So spelling it out is exactly the same thing.



          • When you specify two records for the same name in a row without repeating the name, the second record just implicitly uses the last one's name. To quote RFC 1035 (which calls the name the record's owner):




            The last two forms represent RRs. If an entry for an RR begins with a blank, then the RR is assumed to be owned by the last stated owner. If an RR entry begins with a <domain-name>, then the owner name is reset.




            (BTW: $ORIGIN and @ are in the RFC as well, so they should apply to servers other than BIND that use the same zone file format. I just used the BIND manual to get terminology newer than 1987.)




          These are all convenience features of the "master file" format — they have nothing to do with the DNS wire protocol. They don't even survive loading the file into BIND (if you have bind rewrite the zone file, e.g., due to allowing DNS updates, then you'll find it'll rewrite the file much closer to your #4).







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 19 '18 at 4:52

























          answered Dec 19 '18 at 4:46









          derobert

          72k8152210




          72k8152210












          • Alright, thanks for your answer. :)
            – Mario Nette
            Dec 19 '18 at 5:26


















          • Alright, thanks for your answer. :)
            – Mario Nette
            Dec 19 '18 at 5:26
















          Alright, thanks for your answer. :)
          – Mario Nette
          Dec 19 '18 at 5:26




          Alright, thanks for your answer. :)
          – Mario Nette
          Dec 19 '18 at 5:26


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f489817%2fthere-is-any-difference-between-this-zone-syntax%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Morgemoulin

          Scott Moir

          Souastre