Home > Articles > Cisco > Cisco Networking Academy

  • Print
  • + Share This
This chapter is from the book

DHCP and Easy IP

This section discusses DHCP and its operation. It covers how to configure DHCP, and use Easy IP as well.

DHCP Overview

After designing a scalable IP addressing scheme for the enterprise, the next step is implementation. Routers, servers, and other key nodes usually require special attention from administrators. However, desktop clients are often automatically assigned IP configurations using Dynamic Host Configuration Protocol (DHCP). Because desktop clients typically make up the bulk of network nodes, DHCP is good news for systems administrators. Small offices and home offices can also take advantage of DHCP by using Easy IP, a Cisco IOS software feature set that combines DHCP with NAT functions.

DHCP works by configuring servers to give out IP configuration information to clients. Clients lease the information from the server for an administratively defined period. When the lease is up, the host must ask for another address, although it is typically reassigned the same one. Figures 2-17 and 2-18 illustrate this process. In Figure 2-17, Host A issues a DHCP request for an IP address. In Figure 2-18, the DHCP server replies to the DHCP request by leasing an IP address from the configured IP address pool.

Figure 17Figure 2-17 Simple DHCP Operation: Client/Server



 

Figure 18Figure 2-18 Simple DHCP Operation: Reply

 

Administrators typically prefer to use a Microsoft 2000 server or a UNIX computer to offer DHCP services because these solutions are highly scalable and relatively easy to manage. Even so, the Cisco IOS software offers an optional, fully featured DHCP server, which leases configurations for 24 hours by default.

Administrators set up DHCP servers to assign addresses from predefined pools. DHCP servers can also provide other information:

  • Default gateway address

  • DNS server addresses

  • WINS server addresses

  • Domain names

Most DHCP servers also let you specifically define what client MAC addresses can be serviced and automatically assign the same number to a particular host each time.

DHCP Operation

The DHCP client configuration process is shown in Figure 2-19.

Figure 19Figure 2-19 DHCP Operation

 

The DHCP client configuration process follows these steps:

  1. When a client is set up for DHCP and needs an IP configuration, typically at boot time, it tries to locate a DHCP server by sending a broadcast called a DHCPDISCOVER.

  2. The server sends a DHCPOFFER unicast to the client. When the server receives the broadcast, it determines whether it can service the request from its own database. If it cannot, the server might forward the request to another DHCP server or servers, depending on its configuration. If it can service the request, the DHCP server offers the client IP configuration information in the form of a unicast DHCPOFFER. The DHCPOFFER is a proposed configuration that may include IP address, DNS server address, and lease time.

  3. The client sends a DHCPREQUEST broadcast to all nodes. If the client finds the offer agreeable, it sends another broadcast. This broadcast is a DHCPREQUEST, specifically requesting those particular IP parameters. Why does the client broadcast the request instead of unicasting it to the server? A broadcast is used because the very first message, the DHCPDISCOVER, might have reached more than one DHCP server. After all, it was a broadcast. If more than one server makes an offer, the broadcasted DHCPREQUEST lets the servers know which offer was accepted, which is usually the first offer received.

  4. The server sends a DHCPACK unicast to the client. The server that receives the DHCPREQUEST makes the configuration official by sending a unicast acknowledgment, the DHCPACK. Note that it is possible but highly unlikely that the server will not send the DHCPACK, because it might have leased that information to another client in the interim. Receipt of the DHCPACK message lets the client begin using the assigned address immediately.

Depending on an organization's policies, it might be possible for an end user or administrator to statically assign a host an IP address that belongs in the DHCP server address pool. Just in case, the Cisco IOS software DHCP server always checks to make sure that an address is not in use before the server offers it to a client. The server issues ICMP echo requests (pings) to a pool address before sending the DHCPOFFER to a client. Although it can be configured, the default number of pings used to check for potential IP address conflict is two. The more pings, the longer the configuration process takes.

Configuring the IOS DHCP Server

The DHCP server process is enabled by default on versions of the Cisco IOS software that support it. If for some reason the DHCP server process becomes disabled, you can reenable it by using the service dhcp global configuration command. The no service dhcp command disables the server.

Like NAT, DHCP servers require that the administrator define a pool of addresses. In Example 2-3, the ip dhcp pool command defines which addresses are assigned to hosts.

Example 2-3 Configuring a DHCP Address Pool

RTA(config)#ip dhcp pool room12
RTA(dhcp-config)#network 172.16.1.0 255.255.255.0
RTA(dhcp-config)#exit
RTA(config-if)#ip dhcp excluded-address 172.16.1.1 172.16.1.10

The first command, ip dhcp pool room12, creates a pool named room12 and puts the router in a specialized DHCP configuration mode. In this mode, you use the network statement to define the range of addresses to be leased. If specific addresses are to be excluded on this network, return to global configuration mode and enter the ip dhcp excluded-address command.

The ip dhcp excluded-address command configures the router to exclude 172.16.1.1 through 172.16.1.10 when assigning addresses to clients. The ip dhcp excluded-address command may be used to reserve addresses that are statically assigned to key hosts.

A DHCP server can configure much more than an IP address. Other IP configuration values can be set from DHCP configuration mode, as shown in Example 2-4.

Example 2-4 Assigning Key DHCP Information

RTA(config)#ip dhcp pool room12
RTA(dhcp-config)#dns-server 172.16.1.2
RTA(dhcp-config)#netbios-name-server 172.16.1.2
RTA(config-if)#default-router 172.16.1.1

IP clients will not get very far without a default gateway, which can be set by using the default-router command. The address of the DNS server, dns-server, and WINS server, netbios-name-server, can be configured here as well. The IOS DHCP server can configure clients with virtually any TCP/IP information.

Table 2-8 lists the key IOS DHCP server commands. These commands are entered in DHCP pool configuration mode, identified by the router(dhcp-config)# prompt.

Table 2-8 Key DHCP Server Commands

Command

Description

network network-number [mask | /prefix-length]

Specifies the subnet network number and mask of the DHCP address pool. The prefix-length portion specifies the number of bits that comprise the address prefix. The prefix is the alternative way of specifying the client's network mask. The prefix-length must be preceded by a slash (/).

default-router address [address2...address8]

Specifies the IP address of the default router or default gateway for a DHCP client. One IP address is required, although up to eight addresses can be specified in one command line.

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, although up to eight addresses can be specified in one command line.

netbios-name-server address [address2...address8]

Specifies the IP address of the NetBIOS WINS server that is available to a Microsoft DHCP client. One IP address is required, although up to eight addresses can be specified in one command line.

domain-name domain

Specifies the client's domain name.

lease {days [hours] [minutes] | infinite}

Specifies the duration of the DHCP lease. The default is a one-day lease.


Use the EXEC mode commands, shown in Table 2-9, to monitor DHCP server operation.

Table 2-9 Key Commands for Monitoring DHCP Operation

Command

Definition

show ip dhcp binding [address]

Displays a list of all bindings (MAC to IP address) created on a specific DHCP server.

show ip dhcp conflict [address]

Displays a list of all address conflicts recorded by a specific DHCP server.

show ip dhcp database [url]

Displays recent activity on the DHCP database. (Use this command in privileged EXEC mode.)

show ip dhcp server statistics

Displays count information about server statistics and messages sent and received.


Easy IP

Easy IP is a combination suite of Cisco IOS software features that allows a router to negotiate its own IP address, as a DHCP client, and to do NAT through that negotiated address. Easy IP is typically deployed on a small office, home office (SOHO) router. It is useful in cases where a small LAN connects to the Internet by way of a provider that dynamically assigns only one IP address for the entire remote site, as shown in Figure 2-20.

Figure 20Figure 2-20 Cisco IOS Easy IP


A SOHO router with the Easy IP feature set uses DHCP, as a server, to automatically address local LAN clients with RFC 1918 addresses. When the router dynamically receives its WAN interface address by way of PPP, it uses NAT overload to translate between local inside addresses and its single global address. Therefore, both the LAN side and the WAN side are dynamically configured with little or no administrative intervention. In effect, Easy IP offers plug-and-play routing.

  • + Share This
  • 🔖 Save To Your Account