0% found this document useful (0 votes)
26 views27 pages

DHCP

The document explains the Dynamic Host Configuration Protocol (DHCP), which enables devices to automatically obtain network configuration details like IP addresses without manual setup. It covers the basic functions of DHCP, including the DHCP discovery, offer, request, and acknowledgment process, as well as configuration steps for DHCP servers and clients in Cisco IOS. Additionally, it discusses the role of DHCP relay agents in larger networks to facilitate communication between clients and centralized DHCP servers.

Uploaded by

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

DHCP

The document explains the Dynamic Host Configuration Protocol (DHCP), which enables devices to automatically obtain network configuration details like IP addresses without manual setup. It covers the basic functions of DHCP, including the DHCP discovery, offer, request, and acknowledgment process, as well as configuration steps for DHCP servers and clients in Cisco IOS. Additionally, it discusses the role of DHCP relay agents in larger networks to facilitate communication between clients and centralized DHCP servers.

Uploaded by

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

Dynamic Host Configuration Protocol (DHCP)

Things we’ll cover



The purpose of DHCP


Basic functions of DHCP


Configuring DHCP in Cisco IOS
The Purpose of DHCP
● DHCP is used to allow hosts to automatically/dynamically learn various aspects
of their network configuration, such as IP address, subnet mask, default
gateway, DNS server, etc, without manual/static configuration.

● It is an essential part of modern networks.


→When you connect a phone/laptop to WiFi, do you ask the network admin which IP
address, subnet mask, default gateway, etc, the phone/laptop should use?


Typically used for ‘client devices’ such as workstations (PCs),
phones, etc.

Devices such as routers, servers, etc, are usually manually
configured.

In small networks (such as home networks) the router typically acts as the
DHCP server for hosts in the LAN.

In larger networks, the DHCP server is usually a
Windows/Linux server.
The Basic Functions of DHCP
The Basic Functions of DHCP
The Basic Functions of DHCP
C:\Users\
user>ipconfig /all
[output omitted]
Ethernet adapter
Ethernet0: This PC was previously assigned this IP address by the DHCP
Connection-specific DNS Suffix server, so it asked to receive the same address again this
Description . . . . . . . . . . . :time.
Intel(R) 82579LM Gigabit Network
Physical Address. . . . . . . .
Connection
. : . : 78-2B-CB-AC-
DHCP Enabled. . . . . . . . . .
08-67 . :
Yes
Autoconfiguration Enabled . . . . :
IPv4
Yes Address. . . . . . . . . . . : (Preferred
192.168.0.167 )
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Lease Obtained. . . . . . . . . . : Saturday, January 23, 2021
12:02:04 PM Lease Expires . . . . . . . . . . : Saturday, January
23, 2021 2:02:05 PM
Default Gateway . . . . . . . . . :
NetBIOS over Tcpip. . . . . . . . :
192.168.0.1
DHCP Server . . . . . . . . . . . :
Enabled
192.168.0.1
DNS Servers
[output . . . . . . . . . . . :
omitted]
192.168.0.1 DHCP server ‘lease’ IP address to clients.
These leases are usually not permanent, and the client must
give up the address at the end of the lease.
ipconfig /release
C:\Users\user>ipconfig
/release
Windows IP
Configuration [output
Ethernet adapter Ethernet0:
omitted]
Connection-specific DNS Suffix
. : Default Gateway . . . . . .
. . . :
[output
omitted]

192.168.0.167 is now
free to assign to
another client. DHCP Release:
I don’t need this
address anymore.

. .16
192.168.0.0/
1 7
24
DHCP
Release

.1
DHCP servers use UDP
67. DHCP clients use UDP
68.
192.168.0.0/
24

.16
7
ipconfig /renew
C:\Users\user>ipconfig /renew
C:\Users\user>ipconfig /all

Ethernet adapter Ethernet0:


Connection-specific DNS Suffix
. :
Description . . . . . . . . . . . : Intel(R) 82579LM Gigabit Network
Connection Physical Address. . . . . . . . . : 78-2B-CB-AC-08-67
DHCP Enabled. . . . . . . . . . . :
Yes Autoconfiguration Enabled . . .
. : Yes
IPv4 Address. . . . . . . . . . . :
192.168.0.167(Preferred)
Subnet Mask . . . . . . . . . . . :
255.255.255.0
Lease Obtained. . . . . . . . . . : Saturday, January 23, 2021
3:07:39 PM Lease Expires . . . . . . . . . . : Saturday, January
23, 2021 5:07:38 PM Default Gateway . . . . . . . . . :
192.168.0.1
DHCP Server . . . . . . . . . . . : 192.168.0.1
DNS Servers . . . . . . . . . . . : 192.168.0.1
NetBIOS over Tcpip. . . . . . . . : Enabled

. .16
192.168.0.0/
1 7
24
DHCP
Discover DHCP Discover:
Are there any DHCP servers in this
network? I need an IP address.

.
192.168.0.0/
1
24
DHCP
Discover

.1

192.168.0.0/
24
DHCP Offer
DHCP Discover:
Are there any DHCP servers in this
network? I need an IP address.

DHCP Offer:
How about this IP
address?

.
192.168.0.0/
1
24
DHCP Offer

.1

The DHCP Offer message can


be either broadcast or
192.168.0.0/ unicast.
24
DHCP
Request DHCP Discover:
Are there any DHCP servers in this
network? I need an IP address.

DHCP Offer:
How about this IP
address?
DHCP Request:
I want to use the IP address
you offered me.

.
192.168.0.0/
1
24
DHCP
Request

.1

192.168.0.0/
24
DHCP Ack
DHCP Discover:
Are there any DHCP servers in this
network? I need an IP address.

DHCP Offer:
How about this IP
address?

DHCP Request:
I want to use the IP address
you offered me.

DHCP Ack:
Okay, you may use
it.

.
192.168.0.0/ .16
1 7
24
DHCP Ack

.1

The DHCP Ack message can


be either broadcast or
192.168.0.0/ unicast.
24
DHCP D-O-R-A

Discover Client → Server Broadcast

Offer Server →Client Broadcast or Unicast

Request Client → Server Broadcast

Ack Server →Client Broadcast or Unicast

Release Client → Server Unicast


DHCP

Relay
Some network engineers might choose to configure each router to act as the
DHCP server for its connected LANs.

However, large enterprises often choose to use a centralized
DHCP server.

If the server is centralized, it won’t receive the DHCP clients’ broadcast DHCP
messages. (broadcast messages don’t leave the local subnet)

To fix this, you can configure a router to act as a DHCP relay
agent.

The router will forward the clients’ broadcast DHCP messages to the remote
DHCP server as unicast messages.

192.168.10.0/ 10.0.0.0/3 192.168.1.0/


0
24 24
.1 .2 .1 .1
.10 g0/1 g0/0 g0/0 g0/1

R2 R1 PC1
SRV1
DHCP
Relay
Src: 192.168.1.1 Dst: Src: 0.0.0.0 Dst:
192.168.10.10 255.255.255.255 Discove
r
Src: 192.168.10.10 Dst: Src: 192.168.1.1 Dst: (unicast or
Offe 192.168.1.1 255.255.255.255)

r
Src: 192.168.1.1 Dst: Src: 0.0.0.0 Dst:
192.168.10.10 255.255.255.255 Reques
t
Src: 192.168.10.10 Dst: Src: 192.168.1.1 Dst: (unicast or
Ac 192.168.1.1 255.255.255.255)

DHCP
Relay
192.168.10.0/ 10.0.0.0/3 Agent 192.168.1.0/
24 0 24
. .2 . .1
DHCP .10 g0/1 g0/ g0/1 g0/1 .100
Serve 1 0 0
r
R2 R1 PC1
SRV1
DHCP Server Configuration in IOS
R1(config)#ip dhcp excluded-address 192.168.1.1 Specify a range of addresses that
192.168.1.10 won’t
R1(config)#ip dhcp pool be given to DHCP clients.
LAB_POOL Create a DHCP pool.
R1(dhcp-config)#network 192.168.1.0 ?
/nn or A.B.C.D Network mask or prefix
length Specify the subnet of addresses to be
<cr> assigned to clients (except the excluded
addresses)
R1(dhcp-config)#network 192.168.1.0 /24
R1(dhcp-config)#dns-server Specify the DNS server that DHCP
8.8.8.8 clients should use.
R1(dhcp-config)#domain-name ensab.com

R1(dhcp-config)#default-router Specify the domain name of the


192.168.1.1 network. (ie. PC1 = pc1.ensab.com)
R1(dhcp-config)#lease 0 5
30
Specify the default
gateway.
Specify the lease time.
lease days hours minutes OR
lease infinite

192.168.1.0/
.1
R1 24
.1
g0/ PC1
1 1
DHCP Server Configuration in IOS
R1#show ip dhcp binding
Bindings from all pools not associated with
IP
VRF: Client-ID/ Lease Typ
address Hardware expiration e
address/ User
192.168.1.11 name Jan 24 2021 10:52 Automati
0100.0c29.e727.39 AM c
C:\Users\
user>ipconfig /all
Ethernet adapter
Connection-specific DNS Suffix
Ethernet0: . :
Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Network
ensab.com
Connection #2 Physical Address. . . . . . . . . : 00-0C-29-E7-27-39
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . :
Yes IPv4 . . . . . . . . . : 192.168.1.11(Preferre
Address. . d)
Subnet . . . . . . . . . : 255.255.255.0
Mask . .
Lease . . . . . . . . . : Saturday, January 24, 2021
Obtained. 2:22:35 PM
Lease . . . . . . . . . : Saturday, January 24, 2021
Expires
NetBIOS . Tcpip. . . . . . . .7:52:35
over : PM
Default . . . . . . . . . : 192.168.1.
Enabled
Gateway 1
DHCP . . . 192.168.1.0/
. . . . . . : 192.168.1.
Server .1
R1 . . 24 1
.1
DNS . . . . . . . . . : 8.8.8.8
Servers . . g0/ PC1
1 1
DHCP Relay Agent Configuration in IOS
Configure the interface connected to the
R1(config)#interface
subnet of the client devices.
g0/1
R1(config-if)#ip helper-address
192.168.10.10 Configure the IP address of the DHCP
R1(config-if)#do show ip interface g0/1 server as the ‘helper’ address.
GigabitEthernet0/1 is up, line protocol
is up
Internet address is 192.168.1.1/24
Broadcast address is 255.255.255.255
MTU is 1500
Address determined by non-volatile
memory
Helper
bytes address is
192.168.10.10
[output
omitted]

DHCP
Relay
192.168.10.0/ 10.0.0.0/3 Agent 192.168.1.0/
24 0 24
. .2 . .1
DHCP .10 g0/1 g0/ g0/1 g0/1 .10
Serve 1 0 0 0
r
R2 R1 PC1
SRV1
DHCP Client Configuration in IOS
R2(config)#interface
g0/1
R2(config-if)#ip address
dhcp Use the ip address dhcp mode to tell
R2(config-if)#do sh ip interface g0/1 the router to use DHCP to learn its IP
GigabitEthernet0/1 is up, line protocol
isInternet
up address is address.
192.168.10.1/24 Broadcast address
is 255.255.255.255 Address
determined by DHCP
[output
omitted]

DHCP DHCP
Clien Relay
192.168.10.0/ t 10.0.0.0/3 Agent 192.168.1.0/
24 0 24
.1 . . .1
DHCP .10 g0/1 2
g0/ g0/1 g0/1 .100
Serve 0 0
r
R2 R1 PC1
SRV1
Command Summary
C:\Users\user> ipconfig /release
C:\Users\user> ipconfig /renew

R1(config)# ip dhcp excluded-address low-address high-


address

R1(config)# ip dhcp pool pool-name


R1(dhcp-config)# network ip-address {/prefix-length | subnet-
R1(dhcp-config)#
mask} dns-server ip-
address DHCP server
R1(dhcp-config)# domain-name domain-name
R1(dhcp-config)# default-router ip-address
R1(dhcp-config)# lease {days hours minutes |
infinite} R1# show ip dhcp binding
R1(config-if)# ip helper-address ip- DHCP relay agent
address
R1(config-if)# ip address DHCP
dhcp client
Things we covered

The purpose of DHCP


Basic functions of DHCP


Configuring DHCP in Cisco IOS
Supplementary Materials

Packet Tracer lab

You might also like