Automatic Private IP Addressing - 25 Oct 1999

This week, columnist Zubair Alexander examines Windows 2000's Automatic Private IP Addressing (APIPA), one of several useful features in the new OS for small office/home office environments.

Zubair Alexander

October 24, 1999

4 Min Read
ITPro Today logo in a gray background | ITPro Today

Microsoft has included several features in Windows 2000 (Win2K) that are useful in small office/home office (SOHO) environments. One feature has gone through several name changes over the years, including AutoNet, Auto-IP Configuration, IP-Auto Configuration, and Automatic Private IP Addressing. In Win2K Release Candidate 2 (RC2), Microsoft has settled on Automatic Private IP Addressing (APIPA).

With APIPA, DHCP clients can automatically self-configure an IP address and subnet mask when a DHCP server isn't available. You don't need to do anything special on the clients to enable this feature. Just make sure that you configure your Win2K clients to obtain IP information from a DHCP server, as Screen 1 shows. You do this by selecting "Obtain an IP address automatically" on the General tab of the TCP/IP properties dialog box for your network adapter. By default, all Win2K clients are configured for DHCP. APIPA also works on Windows 98 clients by default.

How APIPA Works
When a DHCP client boots up, it looks for a DHCP server to obtain an IP address, subnet mask, and other possible DHCP options configured on the server. If the client is unable to obtain a lease from a DHCP server, the client uses APIPA and automatically configures itself with an IP address from the Microsoft-reserved IP address range of 169.254.0.1 through 169.254.255.254. The Internet Assigned Numbers Authority (IANA) has reserved this range for private IP addressing, so no one can use it on the Internet. The client also configures itself with a default class B subnet mask of 255.255.0.0. A client uses the self-configured IP address until a DHCP server becomes available. Obviously, APIPA is meant for nonrouted small business environments.

Resolving IP Conflicts
How does the client know the IP address it's using isn't in use by another machine? It uses a gratuitous Address Resolution Protocol (ARP) to resolve potential conflicts. Let’s say the first client that boots up wants to assign itself an IP address of 169.254.10.20. It sends out a gratuitous ARP, but no one answers, so it keeps the address. When a second client boots up, it randomly picks the address 169.254.1.57. To avoid duplication on the network, it, too, sends a gratuitous ARP to ensure that no other clients have selected the address. Next, a third client boots up and picks 169.254.10.20, the same address the first client chose. The first client tells the third client that it's already using that IP address, so the third client tries a different IP address and keeps it if there's no conflict. For each address conflict, the clients try self-configuration up to 10 times.

According to Microsoft documentation, the client checks for a DHCP server in the background every 5 minutes. As soon as it locates a DHCP server, the client updates its IP information from the DHCP server. The client also obtains other DHCP options configured on the DHCP server, such as default gateway, domain name, DNS server, and WINS server.

Renewing Leases
In situations where the DHCP client has a previous lease from a DHCP server, the client tries to renew the lease from the DHCP server at boot time. If the lease hasn’t expired, the DHCP server renews it. By default, a Win2K server leases IP information to a DHCP client for 8 days. If the lease hasn’t expired, but for some reason the client can’t contact the DHCP server, the client takes the following steps. First, the client tries to ping the default gateway, which is the default gateway that the DHCP server assigned to it in the lease. If the ping succeeds, the client assumes that it's still located on the same network where it had previously obtained the lease, and continues to use the lease as normal. By default, Win2K clients try to renew their leases when 50 percent of the lease has expired. Note that although the renewal attempt in a Win2K network occurs at the same interval as in Windows NT, the default lease periods are 8 days in Win2K, as opposed to 3 days in NT.

If the ping to the default gateway fails, the client figures it isn't located on the same network as before, so it uses APIPA to autoconfigure itself. Laptop users typically experience this scenario when they take their machines home. In absence of a DHCP server at home, the DHCP client uses APIPA. However, the client continues to look for a DHCP server in the background every 5 minutes, so when a laptop user moves the computer to another network where a DHCP server is available, the client obtains a lease from that DHCP server.

Disabling APIPA
In rare situations, you might want to disable APIPA, which you do by modifying client Registry. Run regedt32.exe and go to HKEY_LOCAL_MACHINESYSTEM CurrentControlSetServicesTcpip ParametersInterfaces. Select the adapter for which you want to disable APIPA. Add the value IPAutoconfigurationEnabled of data type REG_DWORD and set it to 0 to disable it, as Screen 2 shows. This entry isn't present by default because the OS enables APIPA and assumes a value of 1. You need to add this value only if you want to disable APIPA. If you have multiple adapters and you want to disable APIPA for all of them, simply add the entry IPAutoconfigurationEnabled at the HKEY_LOCAL_MACHINE SYSTEMCurrentControlSetServices TcpipParameters level and set it to 0.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like