What unique hardware signatures can you get from, for example, a FreeBSD system?

I am right now using the ethernet mac address (getifaddrs(3)) but as we all know this can easily be changed with ifconfig. So what else is there? Anything in sysctl?

I am using C to do this so if I can just find out where to look I will most likely find a way to get it.

  • 4
    What are you trying to accomplish by uniquely identifying the hardware?
    – cjm
    Apr 27, 2011 at 18:43
  • 2
    If you are using this for software licensing, be aware that binding to a hardware id might annoy your users, e.g. if it changes just because they had to replace a faulty network card or motherboard.
    – Mikel
    Apr 27, 2011 at 23:33

3 Answers 3


The original way to do this was using hostid.

The man page notes that it's:

a 32-bit identifier... normally a DARPA Internet address for the local machine

i.e. it's the machine's IP address in hex.

This means it won't change just because somebody had to replace a broken network card.
It also means it's not guaranteed to be unique, for example if networking isn't configured, or the machine uses a private IP address.

In fact, it might not even be set, and can be changed by the superuser using sethostid or sysctl.

I can't find anything of much use in the sysctl -a output besides kern.hostid.
On OpenBSD there is hw.uuid, but that's not available on FreeBSD.

After that, there are several commands that might help, including:

Most of these work by calling ioctl on the relevant device.

If you need to do it in C, check out the source code for the above commands for more details.

You could also look at libvolume_id or libblkid to get the id of the root file system. Because they are ports, obviously neither of those are part of the base system, but one or the other might get installed as part of a standard desktop installation.

See also: Getting a unique id from a Unix-like system.

  • 1
    At least since 7.2, if not before, FreeBSD has kern.hostid as a 32-bit unique identifier and kern.hostuuid as a 128-bit unique identifier. hostid is really to small for a good unique identifier.
    – penguin359
    Apr 28, 2011 at 10:31
  • @penguin359: Ah. Thanks for that. Didn't see it in the man page.
    – Mikel
    Apr 28, 2011 at 11:02
  • I didn't either, I just did sysctl -a | host
    – penguin359
    Apr 28, 2011 at 20:44
  • @penguin359 really good stuff, thank you very much! I will upvote Mikel's answer because it contains this thread. Thank you @Mikel. When I read draeth's answer it hit me that I could use hardware ID's like PCI DEVID and such to assemble a hardware signature. Apr 29, 2011 at 5:23

Linux has a tool called 'dmidecode' that can pull S/Ns from a lot of the hardware present, including memory modules (if provided via DMI), disks, CPUs etc. This could be of help - but realize many of these can change without actually changing machine!

I do not know for sure if FreeBSD has the same tool, but I'm positive they have something to fill that niche.

  • ${PORTSDIR}/sysutils/dmidecode
    – Mel
    May 20, 2011 at 17:36

dmidecode is available for FreeBSD, i installed dmidecode-2.12 in my FreeBSD 8.2-RELEASE.

It gives complete hardware information as like of linux machines.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.