wtf: hostid gives '0' as a hostid

Rick Moen rick at linuxmafia.com
Tue Feb 12 20:34:41 PST 2008


Quoting David Alban (extasia at extasia.org):

> saw something today i've never seen before.  on a linux box,
> /usr/bin/hostid printed '0' to stdout (plus a newline, of course).
> uh...  isn't it supposed to be an eight digit hex number?

I believe that (on Linux) it's a hex rendition of the first ethernet
port's IP, so I'm guessing your Linux host has that set to zeroes.  Note
correspondence between my hostid value and the eth1 IP address (eth0
being disabled):


$ /sbin/ifconfig   
eth1      Link encap:Ethernet  HWaddr 00:D0:B7:93:31:0E  
          inet addr:198.144.195.186  Bcast:198.144.195.191 Mask:255.255.255.248
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3620757 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3959775 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:494644356 (471.7 MiB)  TX bytes:2192414672 (2.0 GiB)
          Interrupt:11 Base address:0x1080 Memory:fa202000-fa202038 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:149902 errors:0 dropped:0 overruns:0 frame:0
          TX packets:149902 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:81642189 (77.8 MiB)  TX bytes:81642189 (77.8 MiB)


$ hostid 
90c6bac3
$
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'. 
obase=16
198
C6
144
90
195
C3
186
BA
quit
$

(Other *ixes use different algorithms.)

-- 
Cheers,                                      "Reality is not optional."
Rick Moen                                             -- Thomas Sowell
rick at linuxmafia.com



More information about the Baylisa mailing list