DHCPv4 Concepts

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

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.

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)

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.

  1. DHCP Acknowledgment (DHCPACK)

On receiving the DHCPREQUEST message, the server verifies the lease information by returning a DHCPACK.

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-addressand high-addressof 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)#.
    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

DHCPv4 Relay

  • 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.
  • show ip interface G0/0/0 command to verify the configuration

Verify DHCPv4

Displays the DHCPv4 commands configured on the router.

Displays a list of all IPv4 address to MAC address bindings provided by the DHCPv4 service.

Verify DHCPv4

Displays count information regarding the number of DHCPv4 messages that have been sent and received

Verify DHCPv4 Client Received IPv4 Addressing

https://github.com/pnetlabrepo/ishare2/tree/main/upgrades/from_any_to_5.3.11

DHCP Attack LAB

SW(config)#
ip dhcp snooping
ip dhcp snooping vlan 1

interface f0/4
ip dhcp snooping trust