Reverse mapping

One of the most common uses of DNS is getting an IP number attached to a domain name (forward lookups), but there is a system for doing the reverse, getting a domain name from an IP number (reverse lookups), too. Reverse mapping for example is used by mail servers for tracking spammers by doing first a reverse lookup for the sender’s IP number, and then a forward lookup for the returned domain name, or for diagnostic purposes, such as listing the active internet connections in nslookup.

Reverse lookups are actually quite simple: we do a PTR-type query for a special domain name composed from the IP number. If the IP number is a.b.c.d, we do a PTR-lookup for

For example, say we’d want to find the domain for, we’d do a query for the domain. This might return something like the following: 2h PTR

indicating that is a domain name for the IP number.

IPv6 reverse mapping

For IPv6, we have a similar situation in the tree, except we get very long domain names, because every character in the IPv6 address gets its own DNS label, and short notations are not supported. For example, the IPv6 number 1aef:a2::dead:beef, is actually, in full:


so its reverse-mapping domain name becomes:

Just like for IPv6 forward mapping (see Using DNS for naming hosts), there is an alternate way of reverse-mapping as well, by means of the domain name and DNAME records. Like the A6 record though, this method is marked experimental and it is not supported by Posadis.

Short notation

Because especially IPv6 reverse-mapping domains can be bitches to type, Posadis introduces a short syntax for them: a dot followed by the address. For example, in all Posadis programs, is the same as ., and

is also known as .1aef:a2::dead:beef. Take your pick. If you need a reverse-mapping zone name, such as, use .66.35.250.*, or just .66.35.25.

Delegation in '''' and ''''

You may know that IP addresses have a kind of hierarchy in them. For example, all IP numbers a.b.c.d with the same value for a are in the same A-class network, and all IP numbers with the same value for a and b are in the same B-class network. From this, delegation of authority in follows quite naturally.

Unfortunately though, sometimes networks are also split within one label, for example, the network refers to IP numbers through (classless delegation). So how do you delegate authority here?

Well, there is no system for this, but RFC 2317 suggest setting up CNAMEs for all domain names pointing to delegated subdomains. Say we want to delegate to one server, and to another, we’d make the following zone:    CNAME  0.0/    CNAME  1.0/
(...)  CNAME  127.0/  CNAME  128.128/
(...)  CNAME  255.128/

This way, we can let others control the 0/ and 128/ zones for their own IP number. Of course, this approach is only reasonable for /24 or higher classless delegations: imagine managing a /17 delegation: you’d need a zone with 2^15 such CNAME records…1)

Reverse mapping for the internet

If you run an internet domain, you probably don’t want to do reverse mapping: your ISP has probably already done that for you, and you should contact them if you want your reverse-mapping domain pointing somewhere else. Only if you have a complete C-class network or something like that hooked up to the internet you might consider having authority for the reverse mapping delegated to you.

Reverse-mapping for local networks

For local networks, you’d want to create two reverse-mapping zones. You always want one to have reverse mapping for localhost, and one for the local IP numbers. The localhost reverse-mapping zone could be as simple as:

@ 2h SOA ns1.localnet. meilof@localnet. 1 2h 1h 1d 2h
     NS  ns1.localnet.
1    PTR localhost.

A simple local IP reverse mapping zone could be something like

@ 2h  SOA ns1.localnet. meilof@localnet. 2004112801 2h 1h 1d 2h
      NS  ns1.localnet.
1.1   PTR ns1.localnet.
2.1   PTR ns2.localnet.
3.1   PTR mail.localnet.

100.1 PTR client100.localnet.
101.1 PTR client101.localnet.

and so forth.

The Posadis "revmap" module

Of note in this context is also the revmap module in Posadis 0.60.* and up. If you want to have working reverse-mapping for your network, and you don’t care much about the details of the reverse mapping, you can use it to have reverse-mapping done automatically for you. Automatically generating PTR records is an approach that many ISPs use.


1) There is a special RR type that can improve that situation, the DNAME record, but Posadis doesn’t currently support it.
  dns/reverse_mapping.txt · Last modified: 2005/01/06 20:18
Copyright © Meilof Veeningen, 2002-2005 - About