[lug] Converting IPs to Domain Names and Vice Versa via Bash

David Anselmi anselmi at anselmi.us
Wed Jan 26 21:27:33 MST 2005


David Morris wrote:
[...]
> As for the IP address being reviersed in the reply of the
> reverse lookup....that is just the way it is done.  I'm
> certain there was a good reason at one time but its mostly
> tradition now I suspect.

It's a tradition worth sticking to.  I'd have thought CS people would 
take this for granted but I tend to see it done wrong.

Typically when naming things you put the most general part to the right. 
  That's the way fw1.cellularonewest.com is, and also 
3.140.212.65.in-addr.arpa.  In both, the host specific piece is left-most.

This usually makes good sense--think about sorting or tab completion 
where you'd probably want to sort by the most specific piece first.  As 
a counter example, here's a real list:

ismdenf01
ismdenf02
ismdenf03

The first letter is the (federal) department, next two are agency, next 
3 are office, and finally server type and number.  Better is:

f01densmi
f02densmi
f03densmi

and even better:

f01.den.sm.doi (etc)--but this breaks the Windows security model which 
requires policy to be set at the (DNS) domain level.  I'll spare you my 
rant on conceptual orthogonality (or something).

An exception to this rule is when naming things by date.  Then to get 
the appropriate sort order you have to do year-month-day (unless you can 
use something fancier than the ubiquitous algorithm).

Dave



More information about the LUG mailing list