Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror

Slashdot videos: Now with more Slashdot!

  • View

  • Discuss

  • Share

We've improved Slashdot's video section; now you can view our video interviews, product close-ups and site visits with all the usual Slashdot options to comment, share, etc. No more walled garden! It's a work in progress -- we hope you'll check it out (Learn more about the recent updates).

×
User Journal

dcowart's Journal: I found my hostid....

Journal by dcowart

hostid

Prints a hexidecimal number globally unique to your host.

In linux (and AIX and Tru64) based on the IP address of the host. In Solaris based on the MAC address of the host and stored in the PROM. Solaris doesn't guarantee uniqueness. With NAT'ing Linux can't either anymore...

    SuSE Linux had it as part of the util-linux rpm. Looking at the HISTORY for that package hostid had been removed in 1997. Hmmm... Check the source, best resort of a linux geek, and yes, it's not there. Grab a Redhat SRC rpm for util-linux. It's not there either, but it does at least have a note that it had been moved to sh-utils. AhHA! Jump to gnu.org... sh-utils has been combined into core-utils, grab the source. Yes! It's there... but wait, hostid is pretty much a syscall to gethostid.

gethostid(2) is in unistd.h, rpm -q tells me it is in glibc, grab the glibc source. And I have it, buried five directories down is the source for gethostid. It uses the IP address of the system but splits it into two pieces and then flips each piece; so 192.168.10.1 gets changed to 168.192.1.10 before having each piece changed to hex. reading the source though, if it can't find the IP address of the system, it generates a random number...

This all came up b/c I tried to set my hexidecimal hostid to 0xDEADBEEF. The AIX freshly allocated pointer value. I also notice that while the Linux version of this command outputs hex, it requires decimal to be input on the command line. The AIX and Tru64 versions allow an ip address to be input, a much more friendly way of doing it, espcially since it uses the IP address anyway.

That was my hostid fun for yesterday.

dzc

PS. I also re-arranged my computer room some.

This discussion has been archived. No new comments can be posted.

I found my hostid....

Comments Filter:

An adequate bootstrap is a contradiction in terms.

Working...