Sometimes (often) when troubleshooting network access issues we may check the IP configuration of a computer. We can do this in several ways in Windows:
- From a command prompt, ‘ipconfig’ or ‘ipconfig –all’
- Control Panel > Network and Sharing Centre
- Start > Run > ‘ncpa.cpl’
Sometimes we will find that the computer has an IPv4 address beginning 169.254.x.x and is unable to access eg. the internet. This is because the computer has been unable to contact a DHCP server in order to be assigned a valid IP address. In this situation the computer is allowed to randomly assign itself an address in the 169.254/16 range, thus allowing at least a minimal level of communication over the IP network. This is called Automatic Private Internet Protocol Addressing (in Microsoft networks) and more generally such an IP address is referred to as a ‘link local address’.
Normally when we connect a computer to an IP network we want it to automatically acquire a valid IP address for the network it is joining, and we do this by running a DHCP server on the network. The Dynamic Host Configuration Protocol server listens for broadcast requests from new computers and responds by offering the client computer an IP address and other information that will let it communicate on the IP network. So we connect or turn on a new computer, it sends a DHCP request by broadcast (ie. to all nodes on the network), the DHCP server responds to this with IP configuration information. That’s all good and simple – so what if the PC does not receive a DHCP allocation?
RFC 3297 provides the option for this – “a host may automatically configure an interface with an IPv4 address within the 169.254/16 prefix that is valid for communication with other devices connected to the same physical (or logical) link”. So the PC randomly selects an address in this range, makes some ARP broadcasts to ensure that no-one else is using this IP and then binds it to the network adapter. As below:
Immediately we can see some critical differences between the computer with a DHCP allocated address and the machine using APIPA:
- The APIPA client has no default gateway, therefore it cannot access resources outside of the local network, such as the Internetz, because it doesn’t know where the gate to there is.
- The APIPA client has no default DNS server, so it can only resolve resource and computer names through legacy methods such as netbios.
- The APIPA client can only access other machines on the 169.254.x.y. range (ie other auto-configured computers)
Microsoft says “[APIPA] makes configuring and supporting a small Local Area Network (LAN) running TCP/IP less difficult.” While this may once have been true, it doesn’t really apply to the sort of networks that everyone is using today – indeed most people would consider it intolerable not to have internet access on each PC. For this reason I often think of it as a legacy feature, but it’s important to remember that in IPv6, stateless auto-configuration of link-local IP addresses is mandatory, ie. every IPv6 network interface will have a link-local address (starting fe80::).
That’s pretty much all I’ve got for you today. I hope that this answers a few questions about why and how you’re computer ended up with a 169.254 IP address and why that means you can’t connect to anything. Now you know this you can check your DHCP server, network paths, run a few tracerts and pings and hopefully be all connected up in a jiffy.
http://support.microsoft.com/kb/220874 – How to use automatic TCP/IP addressing without a DHCP server
http://technet.microsoft.com/en-us/magazine/2007.08.cableguy.aspx – IPv6 Autoconfiguration in Windows Vista