0% found this document useful (0 votes)
20 views28 pages

Lec 6

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views28 pages

Lec 6

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

7.

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)

The IP address configuration parameters must be


exact. It is easy to make a mistake when dealing with inputs such as 192.168.XXX.XXX.
Typographical errors are typically very difficult to troubleshoot and the use of a DHCP
server minimizes such errors.

Each connected device must have an IP address.


However, each IP address can be used only once. If an IP address conflict occurs
between two devices, one or both of the devices cannot be connected. This can
happen when IP addresses are allocated manually, particularly when there are a large
number of endpoints that only connect periodically, such as mobile devices.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 2
In any network without DHCP, network
administrators need to manually assign and withdraw IP addresses. Keeping track of
which device has what IP address can be an exercise in futility as it is nearly
impossible to understand when devices require access to the network and when they
leave. DHCP allows this to be automated and centralized so network professionals can
manage all locations from a single location.

The use of DHCP makes it very simple to change


addresses, scopes, or endpoints. For example, an organization may want to change its
IP addressing scheme from one range to another. The DHCP server is configured with
the new information and the information will be propagated to the new endpoints.
Similarly, if a network device is upgraded and replaced, no network configuration is
required.

© 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

When the client boots (or


otherwise wants to join a
network), it begins a four-step
process to obtain a lease:
1. DHCP Discover
(DHCPDISCOVER)
2. DHCP Offer (DHCPOFFER)
3. DHCP Request
(DHCPREQUEST)
4. DHCP Acknowledgment
(DHCPACK)

© 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:

1. DHCP Request (DHCPREQUEST)


Before the lease expires, the client sends a
DHCPREQUEST message directly to the
DHCPv4 server that originally offered the IPv4
address. If a DHCPACK is not received within a
specified amount of time, the client broadcasts
another DHCPREQUEST so that one of the other
DHCPv4 servers can extend the lease. Note: These messages (primarily the DHCPOFFER and
DHCPACK) can be sent as unicast or broadcast according
2. DHCP Acknowledgment (DHCPACK) to IETF RFC 2131.
On receiving the DHCPREQUEST message, the
server verifies the lease information by returning a
DHCPACK.

© 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.

Task IOS Command

Define the address pool. network network-number [mask | / prefix-length]

Define the default router or gateway. default-router address [ address2….address8]

Define a DNS server. dns-server address [ address2…address8]

Define the domain name. domain-name domain

Define the duration of the DHCP lease. lease {days [hours [ minutes]] | infinite}

Define the NetBIOS WINS server. netbios-name-server address [ address2…address8]

© 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.

Displays count information regarding the number of DHCPv4 messages


show ip dhcp server statistics
that have been sent and received

A DHCP binding is a mapping of the IP addresses to the Media Access Control


(MAC) addresses of the device that are found in the DHCP server database. The
bindings are saved as records for easy maintenance.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 23
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 24
DHCP configuration

© 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

You might also like