[Users] /usr/bin/hostid in VPS

Josip Rodin joy at entuzijast.net
Fri Jun 13 04:06:19 EDT 2008

On Tue, Jun 10, 2008 at 03:07:21PM -0400, Alastair Neil wrote:
> I would like to encapsulate a server that runs a variety of license managers
> including flexlm.  Many of these systems rely on generating a hostid
> generally either the MAC address of the primary network interface or a hash
> generated by /usr/bin/hostid.  In an OpenVZ VPS hostid returns 00000000, is
> there a way to spoof this so that I can keep the license managers happy
> regadless of the system/network inferface it is actually using? I tried
> setting up a veth device that spoofed the original MAC address but hostid
> still returns 00000000.

That program basically returns the value of the gethostid() call, and that
comes from <unistd.h>. As far as I can tell from glibc sources
(sysdeps/unix/sysv/linux/gethostid.c) all you need to do is edit
the file /etc/hostid (either with something that calls sethostid() or

     2. That which causes joy or happiness.

More information about the Users mailing list