DHCP Allocator Operation (Windows Embedded CE 6.0)
1/6/2010
When the gateway that contains the DHCP allocator starts, it sends out a DHCP discover packet to determine if another DHCP server is present. The following behavior occurs:
- If a DHCP server answers within within 30 seconds from the time the packet is sent, ICS turns off gateway DHCP services. The gateway assumes that the server running is the correct one and that the other server has been brought onto the network by mistake.
- If a DHCP server comes on the network after the initial 30 seconds, the DHCP allocator will not disable itself. The gateway assumes that this other server was added to the network by mistake and therefore it does not shut itself down. This behavior is designed to avoid multiple DHCP servers on the same network. This would cause clients to behave non-deterministically.
- If the DHCP allocator disables itself, it periodically queries for other DHCP servers. If the DHCP allocator does not receive a response to its query, because the user may have removed the second DHCP server from the network, the DHCP allocator re-enables DHCP allocation on the device.
DHCP can automatically assign addresses for the network, including default gateway and DNS server information. This approach assumes that the DHCP allocation is performed from the gateway device, so that the gateway can advertise itself to DHCP clients as both the default gateway and as the DNS server to the Internet. To detect DHCP requests from clients on the network, the DHCP allocator monitors UDP port 67 of the local-area interface of the gateway device.
Using client's hardware address as a seed, the allocator pseudo-randomly assigns addresses to clients from a range of addresses, called an address pool. The address pool is defined by the IP address and subnet mask of the network interface on which the allocator runs. It makes the address assignments for short, configurable periods of time to avoid collisions that arise when devices are not operating. The default period for address assignment is ten minutes. Each address assignment carries the address of the DHCP allocator as both the default gateway and the DNS server. To ensure that no address conflicts exist, the DHCP allocator defends each address using Address Resolution Protocol (ARP).
Optionally, you can specify the range of IP addresses that the DHCP allocator assigns by using the DhcpAllocationStartRange and DhcpAllocationEndRange values in the HKEY_LOCAL_MACHINE\Comm\ConnectionSharing registry key. Specifying a range of addresses for allocator assignment is useful to ensure that specific addresses are not assigned and are therefore available for static IP assignment at a later time. For more information, see Connection Sharing Registry Settings and Enabling the DHCP Allocator.
Assigned addresses are stored in the Address subkeys under the HKEY_LOCAL_MACHINE\Comm\ConnectionSharing\Addresses registry key.
Note
If you change addresses in the DHCP allocator's address pool, you must also reset the Point-to-Point (PPP) server address pool to keep it synchronized.
Note
Do not use Automatic IP to obtain an address for the private network interface of the gateway computer.
For more information about the Address subkeys, see Machine Name to IP Address Maps and ICS Registry Settings.
Note
Using the DHCP allocator works well when all machines on the network have broadcast access to the gateway. If the configuration of the network includes multiple routed segments, then you must use a full DHCP server with a database. This is because a broadcast-based defense is not an adequate means of ensuring the uniqueness of assigned addresses for multiple routed segments, and not all devices on the network have broadcast access to the DHCP server. Furthermore, multiple routed segments require the configuration of multiple DHCP scopes to ensure that separate subnets are used on each segment, as well as the configuration of DHCP relay agents to relay DHCP requests to the DHCP allocator.
Response to Messages
The following table shows the messages received by the DHCP allocator, the reason the client sent the message, and the action the allocator takes in response to each message.
Note
Maximum length for a DHCP client message is 548 bytes. If a DHCPOFFER or DHCPACK message exceeds this limit, then the CE client discards the packet.
Message | Reason sent | Description |
---|---|---|
DHCPDISCOVER |
To obtain an offer from the allocator. |
Generates an address using a pseudo-random hashing scheme, subject to conflict-detection, and then replies to the client with a DHCPOFFER message. |
DHCPREQUEST |
To request a previously offered address, or extend a lease on a previously assigned address. |
If no conflict is detected, the allocator generates a DHCPACK message. |
DHCPDECLINE |
Address conflict detected. |
No action other than to log an event or update its statistics. |
DHCPRELEASE |
Address relinquished. |
No action. |
DHCPINFORM |
To obtain options information from the allocator without acquiring an address. |
Responds with a DHCPACK message that contains the default gateway, the DNS proxy address, both, or neither, depending upon the configuration of the allocator. |