---
name: "ether_gen_addr"
section: "9"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/ether_gen_addr"
---

# ether\_gen\_addr(9)

generate an arbitrary MAC address for use

## NAME

**ether\_gen\_addr** – generate an arbitrary MAC address for use

## SYNOPSIS

**#include \<sys/types.h\>**

**#include \<sys/socket.h\>**

**#include \<net/if.h\>**

**#include \<net/if\_var.h\>**

**#include \<net/ethernet.h\>**

*void*\

**ether\_gen\_addr**(*struct ifnet \*ifp*, *struct ether\_addr \*hwaddr*);

## DESCRIPTION

The **ether\_gen\_addr**() function generates an arbitrary MAC address for use by an ethernet interface that does not have an assigned address.

By default, **ether\_gen\_addr** attempts to generate a stable MAC address using the hostid of the jail that the *ifp* is being added to. During early boot, the hostid may not be set on machines that haven't yet populated */etc/hostid*, or on machines that do not use [loader(8)](/loader/8.md).

**ether\_gen\_addr** can fail to derive a MAC address due to memory allocation failure, or because the hostid has not been populated. In these cases, a locally-administered unicast MAC address will be randomly generated and returned via the *hwaddr* parameter.

If **ether\_gen\_addr** succeeds, then it will return a MAC address in the FreeBSD Foundation OUI, “58:9c:fc”, via the *hwaddr* parameter.

## AUTHORS

This manual page was written by Kyle Evans ⟨*kevans@FreeBSD.org*⟩.
