PPA.Lab - Dynamic Host Configuration Protocol

GNS3

1. Topology

2.Configure basic settings

R1

R1#
R1#enable
R1#configure terminal
R1(config)#interface fa0/0
R1(config-if)#ip address 172.16.1.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#exit
R1(config)#ip dhcp excluded-address 172.16.1.1 172.16.1.100
R1(config)#ip dhcp pool LOOPBACK
R1(dhcp-config)#network 172.16.1.0 255.255.255.0
R1(dhcp-config)#lease 2
R1(dhcp-config)#default-router 172.16.1.1
R1(dhcp-config)#dns-server 172.16.1.1

PC

C:\>ipconfig /renew

....
Ethernet adapter Local Area Connection 7:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::858e:7937:150f:df1e%29
   IPv4 Address. . . . . . . . . . . : 172.16.1.101
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 172.16.1.1

...

3. Display Filters on Wireshark

dhcp

4. Sample .pcap file

5.History

  • In the early days of networking, when a device wanted to communicate over a network, it needed to be assigned an address by hand.

  • As networks grew, this manual process quickly became cumbersome. To solve this problem, Bootstrap Protocol (BOOTP) was created to automatically assign addresses to network-connected devices.

  • BOOTP was later replaced with the more sophisticated Dynamic Host Configuration Protocol (DHCP).

6.Definition

  • DHCP is an application-layer protocol responsible for allowing a device to automatically obtain an IP address (and addresses of other important network assets, such as DNS servers and routers).

  • Most DHCP servers today also provide other parameters to clients, such as the addresses of the default gateway and DNS servers in use on the network.

7.DHCP Packet Structure

OpCode

  • Indicates whether the packet is a DHCP request or a DHCP reply

Hardware Type

  • The type of hardware address (10MB Ethernet, IEEE 802, ATM, and so on)

Hardware Length

  • The length of the hardware address

Hops

  • Used by relay agents to assist in finding a DHCP server

Transaction ID

  • A random number used to pair requests with responses

Seconds Elapsed

  • Seconds since the client first requested an address from the DHCP server

Flags

  • The types of traffic the DHCP client can accept (unicast, broadcast, and so on)

Client IP Address

  • The client’s IP address (derived from the Your IP Address field)

Your IP Address

  • The IP address offered by the DHCP server (ultimately becomes the Client IP Address field value)

Server IP Address

  • The DHCP server’s IP address

Gateway IP Address

  • The IP address of the network’s default gateway

Client Hardware Address

  • The client’s MAC address

Server Host Name

  • The server’s hostname (optional)

Boot File

  • A boot file for use by DHCP (optional)

Options

  • Used to expand the structure of the DHCP packet to give it more features

8.The DHCP Initialization Process

The DHCP initialization process is often referred to as the DORA process because it uses four types of DHCP packets: discover, offer, request, and acknowledgment.

Last updated