Lec 6
Lec 6
1 DHCPv4 Concepts
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 1
IP addresses can be configured statically or dynamically. Normally we configure static
IP addresses on network devices like routers, switches, firewalls and servers while we
dynamically assign IP addresses to computers, laptops, tablets, smartphones etc. The
dynamic method uses DHCP (Dynamic Host Configuration Protocol)
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 3
DHCPv4 Concepts
DHCPv4 Operation
• DHCPv4 works in a client/server mode. When a client communicates with a DHCPv4
server, the server assigns or leases an IPv4 address to that client.
• The client connects to the network with that leased IPv4 address until the lease
expires. The client must contact the DHCP server periodically to extend the lease.
• This lease mechanism ensures that clients that move or power off do not keep
addresses that they no longer need.
• When a lease expires, the DHCP server returns the address to the pool where it can
be reallocated as necessary.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 4
DHCPv4 Concepts
Steps to Obtain a Lease
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 5
Automatic Private IP Addressing (APIPA) is a feature in operating systems (such as
Windows) that enables computers to automatically self-configure an IP address and
subnet mask when their DHCP server isn't reachable. The IP address range for APIPA
is 169.254.
The APIPA provides the configuration to check for the presence of a DHCP server(in
every five minutes, stated by Microsoft). If APIPA detects a DHCP server on the
network configuration area, it stops, and let run the DHCP server that replaces APIPA
with dynamically allocated addresses.
Characteristics:
Communication can be established properly if not getting response from DHCP Server.
APIPA regulates the service, by which always checking response and status of the
main DHCP server in a specific period of time.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 6
Automatic Private IP Addressing
Advantages
§ It can be used as a backup of DHCP because when DHCP stops working then
APIPA has the ability to assign IP to the networking hosts.
§ It stops unwanted broadcasting.
§ It uses ARP(Address Resolution Protocol) to confirm the address isn’t currently in
use.
Disadvantages
§ APIPA ip addresses can slow you network.
§ APIPA doesnot provide network gateway as DHCP does.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 7
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 8
On the left side we have a computer without IP address. On the right side there’s a
DHCP server configured with static IP address 192.168.1.254. This DHCP server will
supply an IP address to our computer, this is how it works:
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 9
The computer will send a DHCP discover message. This is a broadcast because it
doesn’t have an IP address and it doesn’t know if there is a DHCP server on the
network. Of course in our scenario we do have a DHCP server so it will respond to
this broadcast as following:
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 10
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 11
The DHCP server will respond with a DHCP offer message which contains an IP
address for the computer (we have to configure the DHCP server to define which IP
addresses we want to give). If we want we can also assign a default gateway and
DNS server(s) to the computer. The computer will respond to this information:
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 12
DHCP operation
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 13
The computer will send a DHCP Request (broadcast) in response to the DHCP offer
message, asking nicely if it’s OK to use the information that it has received. Our
DHCP server will respond to this as following:
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 14
The DHCP server will respond with a DHCP ACK message to tell the computer it’s
OK to use this information. Now you have an idea what DHCP is like, let’s take a
closer look at the packages level.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 15
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 16
Gratuitous Address Resolution Protocol (ARP) requests help detect duplicate IP
addresses. A gratuitous ARP is a broadcast request for a router's own IP address.
If a router or switch sends an ARP request for its own IP address and no ARP replies
are received, the router- or switch-assigned IP address is not being used by other
nodes. Why we do so?
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 17
DHCPv4 Concepts
Steps to Renew a Lease
Prior to lease expiration, the client begins a two-
step process to renew the lease with the DHCPv4
server, as shown in the figure:
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 18
Configure a Cisco IOS DHCPv4 Server
Cisco IOS DHCPv4 Server
Now you have a basic understanding of how DHCPv4 works and how it can make your
job a bit easier. A Cisco router running Cisco IOS software can be configured to act as a
DHCPv4 server. The Cisco IOS DHCPv4 server assigns and manages IPv4 addresses
from specified address pools within the router to DHCPv4 clients.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 19
Configure a Cisco IOS DHCPv4 Server
Steps to Configure a Cisco IOS DHCPv4 Server
Use the following steps to configure a Cisco IOS DHCPv4 server:
• Step 1. Exclude IPv4 addresses. A single address or a range of addresses can be
excluded by specifying the low-address and high-address of the range. Excluded
addresses should be those addresses that are assigned to routers, servers, printers,
and other devices that have been, or will be, manually configured. You can also enter
the command multiple times. The command is ip dhcp excluded-address low-
address [high-address]
• Step 2. Define a DHCPv4 pool name. The ip dhcp pool pool-name command creates
a pool with the specified name and puts the router in DHCPv4 configuration mode,
which is identified by the prompt Router(dhcp-config)#.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 20
Configure a Cisco IOS DHCPv4 Server
Steps to Configure a Cisco IOS DHCPv4 Server (Cont.)
• Step 3. Configure the DHCPv4 pool. The address pool and default gateway router must be
configured. Use the network statement to define the range of available addresses. Use
the default-router command to define the default gateway router. These commands and
other optional commands are shown in the table.
Define the duration of the DHCP lease. lease {days [hours [ minutes]] | infinite}
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 21
Configure a Cisco IOS DHCPv4 Server
Configuration Example
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 22
Configure a Cisco IOS DHCPv4 Server
DHCPv4 Verification
Use the commands in the table to verify that the Cisco IOS DHCPv4 server is operational.
Command Description
show running-config | section dhcp Displays the DHCPv4 commands configured on the router.
Displays a list of all IPv4 address to MAC address bindings provided by the
show ip dhcp binding
DHCPv4 service.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 25
DHCP configuration
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 26
DHCP configuration
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 27
DHCP configuration
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 28