#readwise
# Network Foundations - Dynamic Host Configuration Protocol (DHCP)

## Metadata
- Author: [[Hack The Box]]
- Full Title: Network Foundations - Dynamic Host Configuration Protocol (DHCP)
- URL: https://academy.hackthebox.com/module/289/section/3239
## Summary
DHCP helps assign unique IP addresses to devices on a network automatically. It simplifies network management by reducing manual tasks and preventing address conflicts. The process involves four steps: Discover, Offer, Request, and Acknowledge. IP addresses assigned by DHCP are temporary and must be renewed after a set lease time.
## Highlights
`DHCP` is a network management protocol used to automate the process of configuring devices on IP networks. It allows devices to automatically receive an IP address and other network configuration parameters, such as subnet mask, default gateway, and DNS servers, without manual intervention. ([View Highlight](https://read.readwise.io/read/01jnx1a2kvg78nnrwmc0v3rnfr))
---
The DHCP process involves a series of interactions between the client (the device requesting an IP address) and the DHCP server (the service running on a network device that assigns IP addresses). This process is often referred to as `DORA`, an acronym for `Discover`, `Offer`, `Request`, and `Acknowledge`. Below we see a breakdown of DORA.
| Step | Description |
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `1. Discover` | When a device connects to the network, it broadcasts a DHCP Discover message to find available DHCP servers. |
| `2. Offer` | DHCP servers on the network receive the discover message and respond with a DHCP Offer message, proposing an IP address lease to the client. |
| `3. Request` | The client receives the offer and replies with a DHCP Request message, indicating that it accepts the offered IP address. |
| `4. Acknowledge` | The DHCP server sends a DHCP Acknowledge message, confirming that the client has been assigned the IP address. The client can now use the IP address to communicate on the network. |
---
The IP address assignment via DHCP is not permanent but is instead issued with a specific lease time. For instance, a DHCP server might assign an IP address to a smartphone with a lease time of 24 hours. After this period, the smartphone must request a renewal of the lease to continue using the IP address. Regarding the renewal process, before the lease expires, the client must proactively attempt to renew its IP address lease. This involves sending a renewal request to the DHCP server. As the lease nears its expiration, the client communicates with the DHCP server, asking if it can continue using the assigned IP address, to which the server can respond affirmatively, extending the lease. ([View Highlight](https://read.readwise.io/read/01jnx1dacp6pzjycsk214yqj46))
---