Activate EUI-64 on Ubuntu Desktop
This information is current as of Ubuntu 20.04 “Focal Fossa”.
I have repeatedly battling Ubuntu Desktop VMs to use EUI-64 addressing.
If you wondering, what that is, just a very brief reminder. In order to reach machines from the outside over IPv6, you need to (obviously) know their IPv6 address (or more precisely, one of their IPv6 addresses). There is an established standard way on how to generate IPv6 addresses (or more specifically, the host part of it) from the MAC address in a predictable manner, namely EUI-64. This makes it easy to get a valid IPv6 address of any machine (or rather, interface) if you know the IPv6 network prefix and the MAC address.
But client systems such as Ubuntu Desktop will normally try to use only random addresses to avoid tracking their activity, and not assign a permannent one, much less a predictable one. Unfortunately, this makes reaching the machine from the outside via IPv6 difficult.
So here is what I have found to be working. Quite likely, it is actually more than is needed. (This is assuming your Ubuntu Desktop VM has a single virtual Ethernet interface.)
Configure Netplan
Go to
/etc/netplan
and find the YAML configuration file there. Edit it to make it look like this:
network:
version: 2
ethernets:
enp0s3:
ipv6-privacy: off
ipv6-address-generation: eui64
renderer: NetworkManager
Obviously, you want to replace
enp0s3
with the name of your Ethernet interface.
Configure Network Manager
But that appears to not be enough. Network Manager has a habit of doing what it thinks is best, so we need to tell it what we want. Run
nmcli connection edit ethernet
, and to the interactive prompt, enter
set ipv6.addr-gen-mode 0
and, just to be sure,
print ipv6.addr-gen-mode
– it should come back with
ipv6.addr-gen-mode: eui64
if it worked. Now
save
and
quit
and then reboot your machine.
That should be it.