How to configure a Cisco Catalyst 6500 switch as a DHCP server
Dynamic Host Control Protocol (DHCP) enables the automatic assignment of reusable IP addresses to DHCP clients. The Cisco IOS DHCP server feature is a full DHCP server implementation. This feature assigns and manages IP addresses from specified address pools within the router to DHCP clients. If the Cisco IOS DHCP server cannot satisfy a DHCP request from its own database, the Cisco IOS DHCP server can forward the request to one or more secondary DHCP servers that the network administrator defines.
DHCP supports these three mechanisms for IP address allocation:
Automatic allocation. DHCP assigns a permanent IP address to a client.
Dynamic allocation. DHCP assigns an IP address to a client for a limited period or until the client explicitly relinquishes the address.
Manual allocation. DHCP simply conveys to the client the IP address that the network administrator assigns.
Note: A DHCP client can receive offers from multiple DHCP servers and can accept any one of the offers. However, the client usually accepts the first offer received. Additionally, the offer from the DHCP server is not a guarantee for the allocation of the IP address to the client. However, the server usually reserves the address until the client has a chance to formally request the address.
By default, the DHCP server is enabled but doesn't appear on "show run". If DHCP services are not required, it should be disabled using command "no service dhcp". This rule excludes devices using "ip dhcp pool", "ip helper-address", or "ip dhcp snooping" in their configurations.
The DHCP server database is organized as a tree. The root of the tree is the address pool for natural networks. The branches of the tree are subnetwork address pools. The leaves of the tree are manual bindings to clients.
Subnetworks inherit network parameters, and clients inherit subnetwork parameters. Therefore, configure common parameters, such as the domain name, at the highest level of the tree. The highest level is the network or subnetwork.
To configure the Cisco IOS DHCP server feature, first configure a database agent or disable conflict logging. Then configure these parameters:
IP addresses that the DHCP server must not assign to requesting clients. These are called excluded addresses.
IP addresses that the DHCP server must assign to requesting clients. These addresses include a pool of available IP addresses.
There are some required tasks and some optional tasks for the configuration of the Cisco IOS DHCP server feature:
These are the required tasks:
Configure a DHCP database agent or disable DHCP conflict logging.
Exclude IP addresses.
Configure a DHCP address pool.
These are the optional tasks:
Configure manual bindings
Configure a DHCP server boot file
Configure the number of ping packets
Configure the timeout value for ping packets
Enable the Cisco IOS DHCP server feature
DHCP can be configured on the MSFC as on any Cisco IOS Software running router (12.1 and later).
Configuring a DHCP Database Agent or Disabling DHCP Conflict Logging
A DHCP database agent is any host, for example, an FTP, TFTP, or RCP server that stores the DHCP bindings database. You can configure multiple DHCP database agents and you can configure the interval between database updates and transfers for each agent. To configure a database agent and database agent parameters, use the following command in global configuration mode:
Router(config)# ip dhcp database url[timeout seconds | write-delayseconds]
Configures the database agent and the interval between database updates and database transfers.
If you choose not to configure a DHCP database agent, disable the recording of DHCP address conflicts on the DHCP server. To disable DHCP address conflict logging, use the following command in global configuration mode:
Router(config)# no ip dhcp conflict logging
Disables DHCP address conflict logging.
Excluding IP Addresses
The DHCP server assumes that all IP addresses in a DHCP address pool subnet are available for assigning to DHCP clients. You must specify the IP address that the DHCP server should not assign to clients. To do so, use the following command in global configuration mode:
Router(config)# ip dhcp excluded-addresslow-address [high-address]
Specifies the IP addresses that the DHCP server should not assign to DHCP clients.
Configuring a DHCP Address Pool
You can configure a DHCP address pool with a name that is a symbolic string (such as "engineering") or an integer (such as 0). Configuring a DHCP address pool also places you in DHCP pool configuration mode—identified by the (config-dhcp)# prompt—from which you can configure pool parameters (for example, the IP subnet number and default router list). To configure a DHCP address pool, complete the required tasks in the following sections.
Configuring the DHCP Address Pool Name and Entering DHCP Pool Configuration Mode
To configure the DHCP address pool name and enter DHCP pool configuration mode, use the following command in global configuration mode:
Router(config)#ip dhcp poolname
Creates a name for the DHCP server address pool and places you in DHCP pool configuration mode (identified by the config-dhcp# prompt).
Configuring the DHCP Address Pool Subnet and Mask
To configure a subnet and mask for the newly created DHCP address pool, which contains the range of available IP addresses that the DHCP server may assign to clients, use the following command in DHCP pool configuration mode:
Specifies the subnet network number and mask of the DHCP address pool.The prefix length specifies the number of bits that comprise the address prefix. The prefix is an alternative way of specifying the network mask of the client. The prefix length must be preceded by a forward slash (/).
Note You can not configure manual bindings within the same pool that is configured with the network command. To configure manual bindings, see the "Configuring Manual Bindings" section.
Configuring the Domain Name for the Client
The domain name of a DHCP client places the client in the general grouping of networks that make up the domain. To configure a domain name string for the client, use the following command in DHCP pool configuration mode:
Router(config-dhcp)# domain-name domain
Specifies the domain name for the client.
Configuring the Domain Name System IP Servers for the Client
DHCP clients query DNS IP servers when they need to correlate host names to IP addresses. To configure the DNS IP servers that are available to a DHCP client, use the following command in DHCP pool configuration mode:
Specifies the IP address of a DNS server that is available to a DHCP client. One IP address is required; however, you can specify up to eight IP addresses in one command line.
Configuring the NetBIOS Windows Internet Naming Service IP Servers for the Client
Windows Internet Naming Service (WINS) is a name resolution service that Microsoft DHCP clients use to correlate host names to IP addresses within a general grouping of networks. To configure the NetBIOS WINS servers that are available to a Microsoft DHCP client, use the following command in DHCP pool configuration mode:
Specifies the NetBIOS WINS server that is available to a Microsoft DHCP client. One address is required; however, you can specify up to eight addresses in one command line.
Configuring the NetBIOS Node Type for the Client
The NetBIOS node type for Microsoft DHCP clients can be one of four settings: broadcast, peer-to-peer, mixed, or hybrid. To configure the NetBIOS node type for a Microsoft DHCP, use the following command in DHCP pool configuration mode:
Specifies the NetBIOS node type for a Microsoft DHCP client.
Configuring the Default Router for the Client
After a DHCP client has booted, the client begins sending packets to its default router. The IP address of the default router should be on the same subnet as the client. To configure a default router for a DHCP client, use the following command in DHCP pool configuration mode:
Specifies the IP address of the default router for a DHCP client. One IP address is required, although you can specify up to eight addresses in one command line.
Configuring the Address Lease Time
By default, each IP address assigned by a DHCP server comes with a one-day lease, which is the amount of time that the address is valid. To change the lease value for an IP address, use the following command in DHCP pool configuration mode:
Specifies the duration of the lease. The default is a a one-day lease.
no ip dhcp conflict logging ip dhcp excluded-address 10.67.56.1 ip dhcp pool MYPOOL network 10.67.56.0 255.255.255.0 default-router 10.67.56.1 ! interface Vlan56 ip address 10.67.56.1 255.255.255.0
This is a basic configuration. The PCs need a default gateway in order for routing to work, which is arbitrarily chosen to be 10.67.56.1. This address should not be given out to any hosts. It should be excluded from the pool.
There are many more advanced options that you can use, such as lease times, Domain Name System (DNS) or NetBIOS settings.