[chef] Re: Re: fqdn and hostname


Chronological Thread 
  • From: Dan Razzell < >
  • To:
  • Subject: [chef] Re: Re: fqdn and hostname
  • Date: Thu, 24 Jan 2013 11:37:34 -0800

A reverse lookup has different semantics depending on context.  This can cause unexpected behavior.

1) The object returned from gethostbyaddr() contains a list of host aliases and a list of addresses.  In other words, it's perfectly reasonable for there to be multiple hostnames associated with a single address.  Ordering is not guaranteed in either list.  However the object also has an attribute for the official hostname.  Whether that is the long or the short name depends on how the underlying database is configured.  For that, see the man page for nsswitch.conf.  Conventions vary from one site to another.

2) If your nsswitch.conf causes the reverse lookup to be passed to DNS, the behavior when there are multiple PTR records for a given address is undefined.  You might get a list.  You might get a singleton that is round-robined.  You might consistently get the same singleton from one DNS server and a different singleton from another.  You might get nothing.

On 13-01-24 10:47 AM, Lamont Granquist wrote:
" type="cite">
when you're doing a reverse lookup on 1.2.3.4 with that config you're getting back the first name which is the short hostname.  to get the FQDN just reverse that to:

1.2.3.4 machine1.example.com machine1





Archive powered by MHonArc 2.6.16.

§