June 26, 2007

How to change hostid on SUSE Linux?

  1. 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…

  2. sethostid(3) man page

Tags: ,

Tell a Friend Today!

del.icio.us Digg Furl Reddit Ask BlinkList blogmarks Blogg-Buzz Google Ma.gnolia Netscape ppnow Rojo Shadows Simpy Socializer Spurl StumbleUpon Tailrank Technorati Windows Live Wists Yahoo! Help

Permalink • Print

Track this entry

RSS BlogPulse

RSS Technorati Cosmos

Related Searches

, , , ,