THE SCHOOL OF CISCO NETWORKING (SCN): CISCO - CONFIGURE DHCP SERVER ON A CISCO ROUTE:
Contact No:   ### / ###/ ###
Welcome To The IT Knowledge Base Sharing Freeway "Study With The Zero Fees / Zero Money" Web - If We Believe, That If We Have Knowledge, Let Others Light Their Candles With It. - Our Motivation Has Brought Us Together To Offer Our Helping Hands To The Needy Ones Please. "Student Expectations And Satisfaction Is Always Our Highest Priority")

'Love All, Serve All, Help Ever Hurt Never'

Please Welcome To The "Zero Fees And Zero Money SCN Community Study Page"

We Like To Share Our Stuff With Everyone And Hope You Will Find Something Useful Here. Enjoy Our Collection And Come Back Again And Again, We'll Do Our Best To Make It Always Interesting For You. All Our Stuff Always Available May Be 100% Totally Freely. Use Only For Non-Commercial Purposes Only!

THE SCHOOL OF CISCO NETWORKING (SCN) Is A IT Support Community – Based, Non - Profit Volunteer Organizations, Offering Our Assistance And Support To Developmental Our Services Dedicated To All.

Because Large Section Of Our Students In This World, Especially In Villages, Who Are Under Privileged Expecting For Equal Opportunity In Terms Of Money And Education. We Feel The Sufferings Of Talented Students Losing Their Opportunity To Shine Because Of Their Poor Financial Status. So We Thought That Professional Education Will Be Providing Them Freely.

Our Web Site Is To Give An Easy Way To Understand Each And Every Student Who Are Going To Start CISCO Lab Practice Without Any Doubts And Our ARTICLES STUFF Are Always 100% Totally Free For Everyone, Which Is Belongings To THE SCHOOL OF CISCO NETWORKING (SCN).

Also This Guide Provides Technical Guidance Intended To Help All Network Students, Network Administrators And Security Officers Improve Of Their Demonstrated Ability To Achieve Specific objectives Within Set Timeframes.

Hands - On Experience Is An Invaluable Part Of Preparing For The Lab Exam And Never Pass Up An Opportunity To Configure Or Troubleshoot A Router ( If You Have Access To Lab Facilities, Take Full Advantage Of Them) There Is No Replacement For The Experience You Can Gain From Working In A Lab, Where You Can Configure Whatever You Want To Configure And Introduce Whatever Problems You Want To Introduce, Without Risk Of Disrupting A Production Network.

For Better View Of Our Web Page - Please Use Any Latest Web Browser, Such As (Mozilla Firefox, Google Chrome, Opera, Safari, Internet Explorer, Torch, Maxthon, Sea Monkey, Avant Browser, Deepnet Explorer, And Etc ), Because Some Elements Or Scripts Are Not Work In The Old Web Browser (It Might Not Be Displayed Properly Or Are Not Appearing properly!). Thank You For Your Time And Best Of Luck!

Your Sincerely – Premakumar Thevathasan.
"Our Motivation Has Brought Us Together To Offer Our Helping Hands To The Needy Once Please,Thank You."

CISCO - CONFIGURE DHCP SERVER ON A CISCO ROUTE:

DHCP is a protocol that enables you to automatically assign reusable IP addresses to clients. Cisco IOS DHCP server is a full DHCP server implementation that assigns and manages IP addresses from specified address pools within the router to DHCP hosts.
 FIRST KNOW WHAT IS DSCP:
The Dynamic Host Configuration Protocol (DHCP) is an auto configuration protocol used on IP networks. Computers that are connected to IP networks must be configured before they can communicate with other computers on the network. DHCP allows a computer to be configured automatically, eliminating the need for intervention by a network administrator. It also provides a central database for keeping track of computers that have been connected to the network. This prevents two computers from accidentally being configured with the same IP address.

In the absence of DHCP, hosts may be manually configured with an IP address. Alternatively IPv6 hosts may use stateless address autoconfiguration to generate an IP address. IPv4 hosts may use link-local addressing to achieve limited local connectivity.

In addition to IP addresses, DHCP also provides other configuration information, particularly the IP addresses of local caching DNS resolvers. Hosts that do not use DHCP for address configuration may still use it to obtain other configuration information.

There are two versions of DHCP, one for IPv4 and one for IPv6. While both versions bear the same name and perform much the same purpose, the details of the protocol for IPv4 and IPv6 are sufficiently different that they can be considered separate protocols.

Dynamic Host Configuration Protocol automates network-parameter assignment to network devices from one or more DHCP servers. Even in small networks, DHCP is useful because it makes it easy to add new machines to the network.
When a DHCP-configured client (a computer or any other network-aware device) connects to a network, the DHCP client sends a broadcast query requesting necessary information from a DHCP server.

The DHCP server manages a pool of IP addresses and information about client configuration parameters such as default gateway, domain name, the name servers, other servers such as time servers, and so forth. On receiving a valid request, the server assigns the computer an IP address, a lease (length of time the allocation is valid), and other IP configuration parameters, such as the subnet mask and the default gateway. The query is typically initiated immediately after booting, and must complete before the client can initiate IP-based communication with other hosts.

CISCO IOS DHCP SERVER:

Dynamic Host Control Protocol (DHCP) enables you to automatically assign reusable IP addresses to DHCP clients. The Cisco IOS DHCP Server feature is a full DHCP server implementation that 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, it can forward the request to one or more secondary DHCP servers defined by the network administrator.
DHCP provides configuration parameters to Internet hosts. DHCP consists of two components: a protocol for delivering host-specific configuration parameters from a DHCP Server to a host and a mechanism for allocating network addresses to hosts. DHCP is built on a client/server model, where designated DHCP Server hosts allocate network addresses and deliver configuration parameters to dynamically configured hosts. By default, Cisco routers running Cisco IOS software include DHCP server and relay agent software.

The format of DHCP messages is based on the format of Bootstrap Protocol (BOOTP) messages, which ensures support for BOOTP relay agent functionality and interoperability between BOOTP clients and DHCP Servers. BOOTP relay agents eliminate the need for deploying a DHCP Server on each physical network segment. BOOTP is explained in RFC 951, Bootstrap Protocol (BOOTP), and RFC 1542, Clarifications and Extensions for the Bootstrap Protocol.

DHCP SUPPORTS 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 of time (or until the client explicitly relinquishes the address).

Manual allocation—The network administrator assigns an IP address to a client and DHCP is used simply to convey the assigned address to the client.

  • DYNAMIC ALLOCATION: A network administrator assigns a range of IP addresses to DHCP, and each client computer on the LAN is configured to request an IP address from the DHCP server during network initialization. The request-and-grant process uses a lease concept with a controllable time period, allowing the DHCP server to reclaim (and then reallocate) IP addresses that are not renewed.
  • AUTOMATIC ALLOCATION: The DHCP server permanently assigns a free IP address to a requesting client from the range defined by the administrator. This is like dynamic allocation, but the DHCP server keeps a table of past IP address assignments, so that it can preferentially assign to a client the same IP address that the client previously had. 
  •  STATIC ALLOCATION: The DHCP server allocates an IP address based on a table with MAC address/IP address pairs, which are manually filled in (perhaps by a network administrator). Only requesting clients with a MAC address listed in this table will be allocated an IP address. This feature (which is not supported by all DHCP servers) is variously called Static DHCP Assignment (by DD-WRT), fixed-address (by the dhcpd documentation), Address Reservation (by Netgear), DHCP reservation or Static DHCP (by Cisco/Linksys), and IP reservation or MAC/IP binding (by various other router manufacturers).
FIGURE - 1 DHCP  
Figure 1 shows the basic steps that occur when a DHCP client requests an IP address from a DHCP server. The client, Host A, sends a DHCPDISCOVER broadcast message to locate a Cisco IOS DHCP Server. A DHCP server offers configuration parameters (such as an IP address, a MAC address, a domain name, and a lease for the IP address) to the client in a DHSCPOFFER unicast message.

Note: A DHCP client may receive offers from multiple DHCP servers and can accept any one of the offers; however, the client usually accepts the first offer it receives. Additionally, the offer from the DHCP server is not a guarantee that the IP address will be allocated to the client; however, the server usually reserves the address until the client has had a chance to formally request the address.

The client returns a formal request for the offered IP address to the DHCP server in a DHCPREQUEST broadcast message. The DHCP server confirms that the IP address has been allocated to the client by returning a DHCPACK unicast message to the client oteThe formal request for the offered IP address (the DHCPREQUEST message) that is sent by the client is broadcast so that all other DHCP servers that received the DHCPDISCOVER broadcast message from the client can reclaim the IP addresses that they offered to the client.If the configuration parameters sent to the client in the DHCPOFFER unicast message by the DHCP server are invalid (a misconfiguration error exists), the client returns a DHCPDECLINE broadcast message to the DHCP server.

The DHCP server will send to the client a DHCPNAK denial broadcast message, which means the offered configuration parameters have not been assigned, if an error has occurred during the negotiation of the parameters or the client has been slow in responding to the DHCPOFFER message (the DHCP server assigned the parameters to another client) of the DHCP server.
BENEFITS FOR DHCP:

The Cisco IOS DHCP Server feature offers the following benefits:

REDUCED INTERNET ACCESS COSTS: Using automatic IP address assignment at each remote site substantially reduces Internet access costs. Static IP addresses are considerably more expensive to purchase than are automatically allocated IP addresses.

REDUCED CLIENT CONfiGURATION TASKS AND COSTS:Because DHCP is easy to configure, it minimizes operational overhead and costs associated with  device configuration tasks and eases deployment by nontechnical users.

CENTRALIZED MANAGEMENT: Because the DHCP server maintains configurations for several subnets, an administrator only needs to update a single, central server when configuration parameters change.

DHCP OFFER:

When a DHCP server receives an IP lease request from a client, it reserves an IP address for the client and extends an IP lease offer by sending a DHCPOFFER message to the client. This message contains the client's MAC address, the IP address that the server is offering, the subnet mask, the lease duration, and the IP address of the DHCP server making the offer.

DHCP REQUEST:

A client can receive DHCP offers from multiple servers, but it will accept only one DHCP offer and broadcast a DHCP request message. Based on the Transaction ID field in the request, servers are informed whose offer the client has accepted. When other DHCP servers receive this message, they withdraw any offers that they might have made to the client and return the offered address to the pool of available addresses. 

The DHCP request message is broadcast, instead of being unicast to a particular DHCP server, because the DHCP client has still not received an IP address. Also, this way one message can let all other DHCP servers know that another server will be supplying the IP address without missing any of the servers with a series of unicast messages

 DHCP ACKNOWLEDGEMENT:

When the DHCP server receives the DHCPREQUEST message from the client, the configuration process enters its final phase. The acknowledgement phase involves sending a DHCPACK packet to the client. This packet includes the lease duration and any other configuration information that the client might have requested. At this point, the IP configuration process is completed.

DHCP INFORMATION:

A DHCP client may request more information than the server sent with the original DHCPOFFER. The client may also request repeat data for a particular application. For example, browsers use DHCP Inform to obtain web proxy settings via WPAD. Such queries do not cause the DHCP server to refresh the IP expiry time in its database.

DHCP RELEASING:

The client sends a request to the DHCP server to release the DHCP information and the client deactivates its IP address. As client devices usually do not know when users may unplug them from the network, the protocol does not mandate the sending of DHCP Release.

DHCP RELIABILITY:

The DHCP protocol provides reliability in several ways: periodic renewal, rebinding, and failover. DHCP clients are allocated leases that last for some period of time. Clients begin to attempt to renew their leases once half the lease interval has expired. They do this by sending a unicast DHCPREQUEST message to the DHCP server that granted the original lease. If that server is down or unreachable, it will fail to respond to the DHCPREQUEST. However, the DHCPREQUEST will be repeated by the client from time to time, so when the DHCP server comes back up or becomes reachable again, the DHCP client will succeed in contacting it, and renew its lease.

If the DHCP server is unreachable for an extended period of time, The DHCP client will attempt to rebind, by broadcasting its DHCPREQUEST rather than unicasting it. Because it is broadcast, the DHCPREQUEST message will reach all available DHCP servers. If some other DHCP server is able to renew the lease, it will do so at this time.

DHCP SERVER OVERVIEW:

The Cisco IOS DHCP Server feature is a full DHCP Server implementation that 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, it can forward the request to one or more secondary DHCP Servers defined by the network administrator.
The adaptive security appliance can provide a DHCP server or DHCP relay services to DHCP clients attached to adaptive security appliance interfaces. The DHCP server provides network configuration parameters directly to DHCP clients. DHCP relay passes DHCP requests received on one interface to an external DHCP server located behind a different interface.
HOW TO ENABLING THE CISCO IOS DHCP SERVER AND RELAY AGENT FEATURES:
By default, the Cisco IOS DHCP server and relay agent features are enabled on your router. To reenable these features if they are disabled, use the following command in global configuration mode:

DHCP PREREQUISITES:

BEFORE YOU CONFIGURE THE CISCO IOS DHCP SERVER FEATURE, COMPLETE THE FOLLOWING TASKS:

# Identify an external File Transport Protocol (FTP), Trivial File Transfer Protocol (TFTP), or remote copy protocol (rcp) server that you will use to store the DHCP bindings database  

# Identify the IP addresses that you will enable the DHCP server to assign, and the IP addresses that you will exclude.

# Identify DHCP options for devices where necessary, including:
  
# Default boot image name  

# Default router(s) 

# Domain Name System (DNS) server(s)
#  NetBIOS name server  

# Decide on a NetBIOS node type (b, p, m, or h).

# Decide on a DNS domain name.

DHCP CONFIGURATION TASK LIST:

The DHCP server database is organized as a tree. The root of the tree is the address pool for natural networks, branches are subnetwork address pools, and leaves are manual bindings to clients.
 
DHCP STEPS AS FOLLOW:

ENABLING THE CISCO IOS DHCP SERVER AND RELAY AGENT FEATURES:

By default, the Cisco IOS DHCP server and relay agent features are enabled on your router. To reenable these features if they are disabled, use the following command in global configuration mode:

Command
Purpose
Router(config)# service dhcp
Enables the Cisco IOS DHCP server and relay features on your router.
Use the no form of this command to disable the Cisco IOS DHCP server and relay features.

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:

Command 
Purpose
Router(config)# ip dhcp database url [timeout seconds | write-delay seconds]
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:

Command
Purpose
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:

Command
Purpose
Router(config)# ip dhcp excluded-address low-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 (dhcp-config)# 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:

Command
Purpose
Router(config)# ip dhcp pool name
Creates a name for the DHCP Server address pool and places you in DHCP pool configuration mode (identified by the dhcp-config# 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:

Command
Purpose
Router(dhcp-config)# network network-number [mask | /prefix-length]
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,

CONFIGURING THE DOMAIN NAME FOR THE CLIENT:

The domain name for 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:
Command
Purpose
Router(dhcp-config)# domain-name domain
Specifies the domain name for the client.

CONFIGURING THE IP DOMAIN NAME SYSTEM 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:

Command
Purpose
Router(dhcp-config)# dns-server address [address2 ... address8]
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 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:

Command
Purpose
Router(dhcp-config)# netbios-name-server address [address2 ... address8]
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:

Command
Purpose
Router(dhcp-config)# netbios-node-type type
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 specify a default router for a DHCP client, use the following command in DHCP pool configuration mode:

Command
Purpose
Router(dhcp-config)# default-router address [address2 ... address8]
Specifies the IP address of the default router for a DHCP client. One IP address is required; however, 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:

Command
Purpose
Router(dhcp-config)# lease {days [hours][minutes] | infinite}
Specifies the duration of the lease. The default is a one-day lease.
Use the show ip dhcp binding to display the lease expiration time and date of the IP address of the host.

CONFIGURING MANUAL BINDINGS :

An address binding is a mapping between the IP address and MAC address of a client. The IP address of a client can be assigned manually by an administrator or assigned automatically from a pool by a DHCP server.
Manual bindings are IP addresses that have been manually mapped to the MAC addresses of hosts that are found in the DHCP database. Manual bindings are stored in NVRAM on the DHCP server. Manual bindings are just special address pools. There is no limit on the number of manual bindings, but you can only configure one manual binding per host pool.

Automatic bindings are IP addresses that have been automatically mapped to the MAC addresses of hosts that are found in the DHCP database. Automatic bindings are stored on a remote host called a database agent. The bindings are saved as text records for easy maintenance.

All DHCP clients send a client identifier in the DHCP packet. To configure manual bindings, you must enter the client-identifier DHCP pool configuration command with the appropriate hexadecimal values identifying the DHCP client.

TO CONFIGURE A MANUAL BINDING, FIRST CREATE A HOST POOL, THEN SPECIFY THE IP ADDRESS OF THE CLIENT AND CLIENT IDENTIFIER OR HARDWARE ADDRESS.
To configure manual bindings, use the following commands beginning in global configuration mode:


Command
Purpose
Step 1 
Router(config)# ip dhcp pool name
Creates a name for the a DHCP Server address pool and places you in DHCP pool configuration mode—identified by the (dhcp-config)# prompt.
Step 2 
Router(dhcp-config)# host address [mask | /prefix-length]
Specifies the IP address and subnet mask of the client.
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 (/).
Step 3 
Router(dhcp-config)# client-identifier unique-identifier

 
Specifies the unique identifier for DHCP clients. This command is used for DHCP requests.
DHCP clients require client identifiers. The unique identification of the client is specified in dotted hexadecimal notation, for example, 01b7.0813.8811.66, where 01 represents the Ethernet media type.
See "Troubleshooting Tips" below for information on how to determine the client identifier of the DHCP client.
Step 4 
Router(dhcp-config)# hardware-address hardware-address type

 
(Optional) Specifies a hardware address for the client. This command is used for BOOTP requests.
The type value:
Indicates the protocol of the hardware platform. Strings and values are acceptable. The string options are:
ethernet
ieee802
The value options are:
1 10Mb Ethernet
6 IEEE 802
If no type is specified, the default protocol is Ethernet.
Step 5 
Router(dhcp-config)# client-name name
(Optional) Specifies the name of the client using any standard ASCII character. The client name should not include the domain name. For example, the name mars should not be specified as mars.cisco.com.


TROUBLESHOOTING TIPS:

You can determine the client identifier by using the debug ip dhcp server packet command. In the following example, the client is identified by the value 0b07.1134.a029.

Router# debug ip dhcp server packet 
DHCPD:DHCPDISCOVER received from client 0b07.1134.a029 through relay 10.1.0.253.
DHCPD:assigned IP address 10.1.0.3 to client 0b07.1134.a029.
 
 
CONFIGURING A DHCP SERVER BOOT FILE 
The boot file is used to store the boot image for the client. The boot image is generally the operating system the client uses to load. To specify a boot file for the DHCP client, use the following command in DHCP pool configuration mode:
Command
Purpose
Router(dhcp-config)# bootfile filename
Specifies the name of the file that is used as a boot image.

CONFIGURING THE NUMBER OF PING PACKETS:

By default, the DHCP Server pings a pool address twice before assigning a particular address to a requesting client. If the ping is unanswered, the DHCP Server assumes (with a high probability) that the address is not in use and assigns the address to the requesting client. To change the number of ping packets the DHCP Server should send to the pool address before assigning the address, use the following command in global configuration mode:

Command
Purpose
Router(config)# ip dhcp ping packets number
Specifies the number of ping packets the DHCP Server sends to a pool address before assigning the address to a requesting client. The default is two packets. Setting the count argument to a value of 0 turns off DHCP Server ping operation completely.

CONFIGURING THE TIMEOUT VALUE FOR PING PACKETS:

By default, the DHCP Server waits 500 milliseconds before timing out a ping packet. To change the amount of time the server waits, use the following command in global configuration mode:

Command
Purpose
Router(config)# ip dhcp ping timeout milliseconds
Specifies the amount of time the DHCP Server must wait before timing out a ping packet. The default is 500 milliseconds.

ENABLING THE CISCO IOS DHCP CLIENT ON ETHERNET INTERFACES :

To acquire an IP address via DHCP on an Ethernet interface, use the following command in interface configuration mode:

Command
Purpose
Router(config-if)# ip address dhcp [client-idinterface name] [hostname host-name]
Specifies that the Ethernet interface acquires an IP address through DHCP.

CONFIGURING DHCP SERVER OPTIONS IMPORT AND AUTOCONFIGURATION:

The Cisco IOS DHCP server can dynamically configure options such as the DNS and WINS addresses to respond to DHCP requests from local clients behind the customer premises equipment (CPE).

Previously, network administrators needed to manually configure the Cisco IOS DHCP server on each device enabled with this feature. The Cisco IOS DHCP server was enhanced to allow configuration information to be updated automatically. Network administrators can configure one or more centralized DHCP servers to update specific DHCP options within the DHCP pools. The remote servers can request or "import" these option parameters from the centralized servers

To configure the central router to update specific DHCP options within the DHCP pools, use the following commands beginning in global configuration mode:


Command
Purpose
Step 1 
Router(config)# ip dhcp pool name
Creates a name for the a DHCP Server address pool and places you in DHCP pool configuration mode—identified by the (dhcp-config)# prompt.
Step 2 
Router(dhcp-config)# network network-numbermask | /prefix-length] [
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 (/).
Step 3 
Router(dhcp-config)# dns-server address [address2 ... address8]
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.

To configure the remote router to import DHCP options into the DHCP server database, use the following commands beginning in global configuration mode:


Command
Purpose
Step 1 
Router(config)# ip dhcp pool name
Creates a name for the a DHCP Server address pool and places you in DHCP pool configuration mode—identified by the (dhcp-config)# prompt.
Step 2 
Router(dhcp-config)# networknetwork-number [mask | /prefix-length]
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 (/).
Step 3 
Router(dhcp-config)# import all
Import DHCP option parameters into the DHCP server database.
Step 4 
Router(dhcp-config)# exit
Exits DHCP pool configuration mode.
Step 5 
Router(config)# interface typenumber
Configures an interface and enters interface configuration mode.
Step 6 
Router(config-if)# ip address dhcp [client-id interface name] [hostname host-name]
Specifies that the interface acquires an IP address through DHCP.

CONFIGURING THE RELAY AGENT INFORMATION OPTION IN BOOTREPLY MESSAGES:

To configure the DHCP Server to validate the relay agent information option in forwarded BOOTREPLY messages, use the following command in global configuration mode:

Command
Purpose
Router(config)# ip dhcp relay information check
Configures the DHCP Server to check that the relay agent information option in forwarded BOOTREPLY messages is valid.

CONFIGURING A RELAY AGENT INFORMATION REFORWARDING POLICY:

To configure a relay agent information Reforwarding policy on the DHCP Server (what the DHCP Server should do if a forwarded message already contains relay information), use the following command in global configuration mode:

Command
Purpose
Router(config)# ip dhcp relay information policy {drop | keep |replace}
Determines the relay information reforwarding policy in a cable modem termination system.

ENABLING THE DHCP SMART-RELAY FEATURE:

By default, the DHCP smart-relay feature is disabled. To enable the smart-relay functionality, use the following command in global configuration mode:

Command
Purpose
Router(config)# ip dhcp smart-relay
Allows the DHCP relay agent to switch the gateway address (giaddr field of a DHCP packet) to secondary addresses when there is no DHCPOFFER message from a DHCP Server.

MONITORING AND MAINTAINING THE DHCP SERVER:

To clear DHCP Server variables, use the following commands in privileged EXEC mode, as needed:

Command
Purpose
Router# clear ip dhcp binding {address | *}
Deletes an automatic address binding from the DHCP database. Specifying the address argument clears the automatic binding for a specific (client) IP address, whereas specifying an asterisk (*) clears all automatic bindings.
Router# clear ip dhcp conflict {address | *}
Clears an address conflict from the DHCP database. Specifying the address argument clears the conflict for a specific IP address, whereas specifying an asterisk (*) clears conflicts for all addresses.
Router# clear ip dhcp server statistics
Resets all DHCP Server counters to 0.
Router# clear ip routevrf vrf-name] dhcp [ip-address] [
Removes routes from the routing table added by the Cisco IOS DHCP Server and Relay Agent for the DHCP clients on unnumbered interfaces.

TO ENABLE DHCP SERVER DEBUGGING, USE THE FOLLOWING COMMAND IN PRIVILEGED EXEC MODE:

Command
Purpose
Router# debug ip dhcp server {events | packets | linkage}
Enables debugging on the DHCP Server.

TO DISPLAY DHCP SERVER INFORMATION, USE THE FOLLOWING COMMANDS IN EXEC MODE, AS NEEDED:

Command
Purpose
Router# show ip dhcp binding [address]
Displays a list of all bindings created on a specific DHCP Server.
Use the show ip dhcp binding to display the lease expiration time and date of the IP address of the host and the number. You can also use this command to display the IP addresses that have already been assigned.
Router# show ip dhcp conflict [address]
Displays a list of all address conflicts recorded by a specific DHCP Server.
Router# show ip dhcp database [url]
Displays recent activity on the DHCP database.
Note Use this command in privileged EXEC mode.
Router# show ip dhcp server statistics
Displays count information about server statistics and messages sent and received.
Router# show ip dhcp import
Displays the option parameters that were imported into the DHCP Server database. Imported option parameters are not part of the router configuration and are not saved in NVRAM.
Router# show ip routevrf vrf-name] dhcp [ip-address] [
Displays the routes added to the routing table by the Cisco IOS DHCP Server and Relay Agent.

DHCP ADDRESS POOL CONFIGURATION EXAMPLE :

In the following example, three DHCP address pools are created: one in network 172.16.0.0, one in subnetwork 172.16.1.0, and one in subnetwork 172.16.2.0. Attributes from network 172.16.0.0—such as the domain name, DNS server, NetBIOS name server, and NetBIOS node type—are inherited in subnetworks 172.16.1.0 and 172.16.2.0. In each pool, clients are granted 30-day leases and all addresses in each subnetwork, except the excluded addresses, are available to the DHCP Server for assigning to clients. Table 5 lists the IP addresses for the devices in three DHCP address pools.

Table 5 DHCP Address Pool Configuration Example 
Pool 0 (Network 172.16.0.0)
Pool 1 (Subnetwork 172.16.1.0)
Pool 2 (Subnetwork 172.16.2.0)
Device
IP Address
Device
IP Address
Device
IP Address
Default routers
-
Default routers
172.16.1.100
172.16.1.101
Default routers
172.16.2.100
172.16.2.101
DNS Server
172.16.1.102
172.16.2.102
NetBIOS name server
172.16.1.103
172.16.2.103
NetBIOS node type
h-node

ip dhcp database ftp://user:password@172.16.4.253/router-dhcp write-delay 120
ip dhcp excluded-address 172.16.1.100 172.16.1.103
ip dhcp excluded-address 172.16.2.100 172.16.2.103
!
ip dhcp pool 0
 network 172.16.0.0 /16
 domain-name cisco.com
 dns-server 172.16.1.102 172.16.2.102
 netbios-name-server 172.16.1.103 172.16.2.103
 netbios-node-type h-node
!
ip dhcp pool 1
 network 172.16.1.0 /24
 default-router 172.16.1.100 172.16.1.101
 lease 30
!
ip dhcp pool 2
 network 172.16.2.0 /24
 default-router 172.16.2.100 172.16.2.101
 lease 30
MANUAL BINDINGS CONFIGURATION EXAMPLE :
The following example creates a manual binding for a client named Mars.cisco.com. The MAC address of the client is 02c7.f800.0422 and the IP address of the client is 172.16.2.254.
ip dhcp pool Mars
 host 172.16.2.254
 hardware-address 02c7.f800.0422 ieee802
 client-name Mars

Because attributes are inherited, the previous configuration is equivalent to the following:
ip dhcp pool Mars
 host 172.16.2.254 mask 255.255.255.0
 hardware-address 02c7.f800.0422 ieee802
 client-name Mars
 default-router 172.16.2.100 172.16.2.101
 domain-name cisco.com
 dns-server 172.16.1.102 172.16.2.102
 netbios-name-server 172.16.1.103 172.16.2.103
 netbios-node-type h-node

CISCO IOS DHCP CLIENT EXAMPLE:



shows a simple network diagram of a DHCP client on an Ethernet LAN.

Topology Showing DHCP Client with Ethernet Interface

On the DHCP Server, the configuration is as follows:
ip dhcp pool 1
 network 10.1.1.0 255.255.255.0
 lease 1 6

On the DHCP client, the configuration is as follows on interface E2:
interface Ethernet2
 ip address dhcp

This configuration allows the DHCP client to aquire an IP address from the DHCP Server through an Ethernet interface.
DHCP Server Options Import and Autoconfiguration Example
The following example shows a remote and central server configured to support DHCP options import and autoconfiguration. The central server is configured to automatically update DHCP options, such as DNS and WINs addresses, within the DHCP pools. In response to a DHCP request from a local client behind CPE equipment, the remote server can request or "import" these option parameters from the centralized server.



Central Router

!do not assign this range to DHCP clients
ip dhcp-excluded address 10.0.0.1 10.0.0.5
!
ip dhcp pool central
! Specifies network number and mask for DHCP clients
 network 10.0.0.0 255.255.255.0
! Specifes the domain name for the client
 domain-name central
! Specifies DNS server that will respond to DHCP clients when they need to correlate host
! name to ip address
 dns-server 10.0.0.2
!Specifies the NETBIOS WINS server
 netbios-name-server 10.0.0.2
!
interface FastEthernet0/0
 ip address 10.0.0.1 255.255.255.0
 duplex auto
 speed auto

Remote Router
!
ip dhcp pool client
! Imports DHCP options parameters into DHCP server database
 import all
 network 20.0.0.0 255.255.255.0
!
interface FastEthernet0/0
 ip address dhcp
 duplex auto
 speed auto

__________________________________________________________________________


BASIC LAB EXAMPLE :

The router will act as a DHCP server for the 192.168.1.0/24 network. IP Addresses already assigned to our switch (192.168.1.2) and File Server (192.168.1.5) will be excluded from the DHCP pool, to ensure they are not given out to other hosts and cause an IP address conflict.

First step is to enable the DHCP service on our router, which by default is enabled.

R1# configure terminal

R1(config)# service dhcp
Next step is to create the DHCP pool that defines the network of IP addresses that will be given out to the clients. Note that 'NET-POOL' is the name of the DHCP IP Pool we are creating.

R1(config)# ip dhcp pool NET-POOL

R1(dhcp-config)# network 192.168.1.0 255.255.255.0


This tells the router to issue IP addresses for the network 192.168.1.0, which translates to the range 192.168.1.1 - 192.168.1.254. We will have to exclude the IP addresses we want later on.
We now define the DHCP parameters that will be given to each client. These include the default gateway (default-router), dns servers, domain and lease period (days).

R1(dhcp-config)# default-router 192.168.1.1

R1(dhcp-config)# dns-server 192.168.1.5 195.170.0.1

R1(dhcp-config)# domain-name Prem Domain.edu
R1(dhcp-config)# lease 9
The 'domain-name' and 'lease' parameters are not essential and can be left out. By default, the lease time for an IP address is one day.

All we need now is to exclude the IP addresses we don't want our DHCP server giving out. Drop back to 'global configuration mode' and enter the following:

R1(config)# ip dhcp excluded-address 192.168.1.1 192.168.1.5

R1(config)# ip dhcp excluded-address 192.168.1.10

This excludes IP addresses 192.168.1.1 - 192.168.1.5 & 192.168.1.10. As you can see, there's an option to exclude a range of IP addresses or a specific address.

The above configuration is all you need to get the DHCP server running for your network. We'll provide a few more commands you can use to troubleshoot and ensure it's working correctly.
THE FOLLOWING COMMAND WILL ALLOW YOU TO CHECK WHICH CLIENTS HAVE BEEN SERVED BY THE DHCP:

R1# show ip dhcp binding

Bindings from all pools not associated with VRF:

IP address Client-ID/ Lease expiration Type

Hardware address/

User name

192.168.1.6 0100.1e7a.c409 Jan 19 2009 03:06 PM Automatic

192.168.1.7 0100.1e7a.c3c1 Jan 19 2009 09:00 PM Automatic

192.168.1.8 0100.1ebe.923b Jan 19 2009 02:25 PM Automatic

192.168.1.9 0100.1b53.5ccc Jan 19 2009 02:03 PM Automatic

192.168.1.11 0100.1e7a.261d Jan 19 2009 07:52 PM Automatic

R1#

Notice that IP addresses 192.168.1.5 & 192.168.1.10 have not been given out to the clients.
DHCP COMMAND REFERENCE:
 

All these commands used with this feature are documented in the Cisco IOS Release 12.0 command references.

bootfile
clear ip dhcp binding
clear ip dhcp conflict
clear ip dhcp server statistics
client-identifier
client-name
debug ip dhcp server
domain-name
dns-server
domain-name
hardware-address
host
ip dhcp database
ip dhcp ping packets
ip dhcp ping timeout
ip dhcp pool
ip dhcp relay information check
ip dhcp relay information option
ip dhcp relay information policy
lease
netbios-name-server
netbios-node-type
network
service dhcp
show ip dhcp binding
show ip dhcp conflict
show ip dhcp database
show ip dhcp server statistics


ARTICLE SUMMARY:

In this article we've covered how a Cisco router can be used as a basic DHCP server and the various options available. We also saw how you can obtain general information about the service. There are more options available with the DHCP service, however this basic article should cover most of your network needs also you can use all the command reference command.




This Article Written Author By: Premakumar Thevathasan. CCNA, CCNP, CCIP, MCSA, MCSE, MCSA - MSG, CIW Security Analyst, CompTIA Certified A+. 

1 comment:

Anonymous said...

This is very excellent way of teaching every one can be easy to understand this Article.