June 26, 2007
How to change hostid on SUSE Linux?
- I do not use SuSe Linux, but with this program, you could set the hostid on any machine, and at least on all linuxes.
Save this as hostid.c and compile it using
# gcc hostid.c
( Needless to say, you need to be a superuser)#include <stdio.h>
#include <unistd.h>int main(int argc, char *argv[])
{
if(argc < 2)
{
fprintf(stderr,"Usage:%s <hostid>\n",argv[0]);
return 1;
}
sethostid(
strtoul(argv[1],NULL,16) );
return 0;
}The first argument you supply is the hexadecimal hostid you want to set ( You can pass the output of hostid command here, if you want to set your hostid to a particular host). Then verify that the set is successfull by issuing hostid again.
You may be interested in knowing that hostid is stored in /etc/hostid (not as text though, or you could directly change from there)
Regards
Qasim Zaidi
http://qasimzaidi.googlepages.com… - sethostid(3) man page























