0% found this document useful (0 votes)
43 views29 pages

Lec7 DHCP v4

The document discusses configuring a DHCPv4 server on a Cisco IOS router. It describes the basic concepts of DHCPv4 including how clients obtain leases from servers. It then provides steps to configure a DHCPv4 server on a Cisco IOS router including defining an address pool and default gateway.

Uploaded by

marwanosama229
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)
43 views29 pages

Lec7 DHCP v4

The document discusses configuring a DHCPv4 server on a Cisco IOS router. It describes the basic concepts of DHCPv4 including how clients obtain leases from servers. It then provides steps to configure a DHCPv4 server on a Cisco IOS router including defining an address pool and default gateway.

Uploaded by

marwanosama229
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/ 29

7.

1 DHCPv4 Concepts

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 1
Module Objectives
Module Title: DHCPv4

Module Objective: Implement DHCPv4 to operate across multiple LANs

Topic Title Topic Objective


Explain how DHCPv4 operates in a small- to medium-
DHCP4 Concepts
sized business network.
Configure a Cisco IOS DHCP4 Server Configure a router as a DHCPv4 server.

Configure a DHCP4 Client Configure a router as a DHCPv4 client.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 2
DHCPv4 Concepts
DHCPv4 Server and Client
• Dynamic Host Configuration Protocol v4 (DHCPv4) assigns IPv4 addresses and other
network configuration information dynamically. Because desktop clients typically make up the
bulk of network nodes:

➢ DHCPv4 is an extremely useful and timesaving tool for network administrators.

➢ A dedicated DHCPv4 server is scalable and relatively easy to manage. However, in a small
branch or SOHO location, a Cisco router can be configured to provide DHCPv4 services
without the need for a dedicated server. Cisco IOS software supports an optional, full-
featured DHCPv4 server.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 3
DHCPv4 Concepts
DHCPv4 Server and Client
• The DHCPv4 server dynamically assigns, or leases, an IPv4 address from a pool of
addresses for a limited period of time chosen by the server, or until the client no longer
needs the address.

• Clients lease the information from the server for an administratively defined period.
Administrators configure DHCPv4 servers to set the leases to time out at different intervals.
The lease is typically anywhere from 24 hours to a week or more. When the lease expires,
the client must ask for another address, although the client is typically reassigned the same
address.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 4
DHCPv4 Concepts
DHCPv4 Operation

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 5
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 6
DHCPv4 Concepts
DHCPv4 Operation

DHCP Operation
Assigning IP addressing information to user devices is one the most important task that is
performed by the DHCP servers in our networks. It accomplishes these tasks in one of
three ways:
✓ Manual IP allocation – in this type of DHCP allocation, the network administrator assigns
users with IP addresses from the DHCP server and then the DHCP server
communicates this information to the clients.
✓ Automatic IP allocation – in this mode, the DHCP server assigns static IP addresses to
clients from a pool. These addresses do not change unless the administrator configures
it differently.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 7
DHCPv4 Concepts
DHCPv4 Operation

✓ Dynamic IP allocation – in this mode, the administrator configures a pool of addresses


which can be assigned to clients. The clients then request the IP addressing
information from the DHCP server and they are given an IP address and other
addressing information for a particular time period, when the time expires, the IP
address is returned to the DHCP pool and the client has to request another IP address.
▪ When configuring DHCP, there are four parameters that are needed by clients before
they can communicate fully on the network. These are:
✓ IP address
✓ Subnet mask
✓ Default gateway
✓ DNS server © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 8
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 9
DHCPv4 Concepts
Steps to Obtain a Lease

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 10
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 11
7.2 Configure a Cisco IOS
DHCPv4 Server

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 12
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 13
Configure a Cisco IOS DHCPv4 Server
Steps to Configure a Cisco IOS DHCPv4 Server

Step 1. Write down a range of IP addresses that should not be allocated by the
DHCP server. In most cases these are the statically assigned IP addresses that
have been configured.
Step 2. Create a pool of assignable IP addresses using the command “ip dhcp
pool” in the global configuration mode.
Step 3. Configure the information that is needed in the pool, such as the default
gateway, subnet mask, domain name.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 14
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 15
Configure a Cisco IOS DHCPv4 Server
Configuration Example

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 16
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

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 17
Configure a Cisco IOS DHCPv4 Server
Verify DHCPv4 is Operational
Verify the DHCPv4 Configuration: As shown in the example, the show running-config
| section dhcp command output displays the DHCPv4 commands configured on R1.
The | section parameter displays only the commands associated with DHCPv4
configuration.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 18
Configure a Cisco IOS DHCPv4 Server
Verify DHCPv4 is Operational (Cont.)
Verify DHCPv4 Bindings: As shown in the example, the operation of DHCPv4 can be
verified using the show ip dhcp binding command. This command displays a list of all
IPv4 address to MAC address bindings that have been provided by the DHCPv4 service.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 19
Configure a Cisco IOS DHCPv4 Server
Verify DHCPv4 is Operational (Cont.)

Verify DHCPv4 Statistics: The output


of the show ip dhcp server
statistics is used to verify that
messages are being received or sent by
the router. This command displays count
information regarding the number of
DHCPv4 messages that have been sent
and received.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 20
Configure a Cisco IOS DHCPv4 Server
Verify DHCPv4 is Operational (Cont.)
Verify DHCPv4 Client Received IPv4
Addressing: The ipconfig
/all command, when issued on PC1,
displays the TCP/IP parameters, as
shown in the example. Because PC1
was connected to the network
segment 192.168.10.0/24, it
automatically received a DNS suffix,
IPv4 address, subnet mask, default
gateway, and DNS server address
from that pool. No DHCP-specific
router interface configuration is
required. If a PC is connected to a
network segment that has a DHCPv4
pool available, the PC can obtain an
IPv4 address from the appropriate
pool automatically.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 21
Configure a Cisco IOS DHCPv4 Server
Disable the Cisco IOS DHCPv4 Server
The DHCPv4 service is enabled by
default. To disable the service, use
the no service dhcp global
configuration mode command. Use
the service dhcp global
configuration mode command to re-
enable the DHCPv4 server process,
as shown in the example. Enabling
the service has no effect if the
parameters are not configured.
Note: Clearing the DHCP bindings
or stopping and restarting the DHCP
service may result in duplicate IP
addresses being temporarily
assigned on the network.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 22
Configure a Cisco IOS DHCPv4 Server
DHCPv4 Relay
• In a complex hierarchical network, enterprise servers are usually located centrally. These servers may
provide DHCP, DNS, TFTP, and FTP services for the network. Network clients are not typically on the
same subnet as those servers. In order to locate the servers and receive services, clients often use
broadcast messages.
• In the figure, PC1 is attempting to acquire an IPv4 address from a DHCPv4 server using a broadcast
message. In this scenario, R1 is not configured as a DHCPv4 server and does not forward the
broadcast. Because the DHCPv4 server is located on a different network, PC1 cannot receive an IP
address using DHCP. R1 must be configured to relay DHCPv4 messages to the DHCPv4 server.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 23
Configure a Cisco IOS DHCPv4 Server
DHCPv4 Relay (Cont.)
• Configure R1 with the ip helper-address address interface configuration command.
This will cause R1 to relay DHCPv4 broadcasts to the DHCPv4 server. As shown in
the example, the interface on R1 receiving the broadcast from PC1 is configured to
relay DHCPv4 address to the DHCPv4 server at 192.168.11.6.
• When R1 has been configured as a DHCPv4 relay agent, it accepts broadcast
requests for the DHCPv4 service and then forwards those requests as a unicast to the
IPv4 address 192.168.11.6. The network administrator can use the show ip
interface command to verify the configuration.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 24
Configure a Cisco IOS DHCPv4 Server
Other Service Broadcasts Relayed
DHCPv4 is not the only service that the router can be configured to relay. By default,
the ip helper-address command forwards the following eight UDP services:
• Port 37: Time
• Port 49: TACACS: ACACS (Terminal Access Controller Access Control System) is a
security protocol that provides centralized validation of users who are attempting to
gain access to a router
• Port 53: DNS
• Port 67: DHCP/BOOTP server
• Port 68: DHCP/BOOTP client
• Port 69: TFTP Trivial File Transfer Protocol is a technology that transfers files between
network devices and is a simplified version of the more robust File Transfer Protocol
• Port 137: NetBIOS
• Port 138: NetBIOS
• NetBIOS (Network Basic Input/Output System) is a network service that enables applications on
different computers to communicate with each other across a local area network (LAN)
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 25
7.3 Configure a DHCPv4
Client

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 26
Configure a DHCPv4 Client
Cisco Router as a DHCPv4 Client
There are scenarios where you might have access to a DHCP server through your ISP. In these
instances, you can configure a Cisco IOS router as a DHCPv4 client.
• Sometimes, Cisco routers in a small office or home office (SOHO) and branch sites have to be
configured as DHCPv4 clients in a similar manner to client computers. The method used depends
on the ISP. However, in its simplest configuration, the Ethernet interface is used to connect to a
cable or DSL modem.
• To configure an Ethernet interface as a DHCP client, use the ip address dhcp
interface configuration mode command.
• In the figure, assume that an ISP has been configured to provide select customers with IP
addresses from the 209.165.201.0/27 network range after the G0/0/1 interface is configured with
the ip address dhcp command.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 27
Configure a DHCPv4 Client
Configuration Example
• To configure an Ethernet interface as a DHCP client, use the ip address dhcp interface configuration
mode command, as shown in the example. This configuration assumes that the ISP has been configured to
provide select customers with IPv4 addressing information.
• The show ip interface g0/1 command confirms that the interface is up and that the address was allocated
by a DHCPv4 server.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 28
Configure a DHCPv4 Client
Home Router as a DHCPv4 Client
Home routers are typically already set to receive IPv4 addressing information automatically from the
ISP. This is so that customers can easily set up the router and connect to the internet.
• For example, the figure shows the default WAN setup page for a Packet Tracer wireless router.
Notice that the internet connection type is set to Automatic Configuration - DHCP. This
selection is used when the router is connected to a DSL or cable modem and acts as a DHCPv4
client, requesting an IPv4 address from the ISP.
• Various manufacturers of home routers will have a similar setup.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 29

You might also like