DHCP

DHCP (Dynamic Host Configuration Protocol): An application-layer client-server protocol for allowing a device to automatically obtain an IP address.

DHCP also allows a host to learn additional information, e.g. its subnet mask; the address of its first-hop router (i.e. the default gateway); the address of its local DNS server.

A network administrator can configure DHCP so that a host 1) receives the same IP address each time it connects to the network; or 2) is assigned a temporary IP address that will be different each time it connects to the network.

DHCP is often referred to as a plug-and-play protocol.

DHCP is useful in residential Internet access network, wireless LANs and residential ISP access network.

DHCP relies on UDP as its transport layer protocol, it has its own built-in reliability measures.

DHCP Packet Structure

DHCP

OpCode: indicates whether the packet is a DHCP request or reply;

Hardware type: the type of hardware address, e.g. 10MB Ethernet, IEEE802, ATM;

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 type of traffic the DHCP client can accept e.g. unicast, broadcast;

Client IP Address: The client's IP address (derived from Your IP Address field);

Your IP Address: The IP address offered by the DHCP server (ultimately becoms 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: (optional) The server's host name 

Boot File: (optional) A boot file for use by DHCP

Options: Used to expand the structure of the DHCP packet to give it more features.

4-step process of DHCP Initialization: Discover-Offer-Request-Acknowledgment

-- this DORA process occurs the first time a client gets an IP address or when its lease has expired.

DHCP

DHCP

1) DHCP server discovery

The client passes an IP datagram that encapsulate DHCP discover message (a UDP packet to port 67), with broadcast destination IP address (255.255.255.255) and “this host” source IP address (0.0.0.0, because it does not yet have an iP address)to the link layer.

e.g. DHCP discover packet 

DHCP

- requested IP Address: supplies the IP address the client would like to receive, cna be previously used IP address or 0.0.0.0 to indicate no preference.

- parameter request list: lists the different configuration items (IP addresses of other important network devices and other non IP items) the client would like to receive from DHCP server. 

2) DHCP server offer(s)

A DHCP server responds with a DHCP offer message (contains the transaction ID of the received discover message, the proposed IP address for the client, other additional information: subnet mask, IP address lease time, router address, domain name ...) that is broadcast to all nodes on the subnet.

e.g. DHCP offer packet

DHCP

- transaction ID: the same as the previous discover packet, indicating this is the response to the original request;

- Your IP address: the IP address offered to the client;

3) DHCP request

The client choose from among one or more server offers and respond to one with a DHCP request message, echoing back the configuration parameters.

e.g. DHCP request packet

DHCP

 - transaction ID is the same as the previous 2 (disover and offer) packets.

4) DHCP ACK

The server responds with a DHCP ACK message, confirming the requested parameters, and records that information in its database.

DHCP

- The client now has an IP address and can use it to begin communicating on the network.

In-Lease Renewal

A clients is allowed to use the IP adress for only a limited amount of time before it must renew the lease.

in-lease renewal: When a client with an IP address in-lease reboots, it performs truncated version of the DORA process (the discovery and offer packets are removed, leaving only request and acknowledgement) to reclaim its IP address.

上一篇:PAT (Advanced Level) Practice 1101 Quick Sort (25 分) 凌宸1642


下一篇:At present, the main retained version of iQOO Neo3