DHCP is a service that provides automatic IP addressing for TCP/IP
clients. The clients must be configured for dynamic IP addressing
in order to take advantage of DHCP. You Install DHCP on a NT 4.0
server by opening Control Panel, Network, Services, click "Add",
then choose Microsoft DHCP Server. You will have to reboot your
Server, and you should probably re-apply your current Service Pack.
Once you've done the above, click Start, Programs, Administrative
Tools, DHCP Manager.
Terms:
Scope - A scope is a range of IP addresses
that will be handed out to clients (Hosts).
Lease - The amount of time a DHCP client (host) retains it
current IP address. Once the lease period is up, the DHCP client
requests a new IP address. The DHCP client remembers how long
it's lease is for once it obtains an address from a DHCP server.
Rebooting the PC or turning it off will not affect this.
DHCP Client - any machine on your network that is configured
to get it's IP address configuration from a DHCP server.
Host - any machine on your network that uses TCP/IP.
Configuring DHCP:
1. The first thing you need to configure
is a Scope. Open the DHCP Manager and double click "Local
Machine" (the little plus sign to the left will change to a
minus sign) and click Scope, Create. Enter the IP address range
you want to use for a particular subnet in Start and End Addresses.
Enter the Subnet Mask for the subnet, and then you can enter any
addresses in your range that you want to exclude from being assigned
to DHCP clients. These addresses should be for DNS, WINS,
DHCP, Web servers, PDCs, BDCs, Member servers, Router Interfaces,
Firewalls, and so on that are in the subnet, and should always have
a static IP address.
Note: Instead of entering an Exclusion
Range of IP Address, you can click Scope, Add Reservations. This
dialog box will allow you to create a list of devices whose IP addresses
will not be included in the available IP address pool. For
a Unique Identifier use the MAC address of the network cards (NICs).
However… If you set a range of Excluded Addresses, you cannot
add any of these addresses to the Reservation list. IP reservations
may be a better way of preventing a statically assigned IP address
from being leased to a DHCP client, but… if you replace a NIC
in a machine, you have to remember to update your DHCP reservations
to reflect the new MAC address.
Also, instead of using IP address reservations
or an exclusion range, just don't include, in the address pool,
those IP address you want to keep as static. Those addresses
have to be a range of addresses at the beginning or end of your
IP address range. For example: If your subnet was 10.90.10.1 to
10.90.10.254, with a subnet mask of 255.255.255.0, you could assign
the first 15 addresses as static addresses for servers, routers,
firewalls and so on, and in your IP address pool, in the DHCP Manager,
you would enter 10.90.10.16 to 10.90.10.254 as your start and end
addresses. That way 10.90.10.1 to 10.90.10.15 would never
be dynamically assigned.
Finally, you can enter individual IP addresses
in the Excluded Addresses. Just enter the address in the Start
Address then click Add.
2. Once you've set up your IP address
pool set the Lease Duration. This is the amount of time that
your DHCP clients will keep their IP address before requesting a
new one. 7 days is a good time to set.
3. It is also a good idea to enter a name and or comments
for each scope you create.
4. Next you want to set up your
IP addresses for DNS servers, WINS servers, Default Gateway and
various other options. Do this by clicking DHCP_Options. If
you want the options available for individual subnets, make sure
the subnet to be configured is selected then click Scope. If
the options you want to set are for all your subnets, then click
Global. You can have both local and global options set. Just
make sure they don't conflict.
Scroll through the list of "Unused Options" and find the
options you want to configure.
Select an option and click Add to add it to the "Active Options".
Click the "Value" button to display the field where
you enter information for that option.
For options that require IP addresses, a button called "Edit
Array" will appear when clicking "Value". Click this
button to open a dialog box that allows you to add IP addresses
for that option.
You should configure your DNS servers, WINS servers, Domain Name
(this is not your NT Domain name, it is a DNS domain name, like
mycompany.com) and Default Gateway. Default Gateway is called
"Router" in the list of options.
Note: If you set WINS NBNS Server, you also need to set WINS
NBT Node Type.
Set WINS NBT Node Type to 0x8.
5. Your DHCP server is now ready
to be used. You might have to reboot the DHCP server for your
hosts to get their IP configuration. You shouldn't have to,
but if your DHCP clients are not getting their IP configuration,
reboot the DHCP server. Just configure your clients to use
DHCP and they should get their IP address configuration.
Note: In order to see information under "Option Configuration",
you might have to close the DHCP Manager and re-open it.
How DHCP Works:
1. A DHCP client broadcasts a request
for an IP address. This is called a DHCPDISCOVER. This is
a UDP datagram not a TCP datagram.
2. The DHCP servers that get the request respond with
a DHCPOFFER of an IP address and lease time.
3. The DHCP client chooses a server (usually the first
to respond) and responds with a DHCPREQUEST to confirm the offer.
4. The DHCP Server then responds with a DHCPACK acknowledging
the request, and issues the IP configuration to the client.
5. When the client gets it's IP address it sends out
an ARP request on it's subnet to see if any other devices are using
it's IP address. If they are, the client sends a DHCP_DECLINE
to the DHCP server. The DHCP server then records this address as
being bad (it is stored in the Reserved Address with a machine name
of BAD_ADDRESS) and does not re-issue it. It sends a new address
to the client. On Win9x PCs, if they receive 2 bad addresses,
they give up trying to get one. Service Pack 4 fixes this
on WinNT computers. They will try more than 2 times.
6. When the DHCP lease is half over the client starts
sending out A DHCP request to the originating server. The
DHCP server responds with a DHCPACK, which updates the DHCP client's
IP configuration. A new IP address in not given unless the
lease has expired.
If the originating DHCP server does not respond to the request,
the client sends out a request every 2 minutes until 87.5% of the
lease has expired. If there is still no response, the client
sends out a DHCPDISCOVER to start the process all over.
DHCP Broadcasts can traverse routers.
Normally routers block broadcasts, but in the case of DHCP, this
is accomplished by allowing BOOTP or RFC 1542 broadcasts to pass
through the router(s). You can configure a router to allow this
type of broadcast.
If your routers don't support BOOTP broadcasts
you can configure the NT DHCP Relay Agent…Control Panel, Network,
Protocols, TCP/IP Protocol, Properties, DHCP Relay. The Relay
Agent can be configured with the IP address(es) of a DHCP server(s)
and sends any broadcasts it receives on it's subnet to the DHCP
server.
Note:
- You should have only one DHCP Relay Agent per subnet.
- Do Not configure the DHCP Relay Agent on a server acting as a
DHCP server.
If you do, the DHCP server will send all DHCP requests to another
server and will
not issue IP addresses.
DHCP servers across routers know what subnet
a DHCP request came from. The router that forwards the request
adds information to the request saying what subnet the request came
from. A DHCP server will only issue IP addresses for the subnets
it is configured for.
Backing up a DHCP Server:
NT, by default, backs up the DHCP database every
60 mins. You can tell NT how often to make a backup of your
DHCP server in the registry.
The minimum is 5 minutes, the maximum is 60 minutes.
HKEY_LOCAL_MACHINE\System\CurrentControlSet\services\DHCPServer\Parameters
A value called Backupinterval of type REG_DWORD is where you set
the time.
Three files make up the DHCP database:
DHCP.MDB
DHCP.PAT
A log file named something like j5001F47.log
They are located in \winnt\system32\DHCP
NT backs these files up in \winnt\system32\DHCP\backup\jet\new.
Additionally, the DHCP log files are stored in \winnt\system32\DHCP.
If you make a backup of the \winnt\system32\DHCP\backup directory
you will have all the information for your DHCP server. You
can backup these files manually on a regular basis so you have them
if your DHCP server needs to be reinstalled.
In the \winnt\system32\DHCP\backup directory there is a file called
dhcpcfg. This is a registry file has all the configuration
options you set in the DHCP Manager. It needs to be backed
up too.
Restoring a DHCP Server:
If you need to reinstall the DHCP Server on a
NT box make sure you keep a copy of
\winnt\system32\DHCP\ before removing and reinstalling. WinNT
will not recreate this directory if you remove and reinstall the
DHCP Server. Once you remove and reinstall the DHCP Server,
copy that directory back to winnt\system32 before rebooting. You
can delete the contents of the directories, but make sure you have
the directories or you will get DR. Watson errors, and DHCP will
not start.
Restoring DHCP on a new server:
1. Install the DHCP Server service,
install your latest service pack, then reboot.
2. Open up services, and stop the Microsoft DHCP Server.
3. Restore the three files (DHCP.MDB, DHCP.PAT, j5001F47.log)
to\winnt\system32\DHCP
4. Open regedt32.exe, go to:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\services\DHCPServer
highlight the Configuration key, click Registry then Restore. Navigate
to the
registry file you have saved (dhcpcfg) and restore it to the registry.
5. Start the DHCP Server service
6. Open the DHCP Manager, click the Scope menu, Active
Leases, click Reconcile,
click OK. This will restore the leases your old DHCP server
had so you will
not be getting error messages from your client PCs about their IP
addresses.
Other Info:
- DHCP (and BOOTP) use UDP ports 67 and 68
- You can configure multiple DHCP server on the
same subnet as long as they all have contiguous scopes from the
same subnet and the scopes do not overlap. That way more than
one server is available should one go down.
- Service Pack 4 corrects many problems with
NT DHCP Server. If you are using a NT DHCP server, you should
have at a minimum, SP4.
- To enable logging for your DHCP server, select
Local Machine, click Server, Properties. On the General tab
you can set up logging and tell the DHCP server to ping an IP address
before issuing it.
- Error Messages for DHCP can be found in the
Event Viewer, Application log.
|