6

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?

2 Answers 2

4

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:

#!/bin/bash

printf $1 | hexdump -e '14/1 "%02x " "\n"' | sed 's/ /:/g'
3
  • my dhclient6..lease file has the following: "\000\004\354\352~\365\017\375\330\201!\230+<Oj\031\302" which returns an error with your script. Any ideas?
    – Arindrew
    Feb 21, 2017 at 18:09
  • 1
    Replace the double quotes with single quotes because there are characters like ! in your duid lease file and change the 14/1 to 18/1 in the script to account for the longer length of type 4 duid's. I think the script originally came from some redhat documentation and only had type 1 and type 3 duid's in mind. Feb 22, 2017 at 7:57
  • actually, I found even better was to add -s 2 to skip some of the pre-amble, e.g.: hexdump -s 2 -e '14/1 "%02x " "\n"' /var/lib/dhcpv6/dhcp6c_duid Jul 9, 2017 at 7:49
0

If you are using DHCP with ISC dhcpd look in:

/etc/dhcp/dhclient6.conf


If you are using dibbler as dhcp client check for the DUID in:

/var/lib/dibbler/client-duid

It might also be worth checking in /etc/dibbler/client.conf if any other bits are there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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