• "forward first" set on a master zone not working as expected

    From Taylor Vierrether@21:1/5 to All on Wed Sep 2 11:00:38 2020
    This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
    This is a multi-part message in MIME format. --Apple-Mail=_02FE9945-4A58-4CA7-A3A2-379138347C24
    Content-Transfer-Encoding: quoted-printable
    Content-Type: text/plain; charset=utf-8

    Hello,

    I am attempting to set up an internal DNS server that is authoritative for internal resources, but also will respond for external resources on the same domain that it does not have records for.

    For example, I have a domain sub.example.com <http://sub.example.com/>, and I want to have internal entries in the BIND zone file for host1.sub.example.com <http://host1.sub.example.com/> and host2.sub.example.com <http://host2.sub.example.com/>. That
    part is working fine. However, there is a publicly available DNS entry for sub.example.com <http://sub.example.com/> that I want my internal clients to be able to resolve, but I don’t want to have the IP in the BIND zone file, because the IP is dynamic.
    There are also some hosts (host3.sub.example.com <http://host3.sub.example.com/>) and (host4.sub.example.com <http://host4.sub.example.com/>) that are externally resolvable that I don’t want to put in my internal BIND file because they are not
    controlled by me. (Think CNAME to a SaaS application)

    I’ve attempted to do this as follows, and it seems to make sense that it would work, but it does not.


    named.conf:

    zone “sub.example.com" IN {
    type master;
    file "/etc/bind/sub.example.com.zone";
    forward first;
    forwarders { 1.1.1.1; 1.0.0.1; };
    };

    sub.example.com <http://sub.example.com/>.zone:

    $ORIGIN sub.example.com.
    $ttl 600
    @ 300 SOA dns.sub.example.com. (
    taylor.viertaxa.com. ; address of responsible party
    2020090101 ; serial number
    300 ; refresh period
    300 ; retry period
    604800 ; expire time
    300 ) ; minimum ttl
    300 NS elinore.ns.cloudflare.com.
    300 NS hal.ns.cloudflare.com.
    host1 60 A 10.x.x.x
    host2 60 A 10.x.x.x

    What I would expect to happen, is that BIND sees “forward first” and attempts to look up the hostname host3.sub.example.com <http://host3.sub.example.com/> on the listed forwarders, and succeeds (there’s an entry publicly available for that one.

    What actually happens, is if I query for sub.example.com <http://sub.example.com/> I get the following from nslookup:
    *** Can't find sub.example.com: No answer

    And if I query for host3.example.com <http://host3.example.com/>, I get the following from nslookup:
    ** server can't find host3.sub.example.com: NXDOMAIN


    BIND version:

    Package: bind9
    Version: 1:9.11.5.P4+dfsg-5.1+deb10u2


    Thank you in advance for any help you might be able to provide. --Apple-Mail=_02FE9945-4A58-4CA7-A3A2-379138347C24
    Content-Transfer-Encoding: quoted-printable
    Content-Type: text/html; charset=utf-8

    <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hello,<div class=""><br class=""></div><div class="">I am
    attempting to set up an internal DNS server that is authoritative for internal resources, but also will respond for external resources on the same domain that it does not have records for.</div><div class=""><br class=""></div><div class="">For example,
    I have a domain <a href="http://sub.example.com" class="">sub.example.com</a>, and I want to have internal entries in the BIND zone file for <a href="http://host1.sub.example.com" class="">host1.sub.example.com</a>&nbsp;and <a href="http://host2.sub.
    example.com" class="">host2.sub.example.com</a>. That part is working fine. However, there is a publicly available DNS entry for <a href="http://sub.example.com" class="">sub.example.com</a>&nbsp;that I want my internal clients to be able to resolve, but
    I don’t want to have the IP in the BIND zone file, because the IP is dynamic. There are also some hosts (<a href="http://host3.sub.example.com" class="">host3.sub.example.com</a>) and (<a href="http://host4.sub.example.com" class="">host4.sub.example.
    com</a>) that are externally resolvable that I don’t want to put in my internal BIND file because they are not controlled by me. (Think CNAME to a SaaS application)</div><div class=""><br class=""></div><div class="">I’ve attempted to do this as
    follows, and it seems to make sense that it would work, but it does not.&nbsp;</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">named.conf:</div><div class=""><br class=""></div><div class=""><div class="">zone “<a
    href="http://sub.example.com" class="">sub.example.com</a>" IN {</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; type master;</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; file "/etc/bind/sub.example.com.zone";</div><div class="">&nbsp; &nbsp; &nbsp; &
    nbsp; forward first;</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; forwarders { 1.1.1.1; 1.0.0.1; };</div><div class="">};</div></div><div class=""><br class=""></div><div class=""><a href="http://sub.example.com" class="">sub.example.com</a>.zone:</div>
    <div class=""><br class=""></div><div class=""><div class="">$ORIGIN <a href="http://sub.example.com" class="">sub.example.com</a>.</div><div class="">$ttl 600</div><div class="">@ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &
    nbsp;300 SOA &nbsp; <a href="http://dns.sub.example.com" class="">dns.sub.example.com</a>. (</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://taylor.viertaxa.com"
    class="">taylor.viertaxa.com</a>. &nbsp; &nbsp; &nbsp;; address of responsible party</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2020090101 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp;; serial number</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 300 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; refresh
    period</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 300 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; retry period</div><div class="">&nbsp; &
    nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 604800 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; expire time</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 300 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ) ; minimum ttl</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 300 NS &nbsp;
    &nbsp;<a href="http://elinore.ns.cloudflare.com" class="">elinore.ns.cloudflare.com</a>.</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 300 NS &nbsp; &nbsp;<a href="http://hal.ns.cloudflare.com" class="">
    hal.ns.cloudflare.com</a>.</div><div class="">host1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 60 &nbsp;A &nbsp; &nbsp; 10.x.x.x</div><div class="">host2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 60 &nbsp;A &nbsp;
    &nbsp; 10.x.x.x</div></div><div class=""><br class=""></div><div class="">What I would expect to happen, is that BIND sees “forward first” and attempts to look up the hostname <a href="http://host3.sub.example.com" class="">host3.sub.example.com</a>&
    nbsp;on the listed forwarders, and succeeds (there’s an entry publicly available for that one.&nbsp;</div><div class=""><br class=""></div><div class="">What actually happens, is if I query for <a href="http://sub.example.com" class="">sub.example.com</
    &nbsp;I get the following from nslookup:</div><div class="">*** Can't find <a href="http://sub.example.com" class="">sub.example.com</a>: No answer</div><div class=""><br class=""></div><div class="">And if I query for <a href="http://host3.example.com"
    class="">host3.example.com</a>, I get the following from nslookup:</div><div class="">** server can't find <a href="http://host3.sub.example.com" class="">host3.sub.example.com</a>: NXDOMAIN</div><div class=""><br class=""></div><div class=""><br class="
    "></div><div class="">BIND version:</div><div class=""><br class=""></div><div class=""><div class="">Package: bind9</div><div class="">Version: 1:9.11.5.P4+dfsg-5.1+deb10u2</div></div><div class=""><br class=""></div><div class=""><br class=""></div><
    div class="">Thank you in advance for any help you might be able to provide.&nbsp;</div></body></html>
    --Apple-Mail=_02FE9945-4A58-4CA7-A3A2-379138347C24--
    .

    -----BEGIN PGP SIGNATURE-----
    Version: ProtonMail

    wsFmBAEBCAAQBQJfT7OaCRCBIrlIUuSYEQAKCRCBIrlIUuSYEWGOEACQaGwg 4LqIDoOFrB4ORgUDn8zshkIlBqhbUzY9pjCjipZeb4F4u6kxSvehlrZ1N3w4 qWZ1iXcyQFdKMx+djwsS7cEa885fm1158FQx0CVopPHM1CEH8GYczr7cFW8I I74Q3jFJnohuegfEpUGSeXo0VVKaYv/kj4YHaE2+EelU+jpYHjXXRkaYgaYU 884yip8t0f7cYjl5jCcMrtT7Eib+orbQpF/CdqEJjGgrTAOdg64jL3C+6uhc eg9K3+oQpkaK+WO5rgzOBqgtgbDswn39iYSXqywWKVeWsC3bnlK61F6+g+hW 6fCoymizSd9hapi01cXSj53iiy2rPmSjB3P98eEqB6RxwAOgs3kbbUjeqJPO qIx3AX2d6bIPEA0JG40kNRkPDZvafuZUQuh7NscKkpvF0s9Gtu5zz1z5FNiJ a775jgU8G3n0FlgWFfamX/eCI5lJ8LUFBVnadQ3dRO/6q7jRn9H86g8lUhf4 ayUnP144aQ8ly8MyZiMO+XqZ4SL/THkafKdQCYNCxu/xuujtN5Cpvtn+aRqT k1ojIL8yW/kN4Q1O6/j8VngXkQCu/6vs43cgf0jzEIjslexGTIUw40BGpCd3 f7ELe375h6XxQnYkFny/tT9yhomtOHy7nNgwkTeV574nBqg2nGO0Ru3ineXw cnFU5hu5C2LeHBUd5w==
    =z36U
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Matus UHLAR - fantomas@21:1/5 to Taylor Vierrether via bind-users on Thu Sep 3 09:51:28 2020
    On 02.09.20 15:00, Taylor Vierrether via bind-users wrote:
    I am attempting to set up an internal DNS server that is authoritative for internal resources, but also will respond for external resources on the
    same domain that it does not have records for.

    For example, I have a domain sub.example.com , and I want to have internal entries in the BIND zone file for host1.sub.example.com and host2.sub.example.com. That part is working fine. However, there is a publicly available DNS entry for sub.example.com that I want my internal clients to be able to resolve, but I don’t want to have the IP in the BIND zone file, because the IP is dynamic.

    you can delegate that entry elsewhere.

    There are also some hosts (host3.sub.example.com ) and (host4.sub.example.com) that are externally resolvable that I don’t want
    to put in my internal BIND file because they are not controlled by me.
    (Think CNAME to a SaaS application)

    you can delegate those records somewhere.

    I’ve attempted to do this as follows, and it seems to make sense that it
    would work, but it does not.


    named.conf:

    zone “sub.example.com" IN {
    type master;
    file "/etc/bind/sub.example.com.zone";
    forward first;
    forwarders { 1.1.1.1; 1.0.0.1; };
    };

    forwarding is not used for zone other than "type forward".

    What actually happens, is if I query for sub.example.com I get the following from nslookup:
    *** Can't find sub.example.com: No answer

    if you search for "sub.example.com" record, you can not delegate that one,
    of course.

    you apparently should use redesign your DNS. Easiest way would be using different domain internally.

    And if I query for host3.example.com , I get the following from nslookup:
    ** server can't find host3.sub.example.com: NXDOMAIN

    note that nslookup is very bad program for tracking DNS errors.
    use "host" or "dig" for that case.


    --
    Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
    Warning: I wish NOT to receive e-mail advertising to this address.
    Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
    I just got lost in thought. It was unfamiliar territory.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kevin Darcy@21:1/5 to ML BIND Users on Thu Sep 3 09:00:56 2020
    [ Classification Level: GENERAL BUSINESS ]

    Or, if you absolutely *must* use the same namespace internally and
    externally (oftentimes you can't talk the business out of that), your
    internal version should be a more-or-less a superset of your external
    version.

    How you keep those in sync is up to you. For us, we have a centralized management system that makes the relevant updates in parallel. The big
    caveat with that is, those few situations where the DNS needs to be "schizophrenic", i.e. resolve differently in the internal versus external versions of the zones. We try to keep that nonsense to a minimum, but when
    we can't talk people out of it, we handle it on an exception basis.

    I suppose another approach is to have a backend database which tags each
    record as being "internal", "external" or "both", and then the respective versions of the zones get generated accordingly. You'd need something to
    ensure referential integrity, though, otherwise you might end up with
    dangling references (e.g. CNAME/MX/SRV targets), bad delegations, etc.


    - Kevin

    P.S. No offense to schizophrenics. I guess a more accurate term would be "multiple personality".


    On Thu, Sep 3, 2020 at 3:52 AM Matus UHLAR - fantomas <uhlar@fantomas.sk> wrote:

    On 02.09.20 15:00, Taylor Vierrether via bind-users wrote:
    I am attempting to set up an internal DNS server that is authoritative
    for
    internal resources, but also will respond for external resources on the same domain that it does not have records for.

    For example, I have a domain sub.example.com , and I want to have
    internal
    entries in the BIND zone file for host1.sub.example.com and host2.sub.example.com. That part is working fine. However, there is a publicly available DNS entry for sub.example.com that I want my internal clients to be able to resolve, but I don’t want to have the IP in the
    BIND
    zone file, because the IP is dynamic.

    you can delegate that entry elsewhere.

    There are also some hosts (host3.sub.example.com ) and (host4.sub.example.com) that are externally resolvable that I don’t want to put in my internal BIND file because they are not controlled by me. (Think CNAME to a SaaS application)

    you can delegate those records somewhere.

    I’ve attempted to do this as follows, and it seems to make sense that it
    would work, but it does not.


    named.conf:

    zone “sub.example.com" IN {
    type master;
    file "/etc/bind/sub.example.com.zone";
    forward first;
    forwarders { 1.1.1.1; 1.0.0.1; };
    };

    forwarding is not used for zone other than "type forward".

    What actually happens, is if I query for sub.example.com I get the
    following from nslookup:
    *** Can't find sub.example.com: No answer

    if you search for "sub.example.com" record, you can not delegate that one,
    of course.

    you apparently should use redesign your DNS. Easiest way would be using different domain internally.

    And if I query for host3.example.com , I get the following from nslookup: >** server can't find host3.sub.example.com: NXDOMAIN

    note that nslookup is very bad program for tracking DNS errors.
    use "host" or "dig" for that case.


    --
    Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
    Warning: I wish NOT to receive e-mail advertising to this address.
    Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
    I just got lost in thought. It was unfamiliar territory. _______________________________________________
    Please visit https://lists.isc.org/mailman/listinfo/bind-users to
    unsubscribe from this list

    ISC funds the development of this software with paid support
    subscriptions. Contact us at https://www.isc.org/contact/ for more information.


    bind-users mailing list
    bind-users@lists.isc.org
    https://lists.isc.org/mailman/listinfo/bind-users


    <div dir="ltr"><div>[ Classification Level: <font color="blue">GENERAL BUSINESS</font> ]</div><br class="cursAfter">Or, if you absolutely *must* use the same namespace internally and externally (oftentimes you can&#39;t talk the business out of that),
    your internal version should be a more-or-less a superset of your external version.<div><br></div><div>How you keep those in sync is up to you. For us, we have a centralized management system that makes the relevant updates in parallel. The big caveat
    with that is, those few situations where the DNS needs to be &quot;schizophrenic&quot;, i.e. resolve differently in the internal versus external versions of the zones. We try to keep that nonsense to a minimum, but when we can&#39;t talk people out of it,
    we handle it on an exception basis.</div><div><br></div><div>I suppose another approach is to have a backend database which tags each record as being &quot;internal&quot;, &quot;external&quot; or &quot;both&quot;, and then the respective versions of
    the zones get generated accordingly. You&#39;d need something to ensure referential integrity, though, otherwise you might end up with dangling references (e.g. CNAME/MX/SRV targets), bad delegations, etc.</div><div><br></div><div>               
                                                                                - Kevin</div><div><br></div><div>P.S. No offense to schizophrenics. I guess a more accurate term would be &quot;multiple personality&quot;.</
    <div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Sep 3, 2020 at 3:52 AM Matus UHLAR - fantomas &lt;<a href="mailto:uhlar@fantomas.sk">uhlar@fantomas.sk</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="
    margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 02.09.20 15:00, Taylor Vierrether via bind-users wrote:<br>
    &gt; I am attempting to set up an internal DNS server that is authoritative for<br>
    &gt; internal resources, but also will respond for external resources on the<br>
    &gt; same domain that it does not have records for.<br>
    &gt;<br>
    &gt; For example, I have a domain <a href="http://sub.example.com" rel="noreferrer" target="_blank">sub.example.com</a> , and I want to have internal<br>
    &gt; entries in the BIND zone file for <a href="http://host1.sub.example.com" rel="noreferrer" target="_blank">host1.sub.example.com</a> and<br>
    &gt; <a href="http://host2.sub.example.com" rel="noreferrer" target="_blank">host2.sub.example.com</a>.  That part is working fine.  However, there is a<br>
    &gt; publicly available DNS entry for <a href="http://sub.example.com" rel="noreferrer" target="_blank">sub.example.com</a> that I want my internal<br>
    &gt; clients to be able to resolve, but I don’t want to have the IP in the BIND<br>
    &gt; zone file, because the IP is dynamic.<br>

    you can delegate that entry elsewhere.<br>

    &gt;  There are also some hosts (<a href="http://host3.sub.example.com" rel="noreferrer" target="_blank">host3.sub.example.com</a> ) and<br>
    &gt; (<a href="http://host4.sub.example.com" rel="noreferrer" target="_blank">host4.sub.example.com</a>) that are externally resolvable that I don’t want<br>
    &gt; to put in my internal BIND file because they are not controlled by me. <br>
    &gt; (Think CNAME to a SaaS application)<br>

    you can delegate those records somewhere.<br>

    &gt;I’ve attempted to do this as follows, and it seems to make sense that it<br>
    &gt; would work, but it does not.<br>
    &gt;<br>
    &gt;<br>
    &gt;named.conf:<br>
    &gt;<br>
    &gt;zone “<a href="http://sub.example.com" rel="noreferrer" target="_blank">sub.example.com</a>&quot; IN {<br>
    &gt;        type master;<br>
    &gt;        file &quot;/etc/bind/<a href="http://sub.example.com" target="_blank">sub.example.com</a>.zone&quot;;<br>
    &gt;        forward first;<br>
    &gt;        forwarders { 1.1.1.1; 1.0.0.1; };<br>
    &gt;};<br>

    forwarding is not used for zone other than &quot;type forward&quot;.<br>

    &gt;What actually happens, is if I query for <a href="http://sub.example.com" rel="noreferrer" target="_blank">sub.example.com</a> I get the following from nslookup:<br>
    &gt;*** Can&#39;t find <a href="http://sub.example.com" rel="noreferrer" target="_blank">sub.example.com</a>: No answer<br>

    if you search for &quot;<a href="http://sub.example.com" rel="noreferrer" target="_blank">sub.example.com</a>&quot; record, you can not delegate that one,<br>
    of course.<br>

    you apparently should use redesign your DNS. Easiest way would be using<br> different domain internally.<br>

    &gt;And if I query for <a href="http://host3.example.com" rel="noreferrer" target="_blank">host3.example.com</a> , I get the following from nslookup:<br>
    &gt;** server can&#39;t find <a href="http://host3.sub.example.com" rel="noreferrer" target="_blank">host3.sub.example.com</a>: NXDOMAIN<br>

    note that nslookup is very bad program for tracking DNS errors.<br>
    use &quot;host&quot; or &quot;dig&quot; for that case.<br>


    -- <br>
    Matus UHLAR - fantomas, <a href="mailto:uhlar@fantomas.sk" target="_blank">uhlar@fantomas.sk</a> ; <a href="http://www.fantomas.sk/" rel="noreferrer" target="_blank">http://www.fantomas.sk/</a><br>
    Warning: I wish NOT to receive e-mail advertising to this address.<br> Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.<br>
    I just got lost in thought. It was unfamiliar territory.<br> _______________________________________________<br>
    Please visit <a href="https://lists.isc.org/mailman/listinfo/bind-users" rel="noreferrer" target="_blank">https://lists.isc.org/mailman/listinfo/bind-users</a> to unsubscribe from this list<br>

    ISC funds the development of this software with paid support subscriptions. Contact us at <a href="https://www.isc.org/contact/" rel="noreferrer" target="_blank">https://www.isc.org/contact/</a> for more information.<br>


    bind-users mailing list<br>
    <a href="mailto:bind-users@lists.isc.org" target="_blank">bind-users@lists.isc.org</a><br>
    <a href="https://lists.isc.org/mailman/listinfo/bind-users" rel="noreferrer" target="_blank">https://lists.isc.org/mailman/listinfo/bind-users</a><br>
    </blockquote></div></div></div>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)