Installing and Configuring a DHCP Server on Windows 2000/2003
Installing a DHCP server on Windows 2000 or Windows 2003 Servers is just as simple as most application
Installing the DHCP Server Service on Windows 2000 or Server 2003In this section you will learn about installing DHCP on both Windows 2000 and Windows Server 2003 server platforms. To install the server, follow these steps:
Tip
If you know from the start that a particular server will be used as a DHCP server, you can select the DHCP network component during installation of the operating system and skip the
You won't have to restart the computer to begin configuring the DHCP server.
Tip You can check to see that the DHCP service and other services are running by using the Component Services administrative tool. From the MMC tree, select Services (local) to view the services running on the local server. In the list of services that show up in the right pane of the MMC console, look for DHCP Server. Its status should be "started." Before the server can begin managing IP addresses on the network, you will have to authorize the server in the Active Directory and then configure a scope of addresses that the server can administer. Authorizing the ServerThe DHCP manager snap-in for the Microsoft Management Console utility is used to manage the DHCP service on the Windows server. For Windows 2000 click Start, Programs, Administrative Tools, DHCP. For Windows 2003 click Start, Administrative Tools, DHCP. The MMC utility pops up with the DHCP Management snap-in ready for you to use, as shown in Figure 28.2. Figure 28.2. The MMC DHCP snap-in is used to manage the DHCP service on the Windows 2000 Server.
On the left side of the management console is a tree structure that can be used to manage one or more DHCP servers from a central location. Click on the server that
After you click on the server, you'll notice that the icon to the left of the server
Figure 28.3. The DHCP server will log an error in the system event log file if it is not authorized to run on your network.
The DHCP server undergoes this rogue server detection process once each
Authorizing a server is simple:
Use the Refresh option from the Action menu to determine when the process has finished. The red arrow is
Using the MMC Action Menu
To configure a server, click once to highlight it, and then click the Action menu. The Action menu allows you to perform the following
When you first install the service, the first thing you need to do is create a scope of IP addresses that the DHCP server can use to allocate leases to its clients. After that, other options in the Action menu can be used to further configure the server. Creating an Address ScopeAfter you have authorized a server on the network, you can create a scope of addresses that the DHCP server can administer to clients. From the MMC utility, click once on the server you want to administer, and then select New Scope from the Action menu. The New Scope Wizard pops up. Alternatively, you can right-click the server and select New Scope. Click Next to dismiss the introductory dialog box and continue creating an address scope. The wizard then prompts you through the following steps:
If you did not choose to activate the scope, you can do so later by right-clicking on the scope and selecting Activate. Alternatively, click once on the scope and select Activate from the Action menu. In Figure 28.9 you can see the DHCP MMC snap-in after a scope has been created and activated. Figure 28.9. The new scope shows up in the right pane of the DHCP MMC snap-in utility.
The Status field in this display tells you whether the scope is active, and the Description field can be useful when you create multiple scopes and need a reminder of their use. After the scope has been activated, clients that boot on the network and that have been configured to use a DHCP server can now receive configuration information from this DHCP server. If you expand the scope by clicking on the plus sign in the left pane, you can see that there are four other objects that can be managed. Figure 28.10 shows the new scope with the Address Pool object selected.
Figure 28.10. You can manage addresses, leases,
|
|
1. |
Click the Next button to dismiss the wizard's opening dialog box.
|
|
2. |
In the next dialog box, give your superscope a name and click Next.
|
|
3. |
Figure 28.14 displays the current list of scopes defined on the server. Select the scopes that will fall under this superscope. Use Shift+click and Ctrl+click to select one or more scopes from the list. Click Next.
Figure 28.14. Select the scopes to include in the superscope.
|
|
4. |
Finally, the wizard shows you a summary of your superscope, including the name and the names of the scopes that make it up (see Figure 28.15). Click the Finish button.
Figure 28.15. Confirm your selections before exiting the Superscope Wizard.
|
The Windows 2000/2003 DHCP servers provide support for BOOTP clients. The Default BOOTP user class of options is used to configure the information that is supplied to these clients. Although standard BOOTP servers require that the server be configured in advance with a table of client hardware addresses and corresponding IP addresses, Windows 2000/Server 2003 DHCP servers instead select the next available address to give to a BOOTP client. This matches the method the DHCP server uses when granting IP address leases to its DHCP clients.
RFC 1542, "Clarifications and Extensions for the Bootstrap Protocol," defined support for a BOOTP relay agent. That agent now is supported by almost every router. The relay agent function enables you to support clients on different subnets using a single BOOTP or DHCP server. DHCP requests are forwarded by the router to the DHCP server, and the server's responses are returned to the client. Because BOOTP and DHCP use almost the same frame format and the same UDP ports, you'll also find that most BOOTP relay
However, on a small network, you might not have a router. Instead, you might be using the Routing and Remote Access services available in Windows 2000/2003 Servers. In that case, you'll need to add the DHCP Relay Agent protocol. Follow these steps to enable the DHCP Relay Agent:
|
1. |
Click Start, Programs, Administrative Tools (Start, Administrative Tools for 2003), and then Routing and Remote Access (for Windows Server 2003, Start, Administrative Tools, Routing and Remote Access).
|
|
2. |
In the left pane of the MMC console utility, click the plus sign to expand the server's list of objects.
|
|
3. |
Click the plus sign for IP Routing to expand the list of objects it contains.
|
|
4. |
Right-click on General, and from the menu that pops up select New Routing Protocol.
|
|
5. |
In Figure 28.16, you can see the New Routing Protocol dialog box displaying a list of available protocols. Select DHCP Relay Agent, and click OK to dismiss the dialog box. The DHCP Relay Agent protocol now shows up as an object under IP Routing.
Figure 28.16. The New Routing Protocol dialog box enables you to install the DHCP Relay Agent service.
|
|
6. |
Right-click on this new object and select Properties. In the Properties sheet for the DHCP Relay Agent, you can add the addresses of one or more DHCP servers to which BOOTP and DHCP messages will be relayed (see Figure 28.17).
|
When the relay agent receives a DHCP or BOOTP broadcast message on one of its network interfaces, which it can recognize because the packet is addressed to port 67, it will forward the message to a DHCP server. You can see an example of this in Figure 28.18. The DHCP server resides on Subnet 1 along with other servers. This subnet is connected to Subnet 2 using a routeror possibly a Windows 2000 server running the DHCP Relay Agent service.
When Workstation A on Subnet 2 boots, it broadcasts a DHCPDISCOVER message using UDP. When the router sees this broadcast, it looks at the Gateway Address field (discussed earlier in this chapter, and not to be
The DHCP server looks at the Gateway Address field. It then consults its list of scopes to determine an appropriate address based on the value of the Gateway Address field and sends a DHCPOFFER packet back to the router, which then broadcasts the packet on Subnet 2. Remember that a broadcast is necessary in this case because at this time Workstation A
If you are using Windows 2000 Advanced Server or Windows Server 2003 Enterprise or Datacenter servers, you can use the clustering feature for DHCP. This allows two separate DHCP servers to be administered as a single DHCP server. Windows 2000/2003 clustering supports a failover mode in which a service running on one computer can be
The alternative to clustering is to use two separate DHCP servers, each responsible for a portion of the address scope. This allows all your clients to get an address from one or the other server. Because leases are usually measured in days or weeks on a stable network, the loss of a single DHCP server for a few hours or a day or so might not cause you any problems unless someone decides to reboot every PC on the network. A secondary server configured with a smaller portion of the address space can continue to handle DHCP traffic while the main server is repaired.
In a larger network, however, where computers are frequently moved, a more stable DHCP service can be provided by hosting the DHCP service on a cluster.
Keep the following points in mind when using a Windows cluster for the DHCP service:
The DHCP service should be installed before the clustering service is installed on the computers.
As with most cluster installs, one server should be configured first, with the DHCP service and the clustering service, while the other cluster member-to-be is
When you're finished with the installation on the first member, power up the second and install the DHCP service and then the cluster service.
In addition, keep in mind that the cluster itself must have a unique IP address, which can't be delegated to it by a DHCP server. Additionally, you'll need to create a domain security group and make both servers members. To this group, assign Full Control permissions for the DNS zone object in the Active Directory where DHCP A and PTR records are stored for the servers' clients.
Using Windows clusters is the subject of many books. Before you decide to use a cluster on your network, I would recommend that you become intimately familiar with Windows clusters. There are many aspects of clustering (such as the utilities used to start/stop and
In a large network you need to provide for redundancy for DHCP servers. Because a larger network is typically connected using routes to join a diverse set of network segments, you will need to enable BOOTP and DHCP forwarding on any routers in the network. Each DHCP server will need to be carefully planned, and the address scopes, reservations, and exclusions will need to be
Of course, when you're planning the placement of DHCP servers in a large, routed environment, it's
Microsoft's version of DNS supports dynamic updates, as specified in RFC 2136, "Dynamic Updates in the Domain Name System (DNS UPDATE)." Windows 2000 clients can send dynamic updates after having received configuration information from a DHCP server. When a DHCP lease
To register with DNS, the client first contacts a name server. If the name server is just a local server and is not authoritative for the zone, it will return the address of the authoritative server to the client. The client then will contact the primary
The DHCP server also can be used to send dynamic updates to DNS. This is useful for pre-Windows 2000 clients that do not understand the dynamic update process. This also can be negotiated between the DHCP server and a Windows 2000 client during the initial DHCP process. This is done using a special FQDN (fully qualified domain name) DHCPREQUEST packet (using Option number 81). This packet has three possible flags that can be set:
This flag specifies that the client wants to be responsible for updating the A resource record on the DNS server, but would like for the DHCP server to update the PTR resource record.
1 This flag specifies that the client wants to perform both updates.
3 If this flag is set, the DHCP server will register both records, regardless of the client's wishes. If the server sends a packet to the client with this flag set, the client does not attempt any updates.
|
|
For more information about A and PTR records that are used in the DNS database, see Chapter 29. |
These flags are not all that controls the process of which computer
On the server side, you can specify in the properties page for the server how it will respond to dynamic update requests, and whether it will perform dynamic updates for clients that do not support this function (that is, pre-Windows 2000 clients). To configure the service for this functionality, follow these steps:
|
1. |
Click Start, Programs, Administrative Tools, DHCP (or Start, Administrative Tools, DHCP for Windows Server 2003).
|
|
2. |
In the left pane, expand the tree structure by clicking the plus sign next to the server's name to expand the tree to show the scopes that belong to the server.
|
|
3. |
Right-click the scope you want to modify, and select Properties.
|
|
4. |
When the Properties page appears, click the DNS tab. In Figure 28.19 you can see the properties found on this tab.
Figure 28.19. The DNS tab enables you to configure DHCP server behavior in regard to DNS dynamic updates.
|
|
5. |
The first check box, Automatically Update DHCP Client Information in DNS, enables you to specify this function using two options. Click either the Update DNS Only If DHCP Client Requests radio button or the Always Update DNS radio button. If you select the second button, the server will always make updates for clients, ignoring their requests.
|
|
6. |
To enable the server to handle dynamic updates for clients that do not support dynamic DNS update, select the check box Enable Updates for DNS Clients That Do Not Support Dynamic Update.
|
|
7. |
Click the Apply button, and then click the OK button to dismiss the dialog box.
|
You also can control how the client handles the dynamic DNS update function if you are using Windows 2000 clients. Remember from the preceding section that the server can override a client's request if the appropriate selection is made on the scope's DNS properties page.
Windows 2000 clients and servers, as well as Windows XP and Windows Server 2003, are already configured, by default, to send the FQDN packet with the Flags field set to zero. This means the client wants to update the A resource record and wants the server to update the PTR record. You can change this behavior by doing the following:
|
1. |
Right-click the My Network Places icon (or double-click the Network icon in the Control Panel). For Windows Server 2003, click on Start, Control Panel, Network Connections.
|
|
2. |
Right-click the icon for the network connection you want to configure. From the menu that pops up, select Properties.
|
|
3. |
Highlight Internet Protocol (TCP/IP) and click the Properties button.
|
|
4. |
Click the Advanced button, and then select the DNS tab. A properties page similar to that shown in Figure 28.20 pops up. At the bottom of the properties page, you'll notice that Register This Connection's Addresses in DNS is selected, and Use This Connection's DNS Suffix in DNS Registration is not. The second option is the default.
Figure 28.20. You can control the client's capability to dynamically update DNS from this properties page.
|
|
5. |
To disable the client from performing DNS updates, deselect the check box labeled Register This Connection's Addresses in DNS.
|
|
6. |
When finished, dismiss the properties page by clicking OK in each dialog box.
|
Some computers or other networked devices, such as routers or printers, might need to keep the same IP address all the time. For example, Microsoft very strongly suggests you be sure that your DHCP server has a static, unchanging address. There are two ways you can be sure a particular computer or device keeps the same static address. The first method is to manually configure the client using the client's software. For example, when you configure a Microsoft Windows 2000 Professional client or a Windows XP client, you can specify a static IP address (along with other network information) using the TCP/IP properties page for the client.
If you use the first method, you'll need to exclude the address you use from the address pool that you assign to a scope. If you forget this step and the address does fall within the range of a scope, eventually it will be issued to a client,
A reservation is similar to an exclusion but is used for computers or devices that do support DHCP but still require a constant, static address. You can enter a reservation for an address that falls within the address pool for a scope. The reservation is linked to the computer or device's hardware address so that when it boots and begins the process of obtaining configuration information via DHCP, it will always receive the same address.
Exclusions are created when you create the address pool as explained earlier in this chapter. To create a reservation, carry out these steps:
|
1. |
Bring up the DHCP MMC console by clicking Start, Programs, Administrative Tools, DHCP. Expand the tree in the left pane to get to the scope in which the reservation will be created.
|
|
2. |
Expand the scope and right-click Reservations.
|
|
3. |
From the menu that pops up, select New Reservation.
|
|
4. |
The New Reservation dialog box appears. Enter a descriptive name you want to use for this reservation.
|
|
5. |
Next, enter the IP address that falls within the scope but that is to be reserved.
|
|
6. |
Enter the hardware address of the computer for which this address will be reserved. For Windows NT/2000 clients, use the
ipconfig /all
command at the command prompt to get this address. For routers or other computers,
|
|
7. |
Select whether the reservation will be used for a BOOTP request, a DHCP request, or both.
|
|
8. |
Click OK to dismiss the dialog box. The reservation is complete. The address is handed out only to the device that uses the hardware address (also called the MAC address) you defined for the reservation.
|
Note in this example the reservation was made for a router. Other types of devices for which you might want to reserve addresses (or exclude if the computers are statically configured) are important servers that are mapped to specific addresses in your DNS system. Also, if you have non-Windows clients, such as Linux or Unix desktops or servers, you might want to reserve an address for them if they cannot use DHCP.
If a client is configured to use DHCP, what happens if no DHCP server is available on the network? Starting with Windows 98, Microsoft Windows clients can use Automatic Private IP Addressing (APIPA). This is not a solution for a large network. It is for use on small LANs, such as a home office with 25 or fewer network nodes.
Simply configure each client computer to use DHCP in the properties page for TCP/IP, and reboot. When the client computer realizes that no DHCP server is on the network (because it's not receiving any replies from its broadcasts), it will timeout and begin to use APIPA. The scheme in which addresses are allocated is not that complicated.
The network of addresses reserved for use by APIPA is 169.254.0.1 to 169.254.255.254, with a subnet mask of 255.255.0.0. When the client does not receive an answer from any DHCP server after a short time, it will select an address
Note
The only information that APIPA will configure for the client computer is an IP address and a subnet mask. It does not allow the client to configure other items that could be offered as options by a DHCP server. One important item to note is that APIPA does not provide the capability for the client computer to detect a default gateway. Thus, communication is limited to computers on the local LAN that all share the same 169.254.0.0 network address space. If you plan to connect your small LAN to the Internet, or to any other network using a router, you'll need to either manually configure IP addressing information on each client or configure a DHCP server that can perform this function for you.
Note that a Microsoft client that is using APIPA will periodically check the network (about every five minutes) to see whether a DHCP server has become available. If one does come online, the client will perform as any other DHCP client and obtain configuration information from the DHCP server it discovers. Some older versions of Windows, notably Windows 98, do not automatically check for DHCP servers. In such cases, after you solve the problem that caused the computer not to find the DHCP server (such as a loose or damaged network cable), restart the computer. The computer should receive a valid IP address from the DHCP server after rebooting.
Because clients randomly choose IP addresses, it is always quite possible that one computer will choose an address already in use. To solve this problem, each computer first chooses an address and then broadcasts a packet containing that IP address and waits to see whether another computer replies that the address is already in use. This is referred to as gratuitous ARP. When this occurs, a client will attempt to select an IP address up to 10 times before ending the process.
Tip
If a Windows 2000 or Windows XP client is unable to receive a valid IP address from a DHCP server, but other devices connected to the same DHCP server are working correctly, check physical connections to the network and restart the connection and then the computer. If you are still unable to make a connection, make sure the malfunctioning client's DHCP client service is running.
To check the status of a computer's DHCP client service, follow these steps:
|
1. |
Right-click My Computer and select Manage.
|
|
2. |
Click Services and Applications, Services.
|
|
3. |
Scroll down to DHCP Client. Make sure the status is listed as Started and the startup type is Automatic.
|
|
4. |
To start the service or change the startup type, double-click DHCP Client. Click Start to start the client and select Automatic as the startup type.
|
|
5. |
Click Apply, and then OK.
|
APIPA can be useful in creating a small LAN that does not need access to the Internet or another network. It can also be confusing, however, if your computers can connect to each other but not the Internet. As an alternative to using APIPA, you can assign an alternate manual IP address to computers running Windows 2000 or Windows XP. The alternate address is used if the computer is unable to connect to a DHCP server. Follow this procedure:
|
1. |
Open the properties sheet for the current network connection.
|
|
2. |
Click the General tab.
|
|
3. |
Select Internet Protocol (TCP/IP) and click Properties.
|
|
4. |
Click the Alternate Configuration tab. Select User Configured.
|
|
5. |
Enter the IP address, subnet mask, default gateway, and DNS and WINS server information for the network client. Note that the IP address must be unique for each client, but the other information is the same for each user on the network. To obtain this information, use
ipconfig /all
as discussed in Chapter 27, "Troubleshooting Tools for TCP/IP Networks."
|
|
6. |
Click OK when finished.
|
If the client is unable to connect to a DHCP server, it uses the alternate manual address instead. This can keep your network running if the DHCP server fails but a different device or server is responsible for routing traffic to other networks or the Internet.
Troubleshooting DHCP can be a complicated process. Perhaps you've forgotten to authorize the server on the network or activate a scope. Clients might be unable to locate the server. In any case, there are several things you can do to troubleshoot DHCP problems. With the client, start by using the ipconfig /all command at the command prompt to view IP configuration data. If the client shows either no address or an address of 0.0.0.0, a problem exists between the client and the server. It might be a network card, a misconfigured router, or another network component. Use the standard TCP/IP tools (that is, ping or tracert) from another client on the same subnet to the DHCP server to see whether connectivity exists. If you can't reach the DHCP server from that client, try the same tests from other clients on other subnets to help localize where in the network the problem lies.
Two other useful tools for troubleshooting are the Windows 2000 and Windows Server 2003 Event Logs and the DHCP server's own audit log file. Earlier in this chapter you saw an example of an event log entry. In the next section you'll learn how to enable the DHCP server's own logging capabilities.
Besides the records that the DHCP server records in the event log, you also can enable logging by the server to its own log file. For troubleshooting purposes, both the event log and the server's own log file can be very useful.
To manage the server's log file, follow these steps:
|
1. |
Start the DHCP MMC console.
|
|
2. |
Click once on the server you want to modify, and select Properties from the Action menu. Alternatively, right-click on the server and select Properties.
|
|
3. |
In the General tab for the properties page for the server select the check box labeled Enable DHCP Audit Logging.
|
|
4. |
Click the Advanced tab. Here you will find two fields. You can use the first field to enter the location where you want the log files to be created. The default is
%
systemroot%
\System32\dhcp
.
|
|
5. |
The second field can be used to enter the
|
|
6. |
Click OK to dismiss the properties page when you have finished viewing or modifying these fields.
|
When you enable audit logging, a new log file is created at midnight each day. Header information is written to the file and significant events are logged. The format for the filename used for log files is DhcpSrvLog. day of week . For example, a log file created on Monday morning would be named DhcpSrvLog.Mon .
Because the day of the week is used as the file extension for the log file, it should be obvious that in a week you'll have to overwrite an existing file. Indeed, this is what happens unless the file has been modified within the past 24 hours. If this happens, logging will be
The log file is a simple ASCII text file using comma-delimited fields. Each event is recorded as a single line in the file, using the fields
ID , Date , Time , Description , IP Address , Host Name , MAC Address
which are as described here:
ID
An event code to
Date The date of the event.
Time The time of the event.
Description A short description of the event.
IP Address The IP address of the client.
Host Name The hostname of the client.
MAC Address The hardware (MAC) address of the client.
The standard event IDs are as listed here:
00 The log was started.
01
The log was
02 Because of a low-disk-space condition, logging was suspended.
10 A new IP address lease was granted to a client.
11 A client renewed its lease.
12 A client released its lease.
13 An address was found to be already in use on the network.
14 The address pool has been completely used, so the server was unable to grant a lease to a client.
15
A lease was
20 An address was given to a BOOTP client.
As you can see, a significant amount of information is stored in the log files. Start your troubleshooting efforts here if you are experiencing problems with the server itself or with multiple clients. You can follow the trail of events leading up to the current problem. Again, if you are having problems with a single client, examine the event log file on the client to look for any indication that the client was unable to locate or interact with the DHCP server.