[baylisa] Re: wtf: hostid gives '0' as a hostid

cerise at armory.com cerise at armory.com
Sat Feb 16 22:12:01 PST 2008


A couple of misconceptions from what I posted:
1) It does *not* go by MAC address.  It goes by IP address.
2) It acquires the IP address by doing a DNS lookup of the hostname

It gets the hostname from __gethostname().  It then does a DNS lookup of that
hostname.  It then takes the source address from the DNS lookup and mangles
it by shifting left 16 bits and oring that with the source address shifted
right 16 bits.

In your case, Rob, your system believes it is something that resolves to
127.0.0.1.  This might be because your hostname is set to localhost or
it might be because your /etc/hosts specifies that 127.0.0.1 is the address
of your hostname.

-Phil/CERisE

On Sat, Feb 16, 2008 at 09:37:17PM -0800, Robi wrote:
> It seems in Linux hostid is pretty useless, as you'll almost always get a
> value of
> 127.0.0.1 in network-endian hexadecimal.
> 
> 007f 0100
> 
> f7 00 00 01
> 
> 127 . 0 . 0 . 1
> 
> having VMs won't help much either, depending on the guest OS you're running,
> some will behave better than others based how they use their networking or
> pull data for hostid.
> 
> pseudo-unique identifiers can be had from the SMBIOS/DMI data (UUID value).
> not sure which tools one would use to gather this though.
> 
> -- Rob



More information about the Baylisa mailing list