Automatic Client Configuration

One of the most important client services is the Dynamic Host Configuration Protocol (DHCP) client. The DHCP client has an expanded role in Windows CE. The primary new feature is the ability to automatically configure an IP address and subnet mask when the client is started on a small private network where no DHCP server is available to assign addresses, such as a home network.

If a Microsoft TCP/IP client is installed and set to dynamically obtain TCP/IP protocol configuration information from a DHCP server, instead of being manually configured with an IP address and other parameters, then the DHCP client service is engaged each time that the device is restarted. The DHCP client service now uses a two-step process to configure the client with an IP address and other configuration information:

  1. When the DHCP client is enabled, it attempts to locate a DHCP server and obtain a configuration from the server. Most corporate TCP/IP networks use DHCP servers that have been administratively configured to hand out information to the clients on the network.

  2. If an attempt to locate a DHCP server fails, the DHCP client auto configures the stack with a LINKLOCAL address of 169.254.0.0 with the subnet mask 255.255.0.0. This process is called Automatic IP (Auto IP). Automatic IP is enabled by default. To disable it, update the AutoCfg registry key. The DHCP client will test, using a gratuitous ARP, to be sure that the IP address the client has chosen is not already in use. If the address is in use, the client selects another IP address. The client repeats this selection process for up to ten addresses. Once the DHCP client has selected an address that is verifiably not in use, the client configures the interface with this address. The client continues to check for a DHCP server in the background every 5 minutes, or according to the interval specified by the AutoInterval registry key. If a DHCP server is found, the auto configuration information is abandoned and the configuration offered by the DHCP server is used instead.

    Note   If the Windows CE client determines that a DHCP server is available, Windows CE checks if the IP address offered by the server is on the same subnet. If the address is on the same subnet, Windows CE requests that it use the automatically configured IP address. This feature prevents application sessions from being stopped unnecessarily.

When the DHCP client has previously obtained a lease from a DHCP server, the following modified sequence of events occurs:

  1. If the client's lease is still valid and has not expired at boot time, the client tries to renew its lease with the DHCP server. If the client fails to locate any DHCP server during the renewal attempt, the client attempts to ping the default gateway that is listed in the lease. If pinging the default gateway succeeds, then the DHCP client assumes that it is still located on the same network where it obtained its current lease, and continue to use the lease. The client, by default, attempts to renew its lease in the background when 50 percent of its assigned lease time has expired, or when the amount of time contained in the T1 registry key as specified by the DHCP offer has elapsed.
  2. If the attempt to ping the default gateway fails, the client assumes that it has been moved to a network that has no DHCP services currently available, such as a home network, and then automatically configures itself as described above for Auto IP. Once automatically configured, the client continues to try to locate a DHCP server every 5 minutes, in the background. If the default gateway is reachable, Windows CE continues using the old address.

After the lease expires, a DHCP client sends three discover attempts to get a DHCP address. If those attempts fail, you can either remove and reinsert the PCMCIA adapter, or reboot if you are using a static adapter. You can also use the IPConfig /release command followed by the IPConfig /renew, or the IP Helper APIs, to reinitiate the DHCP sequence.

To extend the number of attempts that a DHCP client makes to get a DHCP address, use the DhcpRetryDialogue and DhcpMaxRetry registry settings.

Note   If you set DhcpRetryDialogue to be less than DhcpMaxRetry, you will require a user to click OK on the dialog box that is displayed when the network control panel applet is included in the image. After the user clicks OK, the DHCP client will continue its attempts to obtain an IP address until DhcpMaxRetry is reached.

Because this retry method is not based on time — for example, retry DHCP every 5 minutes — but on a fixed number of retries, you should not set either DhcpRetryDialogue or DhcpMaxRetry to large values, even though they are DWORDs. Specifying large values for these registry settings causes attempts to obtain IP addresses after the lease has expired, but the user does not know that the IP address has expired because no dialog box is displayed.

When using a specific adapter name for Ethernet debugging, the DHCP subsystem is completely separate from the DHCP operations described above, and has no associated registry settings. No warning dialogs are presented if a failure occurs; typically the system just halts. When the DHCP lease expires and a server cannot be contacted, the device continues to use the address as long as no other device responds to ARP queries for that address. For more information about Ethernet debugging, see the debugging section in the Platform Builder documentation.

 Last updated on Friday, April 02, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.