Take the 2-minute tour ×
Server Fault is a question and answer site for professional 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
1  
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

2 Answers 2

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
    
"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

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

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.