16.5. Network Names and Numbers
The
original DNS specifications
didn't provide the ability to look up network names based on a
network number -- a feature that was provided by the original
HOSTS.TXT file. Since then,
RFC 1101 has defined a system for storing
network names; this system also works for subnets and subnet masks,
so it goes significantly beyond
HOSTS.TXT.
Moreover, it doesn't require any modification to the name
server software at all; it's based entirely on the clever use
of PTR and A records.
Remember that to map an IP address to a name in DNS, you reverse the
IP address, append in-addr.arpa, and look up PTR records.
This same technique is used to map a network number to a network
name, for example, to map network 15/8 to "HP Internet."
To look up the network number, include the network bits and pad them
with trailing zeros to make four bytes, and look up PTR data just as
you did with a host's IP address. For example, to find the
network name for the old ARPAnet, network 10/8, look up PTR data for
0.0.0.10.in-addr.arpa. You
get back an answer like ARPAnet.ARPA.
If the ARPAnet were subnetted, you'd also find an address
record at 0.0.0.10.in-addr.arpa. The address would
be the subnet mask, 255.255.0.0, for instance. If you were interested
in the subnet name instead of the network name, you'd apply the
mask to the IP address and look up the subnet number.
This technique allows you to map the network number to a name. To
provide a complete solution, there must be a way to map a network
name to its network number. This, again, is accomplished with PTR
records. The network name has PTR data that points to the network
number (reversed with in-addr.arpa appended).
Let's see what the data might look like in HP's zone data
files (the HP Internet has network number 15/8) and step through
mapping a network number to a network name.
Partial contents of the file db.hp.com:
;
; Map HP's network name to 15.0.0.0.
;
hp-net.hp.com. IN PTR 0.0.0.15.in-addr.arpa.
Partial contents of the file
db.corp.hp.com:
;
; Map corp's subnet name to 15.1.0.0.
;
corp-subnet.corp.hp.com. IN PTR 0.0.1.15.in-addr.arpa.
Partial contents of the file
db.15:
;
; Map 15.0.0.0 to hp-net.hp.com.
; HP's subnet mask is 255.255.248.0.
;
0.0.0.15.in-addr.arpa. IN PTR hp-net.hp.com.
IN A 255.255.248.0
Partial contents of the file
db.15.1:
;
; Map the 15.1.0.0 back to its subnet name.
;
0.0.1.15.in-addr.arpa. IN PTR corp-subnet.corp.hp.com.
Here's the procedure to look up the subnet name for the IP
address 15.1.0.1:
- Apply the default network mask for the address's class. Address
15.1.0.1 is a class A address, so the mask is 255.0.0.0. Applying the
mask to the IP address makes the network number 15.
- Send a query (type=A or type=ANY
) for 0.0.0.15.in-addr.arpa.
- The query response contains address data. Since there is address data
at 0.0.0.15.in-addr.arpa (the subnet mask,
255.255.248.0), apply the subnet mask to the IP address. This yields
15.1.0.0.
- Send a query (type=A or type=ANY
) for 0.0.1.15.in-addr.arpa.
- The query response does not contain address data, so 15.1.0.0 is not
further subnetted.
- Send a PTR query for 0.0.1.15.in-addr.arpa.
- The query response contains the network name for 15.1.0.1:
corp-subnet.corp.hp.com.
In addition to mapping between network names and numbers, you can
also list all the networks for your zone with PTR records:
movie.edu. IN PTR 0.249.249.192.in-addr.arpa.
IN PTR 0.253.253.192.in-addr.arpa.
Now for the bad news: despite the fact that RFC 1101 contains
everything you need to know to set this up, there's very little
software we know of that actually
uses this type
of network name encoding, and very few administrators go to the
trouble of adding this information. Until software actually makes use
of DNS-encoded network names, about the only reason for setting this
up is to show off. But that's a good enough reason for many
of
us.
| | |
16.4. Dialup Connections | | 16.6. Additional Resource Records |