IN PTR localhost (What's localhost.db look like)

Barry Margolin barmar at genuity.net
Tue Jun 27 17:45:45 UTC 2000


In article <8j9mdg$qpk$1 at nnrp1.deja.com>, BadBoo  <bmeyer at rocsoft.net> wrote:
>I have the bind book, and I have a few questions about the sample
>db.0.0.127 file.
>
>It seems to contradict what is written elsewhere, as far as
>abbreviation etc. Is this because it is in the beginning of the book,
>and the 'shortened' files haven't been taught yet? Or is their a reason
>and significance that this file would demand to be  very painstakingly
>written out? I have it transcibed as:
>------------------------------------
>0.0.127.IN-ADDR.ARPA.	IN	SOA	ns.rocsoft.net.
>hostmaster.rocsoft.net. (
>				2000062700	; Serial
>				28800		; Refresh
>				7200		; Retry
>				604800		; Expire
>				10800	)	; Minimum TTL
>0.0.127.IN-ADDR.ARPA.	IN	NS      ns.rocsoft.net.
>0.0.127.IN-ADDR.ARPA.	IN	NS      www2.rocsoft.net.
>
>1.0.0.127.IN-ADDR.ARPA.	IN	PTR     localhost.
>------------------------------------
>Would it be correct to re-write it as:
>------------------------------------
>@	IN	SOA	ns.rocsoft.net. hostmaster.rocsoft.net. (
>				2000062700	; Serial
>				28800		; Refresh
>				7200		; Retry
>				604800		; Expire
>				10800	)	; Minimum TTL
>	IN	NS      ns.rocsoft.net.
>	IN	NS      www2.rocsoft.net.
>1	IN	PTR     localhost.
>
>------------------------------------

Yes, those two files are equivalent.  @ is a shorthand for the current
origin, which defaults to the zone name.  Indenting a line means to use the
same name as the previous record.  And not ending a name with '.' causes
the current origin to be appended.

>Final question:
>
>Since it is listed as being in 'IN PTR localhost Where do I create a
>reference to 'localhost? (or how do I declare 'localhost' ?)

Typically you create a host named "localhost" in your local domain, and
depend on the resolver appending a default domain to unqualified names.  So
in your case you would put

localhost  IN A  127.0.0.1

in the rocsoft.net zone file.

Also, on many versions of Unix, gethostbyname() recognizes "localhost" as a
special case (there was a post a few months ago, either in this group or in
one of the Unix groups, where someone tried changing what "localhost"
resolved to, and found that it didn't work).

-- 
Barry Margolin, barmar at genuity.net
Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.



More information about the bind-users mailing list