Automatic Private IP Addresses – Part 4 of 5, TCP/IP in Windows Vista
When a DHCP client is unable to locate a DHCP server, the Vista machine picks out a random 192.168.0.1 address from an Automatic Private IP Address (APIPA) range.
The APIPA range consists of an IP address of 169.254.x.y, with a subnet mask of 255.255.0.0. Why is the APIPA range considered to be private? Because that set of network numbers is not in use on the Internet; it is also random because the client generates an arbitrary host number (the x.y part) for that 169.254 network.
Let’s say, for example, that the client picks a host ID of 100.23. The client will then announce to the network with a broadcast packet that it wants to use the IP address of 169.254.100.23. If no other computer responds that the IP address is already in use, Vista registers that IP address and binds it to the network card.
So what? The significance of APIPA is that Vista machines that are DHCP clients will still assign themselves an IP address even when they cannot find a DHCP server. This is better than no IP address at all, as the 169.254 address will allow them to communicate with other computers on the same subnet that cannot find a DHCP server, either (and that also assign themselves an APIPA address).
In other words, APIPA allows for (limited) network communication when the DHCP server is either down or just plain not there. Note, however, that APIPA does not assign a default gateway, and therefore it cannot communicate with any computers that live on the other side of a router. A Vista computer with an APIPA-assigned address will therefore not be able to access the Internet or any other computers that live on other subnets.
APIPA is not a new feature to Windows Vista. A mixed workgroup of Vista and XP systems will be able to use APIPA and communicate with one another using the 169.254.x.y address range.
In summary, here are the signs to look for when networking with an APIPA address:
- An IP address of 169.254.x.y. Administrators can open a command prompt and type ipconfig to look up IP address information.
- The ability to communicate with other DHCP clients on the same subnet.
- The inability to communicate with any other computers, including those on the Internet.
Because computers with APIPA addresses cannot (typically) check their email, it might be better for administrators to configure Vista clients with an alternative IP address in the event that the DHCP server is down.
You don’t need to do anything to configure APIPA; it’s configured by default. Here’s how to double-check:
- Open the Network Connections Control Panel application under the Network and Internet grouping.
- Right-click the desired network adapter and choose Properties. Now select Internet Protocol Version 4 and click the Properties button.
- In the IPv4 properties dialog box, choose the Alternate Configuration tab.
This is the tab that Vista uses to govern networking behavior when the computer cannot obtain its IP address information automatically. To use APIPA, ensure that the “Automatic private IP address” radio button is selected.
We’ll use this same dialog box in the next section’s discussion of alternative IP addresses.
Using an alternative IP address
Because of the aforementioned limitations (no Internet access, for example), you might not want your computer to use an APIPA address if a DHCP server cannot be found.
For example, let’s say you bring your laptop to work, where you know the IP address of the router and the pool from which the IP addresses are being handed out-you know the default gateway is at 192.168.2.1, and the pool is from the 192.168.2.2-254 range. In that case, you’re going to lose all network connectivity if the DHCP server is down and Vista pulls an APIPA address.
This might be a perfect opportunity to use an alternative configuration with a static address. In the event that your system is unable to get an IP address automatically, Vista will switch over to whatever you’ve configured on the Alternate Configuration tab.
And note here that you can still configure other parameters, such as the DNS and Wins name resolution servers.
The “IP address” box is where you can add multiple IPs to the same network interface. This can be helpful in many circumstances, but it is generally considered bad practice. However, many people do it for many reasons. Some applications require two IP addresses for communications.
The automatic metric
In most cases, the automatic metric is fine. However, in unique circumstances, there are times when two network cards are being used and traffic needs to flow out of a specific card for whatever reason. In this case, you can manually set the card’s metric.
For instance, say you have two network cards, as follows:
IP address of 192.168.66.16; subnet mask of 255.255.255.0; and a gateway of 192.168.66.1
IP address of 192.168.66.17; subnet mask of 255.255.255.0; no gateway (you should have only one gateway in most configurations)
Let’s also say that you have an application that needs to see traffic coming from this computer on 192.168.66.7. However, because the gateway is on 192.168.66.6, most of the traffic will go out from 192.168.66.16, so you metric 192.168.66.17 to a 10 and 192.168.66.16 to a 20. This will cause all internal traffic to go out from 192.168.66.17 and all traffic to the Internet to use 192.168.66.16, which has the gateway in place. This is not a best practice, but it works very well.
In the final installment of this 5-part series, we’ll further discuss IPv6 in comparison to IPv4 within Windows Vista.
In addition, I’m always happy to provide additional assistance for free. Visit me at my website and submit your questions to me. I’ll get back to you with an answer as soon as possible.