Finding the DHCPv6 DUID on MacOS X 10.11.6

A host using DHCP with IPv6 is identified by a DHCP unique identifier (DUID). It's not well documented how to find this identifier on a Mac.

On MacOS X 10.11.6 ("El Capitan"), the DUID in stored in /var/db/dhcpclient/DUID_IA.plist, and can be extracted as follows:

    [mangole] > sudo plutil -p /var/db/dhcpclient/DUID_IA.plist
      "IAIDList" => [
        0 => "en0"
        1 => "en2"
      "DUID" => <00010001 1986c342 XXXXXXXX XXXX>
    [mangole] > 

The DUID uses the DUID-LLT format described in RFC 3315 section 9.2. The three components of the identifier are: 00010001 indicates DUID type 1 (DUID-LLT), hardware type 1 (802.11); 1986c342 seems to be the time in seconds since 1 January 2000 that the host first acquired a DHCPv6 address; and the XXXXXXXX XXXX is replaced by a MAC address of one of the interfaces.

If the host currently has a DHCPv6 lease, the command ipconfig getv6packet en0 (replacing en0 with the name of the active interface as appropriate) will show the same information in a less useful format.

On Windows, the DUID can be found using ipconfig /all.