Search | Glossary
7 IP Addressing Services
CCNA Exploration - Accessing the WAN
7 IP Addressing Services
7.0 Chapter Introduction
The Internet and IP-related technologies have experienced rapid growth. One reason for the growth has been due in part to the flexibility of the original design. However, that design did not anticipate the Internet's popularity and the resulting demand for IP addresses. For example, every host and device on the Internet requires a unique IP version 4 (IPv4) address. Because
of the dramatic growth, the number of available IP addresses is quickly running out.
To cope with the depletion of IP addresses, several short-term solutions were developed. Two short-term solutions are private addresses and Network Address Translation (NAT).
An inside host typically receives its IP address, subnet mask, default gateway IP address, DNS server IP address, and other information from a Dynamic Host Configuration Protocol (DHCP) server. Instead of providing inside hosts with valid Internet IP addresses, the DHCP server usually provides IP addresses from a private pool of addresses. The problem is that these hosts may still require valid IP addresses to access Internet resources. This is where NAT comes in.
NAT enables inside network hosts to borrow a legitimate Internet IP address while accessing Internet resources. When the requested traffic returns, the legitimate IP address is repurposed and available for the next Internet request by an inside host. Using NAT, network administrators only need one or a few IP addresses for the router to provide to the hosts, instead of one unique IP address for every client joining the network. Although it sounds inefficient, the process is actually very efficient, because host traffic occurs very quickly.
Although private addresses with DHCP and NAT have helped reduce the need for IP addresses, it is estimated that we will run out of unique IPv4 addresses by 2010. For this reason, in the mid-1990s, the IETF requested proposals for a new IP addressing scheme. The IP Next Generation (IPng) working group responded. By 1996, the IETF started releasing a number of RFCs defining IPv6.
The main feature of IPv6 that is driving adoption today is the larger address space: addresses in IPv6 are 128 bits long versus 32 bits in IPv4.
This chapter describes how to implement DHCP, NAT, and IPv6 on enterprise networks.
7.1.1 Introducing DHCP
What is DHCP?
Every device that connects to a network needs an IP address. Network administrators assign static IP addresses to routers, servers, and other network devices whose locations (physical and logical) are not likely to change. Administrators enter static IP addresses manually when they configure devices to join the network. Static addresses also enable administrators to manage those devices remotely.
However, computers in an organization often change locations, physically and logically. Administrators are unable to keep up with having to assign new IP addresses every time an employee moves to a different office or cubicle. Desktop clients do not require a static address. Instead, a workstation can use any address within a range of addresses. This range is typically within an IP subnet. A workstation within a specific subnet can be assigned any address within a specified range. Other items such as the subnet mask, default gateway, and Domain Name System (DNS) server are assigned a value which is common either to that subnet or entire administrated network. For example, all hosts within the same subnet will receive different host IP addresses, but will receive the same subnet mask and default gateway IP address."
Recall from CCNA Exploration: Network Fundamentals that DHCP makes the process of assigning new IP addresses almost transparent. DHCP assigns IP addresses and other important network configuration information dynamically. Because desktop clients typically make up the bulk of network nodes, DHCP is an extremely useful and timesaving tool for network administrators. RFC 2131 describes DHCP.
Administrators typically prefer a network server to offer DHCP services, because these solutions are scalable and relatively easy to manage. However, in a small branch or SOHO location, a Cisco router can be configured to provide DHCP services without the need for an expensive dedicated server. A Cisco IOS feature set called Easy IP offers an optional, full-featured DHCP server.
7.1.2 DHCP Operation
Providing IP addresses to clients is the most fundamental task performed by a DHCP server. DHCP includes three different address allocation mechanisms to provide flexibility when assigning IP addresses:
; Manual Allocation: The administrator assigns a pre-allocated IP address to the client and
DHCP only communicates the IP address to the device.
; Automatic Allocation: DHCP automatically assigns a static IP address permanently to a
device, selecting it from a pool of available addresses. There is no lease and the address is
permanently assigned to a device.
; Dynamic Allocation: DHCP automatically dynamically assigns, or leases, an IP address from a
pool of addresses for a limited period of time chosen by the server, or until the client tells
the DHCP server that it no longer needs the address.
This section focuses on dynamic allocation.
DHCP works in a client/server mode and operates like any other client/server relationship. When a PC connects to a DHCP server, the server assigns or leases an IP address to that PC. The PC connects to the network with that leased IP address until the lease expires. The host must contact the DHCP server periodically to extend the lease. This lease mechanism ensures that hosts that move or power off do not hold onto addresses that they do not need. The DHCP server returns these addresses to the address pool and reallocates them as necessary.
Click the Discover button in the figure.
When the client boots or otherwise wants to join a network, it completes four steps in obtaining a lease. In the first step, the client broadcasts a DHCPDISCOVER message. The DHCPDISCOVER message finds DHCP servers on the network. Because the host has no valid IP information at bootup, it uses L2 and L3 broadcast addresses to communicate with the server.
Click the Offer button in the figure.
When the DHCP server receives a DHCDISCOVER message, it finds an available IP address to lease, creates an ARP entry consisting of the MAC address of the requesting host and the leased IP address, and transmits a binding offer with a DHCPOFFER message. The DHCPOFFER message is sent as a unicast, using the L2 MAC address of the server as the source address and the L2 address of the client as the destination.
Note: Under certain circumstances, the DHCP message exchange from the server may be broadcasted and not unicasted.
Click the Request button in the figure.
When the client receives the DHCPOFFER from the server, it sends back a DHCPREQUEST message. This message has two purposes: lease origination and lease renewal and verification. When used for lease origination, the DHCPREQUEST of the client is requesting that the IP information be verified just after it has been assigned. The message provides error checking to ensure that the assignment is still valid. The DHCPREQUEST also serves as a binding acceptance notice to the selected server and an implicit decline to any other servers that may have provided the host a binding offer.
Many enterprise networks use multiple DHCP servers. The DHCPREQUEST message is sent in the form of a broadcast to inform this DHCP server and any other DHCP servers about the accepted offer.
Click the Acknowledge button in the figure.
On receiving the DHCPREQUEST message, the server verifies the lease information, creates a new ARP entry for the client lease, and replies with a unicast DHCPACK message. The DHCPACK message is a duplicate of the DHCPOFFER, except for a change in the message type field. When the client receives the DHCPACK message, it logs the configuration information and performs an ARP lookup for the assigned address. If it does not receive a reply, it knows that the IP address is valid and starts using it as its own.
Clients lease the information from the server for an administratively defined period. Administrators configure DHCP servers to set the leases to time out at different intervals. Most ISPs and large networks use default lease durations of up to three days. When the lease expires, the client must ask for another address, although the client is typically reassigned the same address.
The DHCPREQUEST message also addresses the dynamic DHCP process. The IP
information sent in the DHCPOFFER might have been offered to another client during the dynamic allocation. Each DHCP server creates pools of IP addresses and associated parameters. Pools are dedicated to individual, logical IP subnets. The pools allow multiple DHCP servers to respond and IP clients to be mobile. If multiple servers respond, a client can choose only one of the offers.
7.1.3 BOOTP and DHCP
BOOTP and DHCP
The Bootstrap Protocol (BOOTP), defined in RFC 951, is the predecessor of DHCP and
shares some operational characteristics. BOOTP is a way to download address and boot configurations for diskless workstations. A diskless workstation does not have a hard drive or an operating system. For example, many automated cash register systems at your local super market are examples of diskless workstations. Both DHCP and BOOTP are client/server based and use UDP ports 67 and 68. Those ports are still known as BOOTP ports.
DHCP and BOOTP have two components, as shown in the figure. The server is a host with a static IP address that allocates, distributes, and manages IP and configuration data assignments. Each allocation (IP and configuration data) is stored on the server in a data set called a binding. The client is any device using DHCP as a method for obtaining IP addressing or supporting configuration information.
To understand the functional differences between BOOTP and DHCP, consider the four basic IP parameters needed to join a network:
; IP address
; Gateway address
; Subnet mask
; DNS server address
There are three primary differences between DHCP and BOOTP:
; The main difference is that BOOTP was designed for manual pre-configuration of the host
information in a server database, while DHCP allows for dynamic allocation of network
addresses and configurations to newly attached hosts. When a BOOTP client requests an IP
address, the BOOTP server searches a predefined table for an entry that matches the MAC
address for the client. If an entry exists, the corresponding IP address for that entry is
returned to the client. This means that the binding between the MAC address and the IP
address must have already been configured in the BOOTP server.
; DHCP allows for recovery and reallocation of network addresses through a leasing
mechanism. Specifically, DHCP defines mechanisms through which clients can be assigned an
IP address for a finite lease period. This lease period allows for reassignment of the IP
address to another client later, or for the client to get another assignment if the client moves
to another subnet. Clients may also renew leases and keep the same IP address. BOOTP does
not use leases. Its clients have reserved IP address which cannot be assigned to any other
; BOOTP provides a limited amount of information to a host. DHCP provides additional IP
configuration parameters, such as WINS and domain name.
DHCP Message Format
The developers of DHCP needed to maintain compatibility with BOOTP and consequently used the same BOOTP message format. However, because DHCP has more functionality than BOOTP, the DHCP options field was added. When communicating with older BOOTP clients, the DHCP options field is ignored.
The figure shows the format of a DHCP message. The fields are as follows:
; Operation Code (OP) - Specifies the general type of message. A value of 1 indicates a request
message; a value of 2 is a reply message.
; Hardware Type - Identifies the type of hardware used in the network. For example, 1 is
Ethernet, 15 is Frame Relay, and 20 is a serial line. These are the same codes used in ARP
; Hardware Address length - 8 bits to specify the length of the address.
; Hops - Set to 0 by a client before transmitting a request and used by relay agents to control
the forwarding of DHCP messages.
; Transaction Identifier - 32-bit identification generated by the client to allow it to match up
the request with replies received from DHCP servers.
; Seconds - Number of seconds elapsed since a client began attempting to acquire or renew a
lease. Busy DHCP servers use this number to prioritize replies when multiple client requests
; Flags - Only one of the 16 bits is used, which is the broadcast flag. A client that does not
know its IP address when it sends a request, sets the flag to 1. This value tells the DHCP
server or relay agent receiving the request that it should send the reply back as a broadcast.
; Client IP Address - The client puts its own IP address in this field if and only if it has a valid IP
address while in the bound state; otherwise, it sets the field to 0. The client can only use this
field when its address is actually valid and usable, not during the process of acquiring an
; Your IP Address - IP address that the server assigns to the client.
; Server IP Address - Address of the server that the client should use for the next step in the
bootstrap process, which may or may not be the server sending this reply. The sending server
always includes its own IP address in a special field called the Server Identifier DHCP option.
; Gateway IP Address - Routes DHCP messages when DHCP relay agents are involved. The
gateway address facilitates communications of DHCP requests and replies between the client
and a server that are on different subnets or networks.
; Client Hardware Address - Specifies the Physical layer of the client.
; Server Name - The server sending a DHCPOFFER or DHCPACK message may optionally put its
name in this field. This can be a simple text nickname or a DNS domain name, such as
; Boot Filename - Optionally used by a client to request a particular type of boot file in a
DHCPDISCOVER message. Used by a server in a DHCPOFFER to fully specify a boot file
directory and filename.
; Options - Holds DHCP options, including several parameters required for basic DHCP
operation. This field is variable in length. Both client and server may use this field.
DHCP Discovery and Offer Methods
These figures provide some detail of the packet content of the DHCP discover and offer messages.
When a client wants to join the network, it requests addressing values from the network DHCP server. If a client is configured to receive its IP settings dynamically, it transmits a DHCPDISCOVER message on its local physical subnet when it boots or senses an active network connection. Because the client has no way of knowing the subnet to which it belongs, the DHCPDISCOVER is an IP broadcast (destination IP address of 255.255.255.255). The client does not have a configured IP address, so the source IP address of 0.0.0.0 is used. As you see in the figure, the client IP address (CIADDR), default gateway address (GIADDR), and subnetwork mask are all marked with question marks.
Click the DHCP Offer button in the figure.
The DHCP server manages the allocation of the IP addresses and answers configuration requests from clients.
When the DHCP server receives the DHCPDISCOVER message, it responds with a DHCPOFFER message. This message contains initial configuration information for the client, including the MAC address of the client, followed by 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. The subnet mask and default gateway are specified in the options field, subnet mask, and
router options, respectively. The DHCPOFFER message can be configured to include other information, such as the lease renewal time, domain name server, and NetBIOS Name Service
(Microsoft Windows Internet Name Service [Microsoft WINS]).
The server determines the configuration, based on the hardware address of the client as specified in the CHADDR field.
As shown in the diagram, the DHCP server has responded to the DHCPDISCOVER by assigning values to the CIADDR and subnetwork mask.
Administrators set up DHCP servers to assign addresses from predefined pools. Most DHCP servers also allow the administrator to define specifically which client MAC addresses can be serviced and automatically assign them the same IP address each time.
DHCP uses User Datagram Protocol (UDP) as its transport protocol. The client sends messages to the server on port 67. The server sends messages to the client on port 68.
The client and server acknowledge messages, and the process is complete. The client sets the CIADDR only when a host is in a bound state, which means that the client has confirmed and is using the IP address.
For more information on DHCP, see "Cisco IOS DHCP Server" at:
7.1.4 Configuring a DHCP Server
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.
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.
Click the DHCP Pool button in the figure.
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.
Click the DHCP Tasks button in the figure.
This figure lists the tasks to complete the DHCP pool configuration. Some of these are optional, while others must be configured.