Network Working Group                                        E. Warnicke
Internet-Draft                                             Cisco Systems
Expires: August 2, 2003                                    February 2003


                DNS Resolution of Networks and Gateways
              draft-warnicke-network-dns-resolution-01.txt

Status of this Memo

   This document is an Internet-Draft and is in full conformance with
   all provisions of Section 10 of RFC2026.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF), its areas, and its working groups.  Note that
   other groups may also distribute working documents as
   Internet-Drafts.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   The list of current Internet-Drafts can be accessed at http://
   www.ietf.org/ietf/1id-abstracts.txt.

   The list of Internet-Draft Shadow Directories can be accessed at
   http://www.ietf.org/shadow.html.

   This Internet-Draft will expire on August 2, 2003.

Copyright Notice

   Copyright (C) The Internet Society (2003).  All Rights Reserved.

Abstract

   This document specifies a method given an IP address to perform a
   series of DNS lookups to determine the network that contains that IP
   address, the netmask of that network, and the gateway(s) on that
   network.  This method allows for variable length subnet masks,
   delegation of subnets on non-octet boundaries, and multiple gateways
   per subnet.









Warnicke                 Expires August 2, 2003                 [Page 1]

Internet-Draft    DNS Resolution of Networks and Gateways  February 2003


1. Introduction

   As a variety of new devices are introduced to the network, many of
   them not traditional workstations or routers, there are some
   applications arising which require the participation of the first hop
   router on the edge in the provision of some network service for a
   host.

   There are some mechanisms provided for the resolution of gateways for
   classful networks in RFC 1035 [1], and subnets in RFC 1101 [2].  RFC
   1101 suffers from a number of defects, chief among which are that it
   does not support variable length subnet masks, which are in commonly
   deployed in the internet.

   Since the writing of RFC 1101 mechanisms for dealing with classless
   networks in DNS have arisen, for example RFC 2317 [3].  This document
   describes a mechanism of using the notation similar to RFC 2317 to
   specify a series of PTR records enumerating the subnets of a given
   network in the RFC 2317 notation.  This lookup process continues
   until the contents of the PTR records are not an in-addr.arpa.
   derived domain name.  These terminal PTR record values are treated as
   the hostname(s) of the router(s) on that network.  This RFC also
   specifies an extension to the method of RFC 2317 to allow for
   delegation at non-octet boundaries.



























Warnicke                 Expires August 2, 2003                 [Page 2]

Internet-Draft    DNS Resolution of Networks and Gateways  February 2003


2. Generic format of a network domain name

   Using the Augmented BNF of RFC 2234 [4] we can describe a generic
   domain name for a network as follows:

   networkdomainname = maskedoctet "." *( decimaloctet / maskedoctet ".")
                        ".in-addr.arpa."

   maskedoctet = decimaloctet "-" mask

   mask = (*1( "1" / "2" ) DIGIT ) / "3" ("1" / "2" )

   decimaloctet = ( *1("1") DIGIT DIGIT ) /
                   ( "2" ( "1" / "2" / "3" / "4" ) DIGIT ) /
                   ( "2" "5" ( "1" / "2" /"3" / "4" / "5" ) )

   The by way of reference an IPv4 CIDR notation network address would
   be written

      IPv4CIDR = decimaloctet "." decimaloctet "." decimaloctet "."
      decimaloctet "/" mask

   A "-" is used as a delimiter in a maskedoctet instead of a "/" as in
   RFC 2317 out of concern about compatibility with existing DNS
   servers, many of which do not consider "/" to be a valid character in
   a hostname.

























Warnicke                 Expires August 2, 2003                 [Page 3]

Internet-Draft    DNS Resolution of Networks and Gateways  February 2003


3. Non-octet boundary delegation

   In RFC 2317 there is no mechanism for non-octet boundary delegation.
   Networks would be represented as being part of the domain of the next
   octet.

   Examples:

      10.100.2.0/26  -> 0-26.2.100.10.in-addr.arpa.

      10.20.128.0/23 -> 128-23.20.10.in-addr.arpa.

      10.192.0.0/13 -> 192-13.10.in-addr.arpa.

   In the event that the entity subnetting does not actually own the
   network being subnetted on an octet break, a mechanism needs to be
   available to allow for the specification of those subnets.  The
   mechanism is to allow the use of maskedoctet labels as delegation
   shims.

   For example, consider an entity A which controls a network
   10.1.0.0/16.  Entity A delegates to entity B the network 10.1.0.0/18.
   In order to avoid having to update entries for entity B whenever
   entity B updates subnetting, entity A delegates the
   0-18.1.10.in-addr.arpa domain ( with an NS record in A's DNS tables
   as usual ) to entity B.  Entity B then subnets off 10.1.0.0/25.  It
   would provide a domain name for this network of
   0-25.0.0-18.1.10.in-addr.arpa ( in B's DNS tables).

   In order to speak about the non-octet boundary case more easily it is
   useful to define a few terms.

   Network domain names which do not contain any maskedoctets after the
   first ( leftmost ) label are hereafter referred to as canonical
   domain names for that network.  0-25.0.1.10.in-addr.arpa.  is the
   canonical domain name for the network 10.1.0.0/25.

   Network domain names which do contain maskedoctet labels after the
   first ( leftmost ) label can be reduced to a canonical domain name by
   dropping all maskedoctet labels after the first ( leftmost ) label.
   They are said to be reducible to the canonical network domain name.
   So for example 0-25.0.0-18.1.10.in-addr.arpa.  is reducible to
   0-25.0.1.10.in-addr.arpa.  Note that a  network domain name
   represents the same network as the canonical domain name to which it
   can be reduced.






Warnicke                 Expires August 2, 2003                 [Page 4]

Internet-Draft    DNS Resolution of Networks and Gateways  February 2003


4. Lookup procedure for a network given an IP address

4.1 Procedure

   1.  Take the initial IP address x.y.z.w and create a candidate
       network by assuming a 24 bit subnet mask.  Thus the initial
       candidate network is x.y.z.0/24.

   2.  Given a candidate network of the form x.y.z.n/m create an
       in-addr.arpa candidate domain name:

       1.  If the number of mask bits m is greater than or equal to 24
           but less than or equal to 32 then the candidate domain name
           is n-m.z.y.x.in-addr.arpa.

       2.  If the number of mask bits m is greater than or equal to 16
           but less than 24 then the candidate domain name is
           z-m.y.x.in-addr.arpa.

       3.  If the number of mask bits m is greater than or equal to 8
           but less than 16 then the candidate domain name is
           y-m.x.in-addr.arpa.

       4.  The notion of fewer than 8 mask bits is not reasonable.

   3.  Perform a DNS lookup for a PTR record for the candidate domain
       name.

   4.  If the PTR records returned from looking up the candidate domain
       name  are of the form of a domain name for a network as defined
       previously (Section 2), then for each PTR record reduce that
       returned domain name to the canonical form
       p1-q1.z1.y1.x1.in-addr.arpa.  This represents a network
       x1.y1.z.1.p1/q1.

       1.  If one of the x1.y1.z1.p1/q1 subnets contains the original IP
           address x.y.z.w then the PTR record return becomes the new
           candidate domain name.  Repeat steps 3-4.

       2.  If none of the x1.y1.z1.p1/q1 subnets contain the original IP
           address x.y.z.w then this process has failed.

   5.  If the PTR record(s) for the candidate network is not of the form
       of a network domain name then they are presumed to be the
       hostname(s) of the gateway(s) for the subnet being resolved.

   6.  If the PTR lookup fails ( no PTR  records are returned )




Warnicke                 Expires August 2, 2003                 [Page 5]

Internet-Draft    DNS Resolution of Networks and Gateways  February 2003


       1.  If no candidate network PTR lookup for this IP address has
           succeeded in the past and the netmask for the last candidate
           network was 24 or 16 bits long then presume a netmask of 8
           fewer bits for the candidate network and repeat steps 2-4.

       2.  If no candidate network PTR lookup for this IP address has
           succeeded in the past and the netmask for the last candidate
           network was not 24 of 16 bits long, then increase the netmask
           by 1 bit and repeat steps 2-4.

       3.  If a candidate network PTR lookup for this IP address has
           succeeded in the past or the netmask of the last candidate
           network was 32 bits then this process has failed.

   7.  Perform a DNS A record lookup for the domain name of the gateway
       to determine the IP number of the gateway.


4.2 Example

   Imagine we begin with the IP number 10.15.162.3.

   1.   Form a candidate network of 10.15.162.0/24.

   2.   Form a domain name 0-24.162.15.10.in-addr.arpa.

   3.   Lookup the PTR records for 0-24.162.15.10.in-addr.arpa.

   4.   Suppose the lookup fails ( no PTR records returned ), then

   5.   Form a new candidate network 10.15.0.0/16.

   6.   Form a domain name 0-16.15.10.in-addr.arpa.

   7.   Lookup the PTR records for 0-16.15.10.in-addr.arpa.

   8.   Lookup returns:

        1.  0-17.15.10.in-addr.arpa.

        2.  128-18.15.10.in-addr.arpa.

        3.  192-18.15.10.in-addr.arpa.

   9.   So 10.15.0.0/16 is subnetted into 10.15.0.0/17, 10.15.128.0/18,
        and 10.15.192.0/18.

   10.  Since 10.15.162.3 is in 10.15.128.0/18, the new candidate domain



Warnicke                 Expires August 2, 2003                 [Page 6]

Internet-Draft    DNS Resolution of Networks and Gateways  February 2003


        name is 128-18.15.10.in-addr.arpa.

   11.  Lookup the PTR records for 128-18.15.10.in-addr.arpa.

   12.  Lookup returns

        1.  128-19.128-18.15.10.in-addr.arpa.

        2.  0-25.160.128-18.15.10.in-addr.arpa.

        3.  128-25.160.128-18.15.10.in-addr.arpa.

        4.  0-24.161.128-18.15.10.in-addr.arpa.

        5.  162-23.128-18.15.10.in-addr.arpa.

   13.  The canonical network domains for these returned records are

        1.  128-19.15.10.in-addr.arpa.

        2.  0-25.160.15.10.in-addr.arpa.

        3.  128-25.160.15.10.in-addr.arpa.

        4.  0-24.161.15.10.in-addr.arpa.

        5.  162-23.15.10.in-addr.arpa.

   14.  So the network 10.15.128.0/18 is subnetted into 10.15.128.0/19,
        10.15.160.0/25, 10.15.160.128/25, 10.15.161.0/25, 10.15.162.0/
        23.

   15.  Since 10.15.162.3 is in 10.15.162.0/23 the new candidate domain
        name is 162-23.128-18.15.10.in-addr.arpa.

   16.  Lookup the PTR records for 162-23.128-18.15.10.in-addr.arpa.

   17.  Lookup returns:

        1.  gw1.example.com.

        2.  gw2.example.com.

   18.  Lookup the A records for gw1.example.com.  and gw2.example.com.

   19.  Lookup returns

        1.  gw1.example.com: 10.15.162.1



Warnicke                 Expires August 2, 2003                 [Page 7]

Internet-Draft    DNS Resolution of Networks and Gateways  February 2003


        2.  gw2.example.com: 10.15.162.2

   So the 10.15.162.3 is in network 10.15.162.0/23 which has gateways
   10.15.162.1 and 10.15.162.2.















































Warnicke                 Expires August 2, 2003                 [Page 8]

Internet-Draft    DNS Resolution of Networks and Gateways  February 2003


5. Needed DNS Entries

   The example in the Lookup procedure (Section 4) section would require
   DNS records as follows:

    In entity A's DNS zone files:

   ;; provide entries for the subnets of 10.15.0.0/16

   0-16.15.10.in-addr.arpa.  IN  PTR 0-17.15.10.in-addr.arpa.

   0-16.15.10.in-addr.arpa.  IN  PTR 128-18.15.10.in-addr.arpa.

   0-16.15.10.in-addr.arpa.  IN  PTR 192-18.15.10.in-addr.arpa.

   ;; delegate a shim zone for each of the subnets

   0-17.15.10.in-addr.arpa.    IN  NS 10.15.0.50

   128-18.15.10.in-addr.arpa.  IN  NS 10.15.128.50

   192-18.15.10.in-addr.arpa.  IN  NS 10.15.192.50





























Warnicke                 Expires August 2, 2003                 [Page 9]

Internet-Draft    DNS Resolution of Networks and Gateways  February 2003


   In entity B's DNS zone files:

   ;; provide entries for the subnets of 10.15.128.0/18

   128-18.15.10.in-addr.arpa. IN PTR 128-19.128-18.15.10.in-addr.arpa.

   128-18.15.10.in-addr.arpa. IN PTR 0-25.160.128-18.15.10.in-addr.arpa.

   128-18.15.10.in-addr.arpa. IN PTR \
                                   128-25.160.128-18.15.10.in-addr.arpa.

   128-18.15.10.in-addr.arpa. IN PTR 0-24.161.128-18.15.10.in-addr.arpa.

   128-18.15.10.in-addr.arpa. IN PTR 162-23.128-18.15.10.in-addr.arpa.

   ;; provide entries pointing to non in-addr.arpa hostnames for
   ;; terminal network
   162-23.128-18.15.10.in-addr.arpa.  IN  PTR gw1.example.com.

   162-23.128-18.15.10.in-addr.arpa.  IN  PTR gw2.example.com.

   ;; provide A records for the gateways.
   gw1.example.com.  IN  A 10.15.162.1

   gw2.example.com.  IN  A 10.15.162.2


























Warnicke                 Expires August 2, 2003                [Page 10]

Internet-Draft    DNS Resolution of Networks and Gateways  February 2003


6. Security Considerations

   Any revelation of information to the public internet about the
   internal structure of your network may make it easier for nefarious
   persons to mount diverse attacks upon a network.  Consequently care
   should be exercised in deciding which ( if any ) of the DNS resource
   records described in this draft should be made visible to the public
   internet.











































Warnicke                 Expires August 2, 2003                [Page 11]

Internet-Draft    DNS Resolution of Networks and Gateways  February 2003


References

   [1]  Mockapetris, P., "DOMAIN NAMES - IMPLEMENTATION AND
        SPECIFICATION", RFC 1035, November 1987.

   [2]  Mockapetris, P., "DNS Encoding of Network Names and Other
        Types", RFC 1101, April 1989.

   [3]  Eidnes, H., de Groot, G. and P. Vixie, "Classless IN-ADDR.ARPA
        delegation", RFC 2317, March 1998.

   [4]  Crocker, D. and P. Overell, "Augmented BNF for Syntax
        Specifications: ABNF", November 1997.


Author's Address

   Edward A. Warnicke
   Cisco Systems Inc.
   7025 Kit Creek Road
   PO Box 14987
   Research Triangle Park, NC  27709-4987
   US

   Phone: (919) 392-8489
   EMail: eaw@cisco.com

























Warnicke                 Expires August 2, 2003                [Page 12]

Internet-Draft    DNS Resolution of Networks and Gateways  February 2003


Appendix A. Acknowledgements

   The author gratefully acknowledges the assistance of Murry Gavin and
   Josh Littlefield in reviewing this document.















































Warnicke                 Expires August 2, 2003                [Page 13]

Internet-Draft    DNS Resolution of Networks and Gateways  February 2003


Intellectual Property Statement

   The IETF takes no position regarding the validity or scope of any
   intellectual property or other rights that might be claimed to
   pertain to the implementation or use of the technology described in
   this document or the extent to which any license under such rights
   might or might not be available; neither does it represent that it
   has made any effort to identify any such rights.  Information on the
   IETF's procedures with respect to rights in standards-track and
   standards-related documentation can be found in BCP-11.  Copies of
   claims of rights made available for publication and any assurances of
   licenses to be made available, or the result of an attempt made to
   obtain a general license or permission for the use of such
   proprietary rights by implementors or users of this specification can
   be obtained from the IETF Secretariat.

   The IETF invites any interested party to bring to its attention any
   copyrights, patents or patent applications, or other proprietary
   rights which may cover technology that may be required to practice
   this standard.  Please address the information to the IETF Executive
   Director.


Full Copyright Statement

   Copyright (C) The Internet Society (2003).  All Rights Reserved.

   This document and translations of it may be copied and furnished to
   others, and derivative works that comment on or otherwise explain it
   or assist in its implementation may be prepared, copied, published
   and distributed, in whole or in part, without restriction of any
   kind, provided that the above copyright notice and this paragraph are
   included on all such copies and derivative works.  However, this
   document itself may not be modified in any way, such as by removing
   the copyright notice or references to the Internet Society or other
   Internet organizations, except as needed for the purpose of
   developing Internet standards in which case the procedures for
   copyrights defined in the Internet Standards process must be
   followed, or as required to translate it into languages other than
   English.

   The limited permissions granted above are perpetual and will not be
   revoked by the Internet Society or its successors or assignees.

   This document and the information contained herein is provided on an
   "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
   TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
   BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION



Warnicke                 Expires August 2, 2003                [Page 14]

Internet-Draft    DNS Resolution of Networks and Gateways  February 2003


   HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.


Acknowledgement

   Funding for the RFC Editor function is currently provided by the
   Internet Society.











































Warnicke                 Expires August 2, 2003                [Page 15]