I want to remove the default IPv6 link-local address of an interface and want to replace it with a customized IPv6 link-local address?

Can you help me here?

If I assign a new link-local IPv6 address as below, then the interface shows two link-local IPv6 addresses. /sbin/ip -6 addr add fe80::ade1:ac14:1334/64 dev eth0 scope link

I know below command can remove the old link-local IPv6 address, is there any other way to remove it without specifying the address? sbin/ip -6 addr del dev eth0.

  • 1
    Link-local addresses are automatically generated either by generating a random one or by using the MAC address, inverting bit 7 and adding ff:fe in the middle. – xdevs23 Apr 26 at 15:49
  • Please edit the question and explain why you'd like to change the link-local address without changing the MAC address. You'd be breaking part of the IPv6 protocol if you do so. If you want static additional link-local addresses, you can do so with ULAs, without having to remove the original link-local address. – dirkt Apr 26 at 17:22
  • This is just for a small experiment I am doing by disabling the DAD (Duplicate Address Detection). Since DAD is disabled, I want to assign a unique link-local IPv6 address by myself. – user3349687 Apr 27 at 9:47

IP address is mandatory for ip -6 a del command so you should write a small scipt to find out IPv/6 address. Original local link address contains MAC address of the interface in converted EUI-64 ID format what means the first byte's of the 7th bit of the MAC adsress is complemented.

Example: ip a show enp0s8 command output (unnecessary parts removed):

enp0s8: ...

link/ether 08:00:27:02:8a:41 brd ff:ff:ff:ff:ff:ff

inet6 fe80::0a00:27ff:fe02:8a41/64 scope link

EUI-64 ID: 08:00:27:FFFE:02:8a:41

Converted EUI-64 ID, complement 7th bit: 08 (0000 1000) will 0a (0000 1010)

From MAC adress you can construct the original local link IP and after you can use to delete this IPv6 address.

| improve this answer | |
  • I can also use the getifaddrs() to get all the IP addresses assigned to the particular interface, filter out the IPv6 link-local address from the list and use it as an argument to the del command. Just wanted to know if there is any simpler way to do this. – user3349687 Apr 27 at 9:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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