macaddr-random

Synopsis

(macaddr-random)

Parameters

Description

This procedure returns a unbiased random MAC address as suggested in RFC4814 for test traffic generation:

“The bitwise ANDing of the high-order byte in the MAC address with 0xFC sets the low-order two bits of that byte to 0, guaranteeing a non-multicast address and a non locally administered address. Note that the resulting addresses may violate IEEE 802 standards by using organizationally unique identifiers (OUIs) not assigned to the test port manufacturer. However, since these addresses will be used only on isolated test networks there should be no possibility of mistaken identity."

The source interface number of the “test instrument” must be tracked otherwise (e.g. in a MAC address skiplist).

Side Effects

Return Value

A random, non-multicast and non locally administered MAC address is returned.

Example

> (macaddr-random)
4c:2a:e6:b3:04:69
> (macaddr-random)
48:5a:6e:a8:64:d0
> (macaddr-random)
44:48:1b:77:28:84
> (macaddr-random)
18:9e:ca:dd:8a:da
> (macaddr-random)
d8:39:26:db:31:33
>