From: Peter Date: 2003-09-30T03:41:59+09:00 Subject: Re: TCPSocket.gethostbyname difficulties > I think your DNS server manages to do the reverse lookup while ours can't. > Is that possible? I don't know anything about how reverse lookups work... I've just taken a look at the rfc1034. The section on inverse queries goes like this: 3.7.2. Inverse queries (Optional) Name servers may also support inverse queries that map a particular resource to a domain name or domain names that have that resource. For example, while a standard query might map a domain name to a SOA RR, the corresponding inverse query might map the SOA RR back to the domain name. Implementation of this service is optional in a name server, but all name servers must at least be able to understand an inverse query message and return a not-implemented error response. The domain system cannot guarantee the completeness or uniqueness of inverse queries because the domain system is organized by domain name rather than by host address or any other resource type. Inverse queries are primarily useful for debugging and database maintenance activities. Inverse queries may not return the proper TTL, and do not indicate cases where the identified RR is one of a set (for example, one address for a host having multiple addresses). Therefore, the RRs returned in inverse queries should never be cached. Inverse queries are NOT an acceptable method for mapping host addresses to host names; use the IN-ADDR.ARPA domain instead. Basically, inverse lookups are not expected to work, but DNS servers can provide them for the domain names they know of themselves. While it's easy to delegate queries to DNS servers based on the hierarchical naming, it's not based on IP address because IP addresses lack the necessary structure. Anyway, my DNS server doesn't know noblepack.com directly, so it can't tell me that 205.178.141.161 is really noblepack.com, and finding a DNS server that does is looking for a needle in a haystack. Matz's DNS server happened to know about noblepack.com, either directly or cached, and as such it could say 205.178.141.161 is noblepack.com. Also this changes since before the weekend my DNS server could tell me 216.239.37.99 is really google, while now it can't. Beats me how google got uncached... Since ruby's socket lib always calls C function gethostbyaddr in the call to TCPSocket#gethostbyname, it is bound to fail except for local and popular names. I don't know why TCPSocket#gethostbyname doesn't simply call C function gethostbyname, but there is probably a good reason for that. Peter