Configuring a DHCP Server

Cisco routers running Cisco IOS software provide full support for a router to act as a DHCP server. The Cisco IOS DHCP server assigns and manages IP addresses from specified address pools within the router to DHCP clients.
The steps to configure a router as a DHCP server are as follows:
Step 1. Define a range of addresses that DHCP is not to allocate. These are usually static addresses reserved for the router interface, switch management IP address, servers, and local network printers.
Step 2. Create the DHCP pool using the ip dhcp pool command.
Step 3. Configure the specifics of the pool.
A best practice is to configure excluded addresses in global configuration mode before creating the DHCP pool. This ensures that DHCP does not assign reserved addresses accidentally.
You should specify the IP addresses that the DHCP server should not assign to clients. Typically, some IP addresses belong to static network devices, such as servers or printers. DHCP should not assign these IP addresses to other devices. A best practice is to configure excluded addresses in global configuration mode before creating the DHCP pool. This ensures that DHCP does not assign reserved addresses accidentally. To exclude specific addresses, use the ip dhcp excluded-address command.
Configuring a DHCP server involves defining a pool of addresses to assign. The ip dhcp pool command creates a pool with the specified name and puts the router in DHCP configuration mode, which is identified by the Router(dhcp-config)# prompt.
This figure lists the tasks to complete the DHCP pool configuration. Some of these are optional, while others must be configured.
You must configure the available addresses and specify the subnet network number and mask of the DHCP address pool. Use the network statement to define the range of available addresses.
You should also define the default gateway or router for the clients to use with the default-router command. Typically, the gateway is the LAN interface of the router. One address is required, but you can list up to eight addresses.
The next DHCP pool commands are considered optional. For example, you can configure the IP address of the DNS server that is available to a DHCP client using the dns-server command. When configured, one address is required, but up to eight addresses can be listed.
Other parameters include configuring the duration of the DHCP lease. The default setting is one day, but you can change this by using the lease command. You can also configure a NetBIOS WINS server that is available to a Microsoft DHCP client. Usually, this would be configured in an environment that supports pre-Windows 2000 clients. Because most installations now have clients with newer Windows operating system, this parameter is usually not required.
Disabling DHCP
The DHCP service is enabled by default on versions of Cisco IOS software that support it. To disable the service, use the no service dhcp command. Use the service dhcp global configuration command to re-enable the DHCP server process. Enabling the service has no effect if the parameters are not configured.
Verifying DHCP
To illustrate how a Cisco router can be configured to provide DHCP services, refer to the figure. PC1 has not been powered up and therefore does not have an IP address.
Suppose a Router R1 has been configured with the following commands:
ip dhcp excluded-address
ip dhcp excluded-address
ip dhcp pool LAN-POOL-1
To verify the operation of DHCP, use the show ip dhcp binding command. This command displays a list of all IP address to MAC address bindings that have been provided by the DHCP service.
To verify that messages are being received or sent by the router, use the show ip dhcp server statistics command. This command displays count information regarding the number of DHCP messages that have been sent and received.
The ipconfig /all command displays the TCP/IP configured parameters on PC1. Because PC1 was connected to the network segment /24, it automatically received an IP address, DNS suffix, and default gateway from that pool. There is no DHCP interface configuration required. If a PC is connected to a network segment that has a DHCP pool available, it can obtain an IP address automatically.
ip dhcp excluded-address
ip dhcp excluded-address
ip dhcp pool LAN-POOL-2
Notice that the DHCP bindings now indicate that two hosts have been provided with IP addresses. The DHCP statistics are also reflecting the exchange of DHCP messages.
Another useful command to view multiple pools is the show ip dhcp pool command.
Configuring a DHCP Client
Typically, small broadband routers for home use, such as Linksys routers, can be configured to connect to an ISP using a DSL or cable modem. In most cases, small home routers are set to acquire an IP address automatically from their ISPs. For example, the figure shows the default WAN setup page for a Linksys WRVS4400N router. Notice that the Internet connection type is set to Automatic Configuration - DHCP. This means that when the router is connected to a cable modem, for example, it is a DHCP client and requests an IP address from the ISP.
Sometimes, Cisco routers in SOHO and branch sites have to be configured in a similar manner. The method used depends on the ISP. However, in its simplest configuration, the Ethernet interface is used to connect to a cable modem. To configure an Ethernet interface as a DHCP client, the ip address dhcp command must be configured.


Post a Comment


NBA Live Streaming. Copyright 2008 All Rights Reserved Revolution Two Church theme by Brian Gardner Converted into Blogger Template by Bloganol dot com | Distributed by Blogger Templates Blog