It is very rare to need to configure the physical layer (beyond plugging it in) or the link layer. The first area that usually needs configuration is the the network layer, for address assignment. This section discusses technical solutions for automatic configuration of the network layer - in particular, how to obtain a network address in both IPv4 and IPV6.
IPv6 actually has two different ways to automatically obtain a network address. One of these is known as stateful autoconfiguration[1], and roughly corresponds to DHCP, where you need a suitably configured server that will provide a unique address. The second type of autoconfiguration is called stateless, and is an effective zeroconf approach.
IPv6 stateless autoconfiguration[2] takes advantage of the size of the IPv6 address space and the uniqueness of link layer addresses such as Ethernet MAC addresses.
Each interface generates an link-local address, which is never routed off the local link. This is done by taking FE80 and appending the link layer address (typically, the ethernet MAC address), with zeros filling the remaining bytes between the link local identifier, and the link layer address. In IPv6 notation, this is FE80::(mac address), where the :: notation indicates that enough zeros are inserted to pad the resulting address out to the required 128 bits.
That address is then configured onto the network interface. At this stage, the address is considered tentative, and the host joins appropriate multicast groups.
One of the multicast groups (solicited-node) is then used to check that the tentative address is unique, by using a Neighbor Solicitation message, which is part of ICMPv6[3]. If a node on the link is already using the desired address (that is duplicated addresses are detected), then the host that is already using the address replies with a Neighbor Advertisement, and the tentative address is abandoned, and autoconfiguration stops on that host.
If there is no answer to the Neighbor Solicitation message, then the address is unique, and the interface transitions from tentative to preferred.
The host then sends a Router Solicitation to the all-routers multicast address. Each router will respond with a Router Advertisement message, and for each response with the autonomous bit set, an address is generated consisting of the prefix provided in the Router Advertisement, and the interface hardware address. These addresses are assigned to the appropriate interface, and are then available for use.
While IPv6 can use its address space to encompass the full range of hardware addresses, this is clearly not possible with IPv4. Instead of having a one-to-many mapping between hardware address and IP address, there is a many-to-one mapping between hardware address and IP address. That is, lots of hosts are selecting from the same limited pool of addresses. While the autoconfiguration approach in IPv4 is broadly similar to that of IPv6, the limited address space means that some changes are required.
IPv4 addresses are chosen from a pool of 65024 possible IP addresses in the range of 169.254.1.0 to 169.254.254.255 (that is 169.254/16, with the top 256 and bottom 256 addresses reserved for future purposes).
The algorithm to chose an address is relatively simple. The host seeds a random number generator with the hardware address (MAC address) of the interface, and randomly chooses an address in the required range.
The host then does an ARP probe for the address, and if there are any responses, then the host chooses another IP address at random, and tries the ARP probe again.
If there are no answers, then no-one is currently using the address on the local link, and the host is free to assign the selected address.
The host then does a couple of gratuitous ARPs to flush any ARP caches which may have old data, and can then use the address for further networking. The host must continue to monitor network traffic, in order to respond to any ARP probes that are for the address that the host is currently using.
It is worth noting that a "capable" host, such as a PC or workstation is expected to have at least two IP addresses - a routable address[4], and a zeroconf link-local address from the 169.254/16 space. This allows communication with device that only has a link-local address (such as a zeroconf printer), while also allowing communication with the rest of the internet, assuming such a connection is available.
[1] | For additional detail on how this works, refer to http://www.ietf.org/internet-drafts/draft-ietf-dhc-dhcpv6-28.txt, or the corresponding RFC which will likely be released by the time linux.conf.au 2003 occurs. |
[2] | RFC2642 provides additional detail on this process. |
[3] | ICMPv6 is a significant change from the ICMP of IPv4, and is a major aspect of IPv6 functionality. ICMP is a very simple protocol. ICMPv6 is a complex protocol. You can think of it as ICMP, souped up and lowered, and pumped full of steroids. Refer to RFC2643 for additional detail. |
[4] | Note that this address may not be routable on the public internet - it could be an RFC1918 address such as the 10/8 or 192.168/16 address spaces. |
<<< Previous | Home | Next >>> |
What do we mean by Zeroconf Networking? | Technology - Part 2 - Name to Address Translation |