Ubuntu – How to find out the system’s DHCPv6 DUID


I would like to assign a static IPv6 address to my machine running Ubuntu Server 15 using DHCPv6. To do so, I need to know the DUID used by the DHCP client so I can assign the static IP to it in my network's DHCP server.

How can I find out which DUID is being used?

Best Answer

Ubuntu server calls dhclient with a few flags, but mostly default options, and it therefore defaults to a type 1 DUID-LLT DUID. Ubuntu desktop uses Network Manager which then calls dhclient with a type 4 DUID-UUID DUID.

For servers, it puts it in /var/lib/dhcp/dhclient6.......lease
For desktop, it puts it in /var/lib/NetworkManager/dhclient6.......lease

It's a weird string that looks like:
default-duid "\000\001\000\001\037\305\371\341\001\002\003\004\005\006"

Here's a short script you can use to convert it to a normal hex format duid.
Just run the script like:

./script '\000\001\000\001\037\305\371\341\001\002\003\004\005\006'

The script:


printf $1 | hexdump -e '14/1 "%02x " "\n"' | sed 's/ /:/g'