Automatic Client Configuration for IPv4
A version of this page is also available for
4/8/2010
One of the most important client services is the Dynamic Host Configuration Protocol (DHCP) client. Windows Embedded CE has the ability to automatically configure an IPv4 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/IPv4 client is installed and set to dynamically obtain TCP/IP protocol configuration information from a DHCP server, instead of being manually configured with an IPv4 address and other parameters, then the DHCP client service is engaged each time the network interface is initialized. Examples of times the network interface is initialized includes when a device resumes from suspend mode during the boot process or when a removable network card is inserted. The DHCP client service now uses a two-step process to configure the client with an IPv4 address and other configuration information:
When the DHCP client is enabled, it attempts to locate a DHCP server and obtain configuration settings 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.
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 AutoIntervalregistry key. If a DHCP server is found, the auto configuration information is abandoned and configuration settings offered by the DHCP server is used instead.
Note
The Windows Embedded CE client does a discover. The DHCP server does an offer. The CE client checks the subnet. If the subnet is the same, the CE client requests the same IP address.
When the DHCP client has previously obtained a lease from a DHCP server, the following modified sequence of events occurs:
- 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.
- 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 Embedded 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. If you set DhcpRetryDialogue to a value that is less than that of the DhcpMaxRetry value, a dialog box is displayed when the retry attempt equals the DhcpRetryDialogue value. However, the user is not required to click OK on the dialog box for the retry attempts to continue. The DHCP client continues its attempts to obtain an IP address until the specified DhcpMaxRetry value is reached.
Note
The dialog box is displayed only if the network Control Panel application is included in the OS design.
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 information about IPv6 client configuration, see Neighbor Discovery (ND).
See Also
Concepts
Assigning an IPv4 Address to a Device
TCP/IP Registry Settings
Manually Configuring an IPv4 Address