Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

It seems like when dhclient runs on eth0 I get an IPv4 address from the DHCP server and a Scope:Link IPv6 address attached to eth0:

inet6 addr: fe80::a00:27ff:fed0:4d41/64 Scope:Link

But I can't see from dhclient-script how that address is being added. On another interface with a static IP address, I'd like to add a link local IPv6 address, and I was wondering if there was a generic command to do that without knowing the mac.

Edit:
It looks like the kernel assigns the link local address when you do "ip link set dev ethX up" or "ifconfig ethX up". However, in my case I had a cable plugged in to the interface that was DHCP'ing and no cable plugged into the interface I was setting up statically. Can't verify until Monday but I'm guessing the kernel does not assign link local addresses to the interface if there's no link.

share|improve this question
2  
Neither has anything to do with the other. –  Michael Hampton Jul 20 '13 at 2:34
2  
I understand that. And yet, as a result of running dhclient you get an IPv6LL address, but when you set a static IPv4 address you don't. So some side effect of some command being run by dhclient sets that up.. –  Aaron Jul 20 '13 at 15:56
    
No, you do not get an IPv6 link-local address from running dhclient. –  Michael Hampton Jul 20 '13 at 18:24

3 Answers 3

up vote 4 down vote accepted

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.

share|improve this answer
1  
"They are auto-generated as part of bringing the interface up". Right, this is what I'm looking for, who is autogenerating it? It's not auto-generated when you assign a static IPv4 address, but it is when dhclient runs. So is dhclient implementing RFC 4862, or is it a side effect of some command in the dhclient-script? How do I replicate it on a static interface without writing my own implementation of RFC 4862? –  Aaron Jul 20 '13 at 16:01
    
auto-generated by the kernel, it seems, see edit above. –  Aaron Jul 20 '13 at 22:45

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
share|improve this answer
    
By the way I can't understand why my distro is flipping disable_ipv6: once the link is brought down it does make any difference. –  MarcH Jan 14 at 1:41

http://ben.akrin.com/?p=1347 has a nice online calculator to do the conversion from MAC address to link-local ipv6 address.

Once you have the address, add it with

ip address add dev br0 scope link fe80::xxxx:xxff:fexx:xxxx

share|improve this answer
    
Firstly, the user should not have to manually compute an address which is auto-generated. Secondly, whenever I type this command I get: RTNETLINK answers: Permission denied. –  MarcH Jan 13 at 0:26
    
I was getting "Permission denied" because of "disable_ipv6", see my answer in this same thread. –  MarcH Jan 13 at 0:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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