RFC 4183

A Suggested Scheme for DNS Resolution of Networks and Gateways

πŸ“… published September 2005, from ietf

A Suggested Scheme for DNS Resolution of Networks and Gateways πŸŽ€

Okay bestie, let's start with the title block 🧚 This is RFC 4183, written by E. Warnicke at Cisco Systems and dated September 2005. It's Category: Informational, so it's giving "here's some useful info" rather than "this is a standard" πŸ“‹ Its header doesn't list any Obsoletes or Updates, so it isn't replacing or patching another RFC πŸ’…

Status of This Memo πŸ“œ

This memo gives info to the Internet community. It doesn't specify an Internet standard of any kind. Distribution is unlimited 🌈

Copyright (C) The Internet Society (2005).

IESG Note πŸ™ˆ

This RFC is not a candidate for any level of Internet Standard. The IETF disclaims any knowledge of how fit this RFC is for any purpose, and it notes that the decision to publish wasn't based on IETF review apart from IESG review for conflicts with IETF work. The RFC Editor picked to publish this at their own discretion. See RFC 3932 [6] for more info.

Abstract ✨

This doc suggests a way to use DNS to figure out which network holds a given IP address, that network's netmask, and the address(es) of the first-hop router(s) on that network. It works with variable-length subnet masks, delegating subnets on non-octet boundaries, and multiple routers per subnet. Iconic πŸ‘‘

1. Introduction 🌸

So a bunch of new devices are showing up on the network, and lots of them aren't traditional workstations or routers. That means the first-hop router is often expected to provide some network service for a host. Sometimes a third-party server on the network needs to ask the first-hop router(s) for that host to do something related to it. It would be super useful to have a standard way for that third-party device to find the first-hop router(s) for that host 🫢

DNS-based mechanisms already exist for resolving router addresses for classful networks (RFC 1035 [1]) and for subnets (RFC 1101 [2]). RFC 1101 has a few defects, and the biggest one is that it doesn't support variable-length subnet masks, even though those are commonly deployed on the Internet 😭 This document defines DNS-based mechanisms that fix those defects πŸ¦‹

Since RFC 1101 was written, DNS mechanisms for classless networks have shown up, like RFC 2317 [3]. This doc describes a mechanism that uses similar notation to RFC 2317 to specify a series of PTR records listing the subnets of a given network in the RFC 2317 notation. The lookup keeps going until the contents of the PTR records aren't an in-addr.arpa.-derived domain name. Those 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 RFC 2317 method so it can support delegation at non-octet boundaries πŸ’œ

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 like this:

networkdomainname = maskedoctet "." *( decimaloctet / maskedoctet
".") "in-addr.arpa."
maskedoctet = decimaloctet "-" mask
mask = 1*2DIGIT ; representing a decimal integer value in the
                ; range 1-32
decimaloctet = 1*3DIGIT ; representing a decimal integer value in
                        ; the range 0 through 255

For reference, an IPv4 CIDR notation network address would be written like this:

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

A - is the delimiter in a maskedoctet instead of the / used in RFC 2317. The reason is compatibility with existing DNS servers, lots of which don't consider / a valid character in a hostname πŸ™ƒ

3. Non-Octet Boundary Delegation πŸ“

In RFC 2317 there's no mechanism for non-octet boundary delegation. Networks get represented as 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.

Sometimes the entity doing the subnetting doesn't actually own the network being subnetted on an octet break. In that case, there needs to be a way to specify those subnets. The fix is to allow maskedoctet labels to be used as delegation shims 🧚

Here's an example. Say entity A controls the network 10.1.0.0/16. Entity A delegates the network 10.1.0.0/18 to entity B. So entity B doesn't have to keep updating entity A's entries every time entity B changes its 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 gives a domain name for this network of 0-25.0.0-18.1.10.in-addr.arpa (in B's DNS tables) 🌸

To talk about the non-octet boundary case more easily, it helps to define a few terms.

Network domain names that don't contain any maskedoctets after the first (leftmost) label are called 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 that 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're said to be reducible to the canonical network domain name. For example, 0-25.0.0-18.1.10.in-addr.arpa. is reducible to 0-25.0.1.10.in-addr.arpa.. A network domain name represents the same network as the canonical domain name it can be reduced to πŸ’…

4. Lookup Procedure for a Network Given an IP Address πŸ”

4.1. Procedure

Here's the step-by-step lookup, bestie. Follow along πŸ’–

  1. Take the initial IP address x.y.z.w and create a candidate network by assuming a 24-bit subnet mask. So 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. Fewer than 8 mask bits is not a reasonable idea.
  3. Do 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 in the form of a domain name for a network (as defined previously (Section 2)), then reduce each returned PTR domain name to the canonical form p1-q1.z1.y1.x1.in-addr.arpa. This represents a network x1.y1.z1.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 are not in the form of a network domain name, then they're 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):
    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 of the last candidate network was not 24 or 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. Do a DNS A record lookup for the domain name of the gateway to find the IP number of the gateway.

4.2. IPv6 Support ✨

RFC 3513 [5] requires that all IPv6 unicast addresses that don't begin with binary 000 have a 64-bit interface ID. For figuring out the last hop router for an IPv6 unicast address, that means almost all hosts may be considered to live on a /64 subnet πŸ‘‘ Since every subnet has to have an anycast address for its routers, the IPv4 process in this document could just as easily be done by querying that anycast address via SNMP. So this document doesn't cover a DNS-based mechanism for IPv6 🌈

4.3. Example πŸŽ€

Let's walk through it 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.  Look up 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.  Look up 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
     name is 128-18.15.10.in-addr.arpa.

11.  Look up 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.  Look up the PTR records for 162-23.128-18.15.10.in-addr.arpa.

17.  Lookup returns:
     1.  gw1.example.net.
     2.  gw2.example.net.

18.  Look up the A records for gw1.example.net.  and gw2.example.net.

19.  Lookup returns
     1.  gw1.example.net: 10.15.162.1
     2.  gw2.example.net: 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.

5. Needed DNS Entries ✨

okay bestie, this is the part where we actually write the DNS records for the lookup example from Section 4.3 🧚 entity A's zone files need these:

In entity A's DNS zone files:
   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.
   0-17.15.10.in-addr.arpa.  IN  NS ns1.example.org
   128-18.15.10.in-addr.arpa.  IN  NS ns1.example.net
   192-18.15.10.in-addr.arpa.  IN  NS ns1.example.com
   ns1.example.net           IN  A  10.15.0.50
   ns1.example.org           IN  A  10.15.128.50
   ns1.example.com           IN  A  10.15.192.50

and entity B's zone files need these πŸ¦‹ (the layout is a bit wonky in the original, so I've kept it exactly as written):

In entity B's DNS zone files:
   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.
   162-23.128-18.15.10.in-addr.arpa.  IN  PTR gw1.example.net.
   162-23.128-18.15.10.in-addr.arpa.  IN  PTR gw2.example.net.
   gw1.example.net.  IN  A 10.15.162.1
   gw2.example.net.  IN  A 10.15.162.2

6. Alternate Domain Suffix πŸ’…

okay so this bit is lowkey important πŸ₯Ί getting this method to work properly might need the cooperation of your upstream network providers. not every upstream provider is going to want to implement this method, and that's totally a thing that happens.

if your upstream provider says no, you can still use the method with an alternate domain suffix 🌸

for example, say the upstream network provider of example.com didn't want to give glue records in its branch of the in-addr.arpa. domain. then example.com could pick in-addr.example.com as its alternate domain suffix for that job ✨

so the TL;DR for client implementers: default to in-addr.arpa. as the suffix, but make sure you can configure a different one. that's the move πŸ’–


7. Security Considerations πŸ™ˆ

⚠️ bestie, this one is serious. not a drill, not a vibe, a real warning. 😭

any info you reveal to the public internet about the internal structure of your network can make it way easier for nefarious people to launch all kinds of attacks on your network. so you need to be really careful about which of the DNS resource records in this document (if any) you make visible to the public internet πŸ’€


8. Informative References πŸ“š

[1] Mockapetris, P., "Domain Names - Implementation and Specficication", STD 13, 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", RFC 2234, November 1997.

[5] Hinden, R. and S. Deering, "Internet Protocol Version 6 (IPv6) Addressing Architecture", RFC 3513, April 2003.

[6] Alvestrand, H., "The IESG and RFC Editor Documents: Procedures", BCP 92, RFC 3932, October 2004.


Author's Address πŸŽ€

Edward A. Warnicke
Cisco Systems Inc.
12515 Research Blvd., Building 4
Austin, TX 78759
USA

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

Copyright (C) The Internet Society (2005).

this document is subject to the rights, licenses and restrictions contained in BCP 78, and except as set forth therein, the authors retain all their rights.

this document and the information contained herein are provided on an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.


Intellectual Property πŸ”₯

the IETF takes no position on the validity or scope of any Intellectual Property Rights or other rights that might be claimed to pertain to the implementation or use of the technology described in this document, or on whether any license under those rights might or might not be available. it also doesn't claim to have made any independent effort to identify any such rights. info about the procedures for rights in RFC documents is in BCP 78 and BCP 79 πŸ“–

copies of IPR disclosures sent to the IETF Secretariat, any assurances of licenses to be made available, and the results of any attempt to get a general license or permission for implementers or users to use those proprietary rights can be found in the IETF on-line IPR repository at http://www.ietf.org/ipr.

the IETF invites anyone interested to bring to its attention any copyrights, patents or patent applications, or other proprietary rights that may cover technology required to implement this standard. send that info to the IETF at ietf-ipr@ietf.org πŸ’Œ


Acknowledgement πŸ’œ

funding for the RFC Editor function is currently provided by the Internet Society 🫢

πŸ“¦ where this page comes from