DHCP automatically assigns IP addresses to computers. DHCP overcomes the limitations of configuring TCP/IP manually. This lesson gives you an overview of DHCP and how it works.
After this lesson, you will be able to
Estimated lesson time: 20 minutes
DHCP is an extension of the Boot Protocol (BOOTP). BOOTP enables clients without disks to start up and automatically configure TCP/IP. DHCP centralizes and manages the allocation of TCP/IP configuration information by automatically assigning IP addresses to computers configured to use DHCP. Implementing DHCP eliminates some of the configuration problems associated with manually configuring TCP/IP.
As illustrated in Figure 11.1, each time a DHCP client starts, it requests IP addressing information from a DHCP server, including the IP address, the subnet mask, and optional values. The optional values may include a default gateway address, Domain Name System (DNS) address, and Windows Internet Name Service (WINS) server address.
Figure 11.1 How a DHCP client interacts with a DHCP server
When a DHCP server receives a request, it selects IP addressing information from a pool of addresses defined in its database and offers it to the DHCP client. If the client accepts the offer, the IP addressing information is leased to the client for a specified period of time. If there is no available IP addressing information in the pool to lease to a client, the client cannot initialize TCP/IP.
To understand why DHCP is beneficial in configuring TCP/IP on client computers, it is useful to contrast the manual method of configuring TCP/IP with the automatic method using DHCP.
Configuring TCP/IP manually means that users can easily pick a random IP address instead of getting a valid IP address from the network administrator. However, using incorrect addresses can lead to network problems that can be very difficult to trace to the source.
In addition, typing the IP address, subnet mask, or default gateway can lead to problems ranging from trouble communicating if the default gateway or subnet mask is wrong to problems associated with a duplicate IP address.
Another limitation of configuring TCP/IP manually is the administrative overhead on internetworks where computers are frequently moved from one subnet to another. For example, when a workstation is moved to a different subnet, the IP address and default gateway address must be changed for the workstation to communicate from its new location.
Using DHCP to automatically configure IP addressing information means that users no longer need to acquire IP addressing information from an administrator to configure TCP/IP. The DHCP server supplies all of the necessary configuration information to all of the DHCP clients. Using DHCP eliminates many difficult-to-trace network problems.
TCP/IP configuration parameters that can be assigned by the DHCP server include
DHCP uses a four-phase process to configure a DHCP client, as shown in Table 11.1. If a computer has multiple network adapters, the DHCP process occurs separately over each adapter. A unique IP address is assigned to each adapter in the computer. All DHCP communication is done over User Datagram Protocol (UDP) ports 67 and 68.
Most DHCP messages are sent by broadcast. For DHCP clients to communicate with a DHCP server on a remote network, the IP routers must support forwarding DHCP broadcasts. DHCP configuration phases are shown in Table 11.1.
Table 11.1 Four Phases of DHCP Client Configuration
|IP lease discover||The client initializes a limited version of TCP/IP and broadcasts a request for the location of a DHCP server and IP addressing information.|
|IP lease offer||All DHCP servers that have valid IP addressing information available send an offer to the client.|
|IP lease request||The client selects the IP addressing information from the first offer it receives and broadcasts a message requesting to lease the IP addressing information in the offer.|
|IP lease acknowledgment||The DHCP server that made the offer responds to the message, and all other DHCP servers withdraw their offers. The IP addressing information is assigned to the client and an acknowledgment is sent. The client finishes initializing and binding the TCP/IP protocol. Once the automatic configuration process is complete, the client can use all TCP/IP services and utilities for normal network communications and connectivity to other IP hosts.|
As illustrated in Figure 11.2, in the first two phases of DHCP client configuration, the client broadcasts for a DHCP server and a DHCP server offers an IP address to the client.
Figure 11.2 IP lease discover and offer
During its boot process, a client requests to lease an IP address by broadcasting a request to all DHCP servers. Because the client does not have an IP address or know the IP address of a DHCP server, it uses 0.0.0.0 as the source address and 255.255.255.255 as the destination address.
The request for a lease is sent in a DHCPDISCOVER message. This message also contains the client's hardware address and computer name so that DHCP servers know which client sent the request.
The IP lease process is used when one of the following events occurs:
All DHCP servers that receive the request and have a valid configuration for the client broadcast an offer with the following information:
A broadcast is used because the client does not yet have an IP address. As illustrated in Figure 11.3, the offer is sent as a DHCPOFFER message. The DHCP server reserves the IP address so that it will not be offered to another DHCP client. The DHCP client selects the IP address from the first offer it receives.
Figure 11.3 Sending a DHCPOFFER message
The DHCP client waits 1 second for an offer. If an offer is not received, the client is not able to initialize and it rebroadcasts the request three times (at 9-, 13-, and 16-second intervals, plus a random length of time between 0 and 1000 milliseconds). If an offer is not received after four requests, the client retries every 5 minutes.
Windows 2000-based clients can automatically configure an IP address and subnet mask if a DHCP server is unavailable at system start time. This is a new feature of Windows 2000 called Automatic Private IP Addressing (APIPA). This is useful for clients on small private networks, such as small business offices, home offices, or remote access clients. The Windows 2000 DHCP client service uses the following process to autoconfigure the client:
The DHCP client tests for an address conflict to make sure that the IP address it has chosen is not already in use on the network. If a conflict is found, the client selects another IP address. The client retries autoconfiguration for up to 10 addresses.
In the last two phases of DHCP client configuration, the client selects an offer and the DHCP server acknowledges the lease.
After the client receives an offer from at least one DHCP server, it broadcasts to all DHCP servers that it has made a selection by accepting an offer.
The broadcast is sent in a DHCPREQUEST message and includes the server identifier (IP address) of the server whose offer was accepted. All other DHCP servers then retract their offers so that their IP addresses are available for the next IP lease request.
The DHCP server with the accepted offer broadcasts a successful acknowledgment to the client in the form of a DHCPACK message. This message contains a valid lease for an IP address and possibly other configuration information. When the DHCP client receives the acknowledgment, TCP/IP is completely initialized and is considered a bound DHCP client. Once bound, the client can use TCP/IP to communicate on the internetwork.
An unsuccessful acknowledgment in the form of a DHCPNACK message is broadcast if the client is trying to lease its previous IP address and the IP address is no longer available. It is also broadcast if the IP address is invalid because the client has been physically moved to a different subnet. When the client receives an unsuccessful acknowledgment, it returns to the process of requesting an IP lease.
Before you install a DHCP server, you should identify the following:
Before you install DHCP, answer the following questions:
Follow these steps to install a DHCP server:
When Control Panel opens, double-click Add/Remove Programs, and then click Add/Remove Windows Components.
If prompted, type the full path to the Windows 2000 distribution files and click Continue. Required files will be copied to your hard disk.
It is strongly recommended that you manually configure the DHCP server computer to use a static IP address. The DHCP server cannot be a DHCP client. It must have a static IP address, subnet mask, and default gateway address.
Ipconfig is a command-line tool that displays the current configuration of the installed IP stack on a networked computer. It can display a detailed configuration report for all interfaces, including any configured wide area network (WAN) miniports, such as those used for remote access or virtual private network (VPN) connections. A sample report is illustrated in Figure 11.4.
Figure 11.4 Report displayed for Ipconfig /all
The Ipconfig command is of particular use on systems running DHCP, as it allows users to determine which TCP/IP configuration values have been configured by DHCP. Table 11.2 explains the switches used with the Ipconfig command.
Table 11.2 Ipconfig Command-Line Switches
|/all||Produces a detailed configuration report for all interfaces|
|/flushdns||Removes all entries from the DNS name cache|
|/registerdns||The DNS domain name for client resolutions|
|/displaydns||Displays the contents of the DNS resolver cache|
|/release <adapter>||Releases the IP address for a specified interface|
|/renew <adapter>||Renews the IP address for a specified interface|
|/showclassid <adapter>||Displays all the DHCP class IDs allowed for the adapter specified|
|/setclassid <adapter> <classID to set>||Changes the DHCP class ID for the adapter specified|
|/?||Displays the items in this table|
Output can be redirected to a file and pasted into other documents.
Follow these steps to verify, release, or renew a client address lease:
The Ipconfig utility is also supported for use in Windows NT 4.0 Server. For Windows 95 and Windows 98 clients, use Winipcfg, which is the Windows IP configuration program, to perform these tasks. To run Winipcfg on supporting clients, type winipcfg at either an MS-DOS command prompt or in the Run command window. When using Winipcfg to release or renew leases, click Release or Renew to perform these respective tasks.
A relay agent is a small program that relays DHCP/BOOTP messages between clients and servers on different subnets. The DHCP Relay Agent component provided with the Windows 2000 router is a BOOTP relay agent that relays DHCP messages between DHCP clients and DHCP servers on different IP networks. For each IP network segment that contains DHCP clients, either a DHCP server or a computer acting as a DHCP relay agent is required.
Follow these steps to add the DHCP Relay Agent:
DHCP was developed to solve configuration problems by centralizing IP configuration information for allocation to clients. DHCP uses a four-phase process to configure a DHCP client. The phases are: lease discover, lease offer, lease request, and lease acknowledgment. In addition to verifying a computer's IP configuration, you can use the Ipconfig utility to renew options, lease time, and relinquish a lease.