Debian 7 how are IPv6 link local addresses set?

Solution 1:

Link local addresses are derived from the MAC address of the device. They are auto-generated as a part of bringing the interface up. Auto-configuration includes a discovery process to ensure that the address is unique on the network.

A similar process is used to auto-configure routable addresses when a router advertisement is available. These addresses may be regenerated periodically to provide privacy.

RFC 4862 specifies the processes to be followed.

Solution 2:

Found it! This command is not enough:

ifconfig eth0 up

Instead I must do:

ifconfig eth0 up
sysctl -w net.ipv6.conf.eth0.disable_ipv6=0

Only the latter does restore the IPv6 link local address on eth0.

In other words, my distro seems to have some code hidden somewhere which dynamically changes net.ipv6.conf.eth0.disable_ipv6 every time it is asked to bring the network brought up or down. Your mileage may vary.

I got to the bottom of this thanks to a mere:

sysctl -a | grep ipv6