====== DHCP ====== **DHCP (Dynamic Host Configuration Protocol)** is a network protocol that automatically assigns IP configuration to devices on a network. Instead of manually configuring every computer, DHCP provides network settings automatically when a device joins the network. Typical information assigned by DHCP includes: * IP address * Subnet mask * Default gateway * DNS servers * Lease time ----- ===== Why Is DHCP Needed? ===== Without DHCP, every device would need to be configured manually. For example: IP Address: 192.168.1.25 Subnet Mask: 255.255.255.0 Default Gateway: 192.168.1.1 DNS Server: 8.8.8.8 For a home with a few devices this may be manageable, but for schools, offices, or enterprises with hundreds or thousands of devices, manual configuration would be impractical. DHCP automates this process. ----- ===== How DHCP Works ===== When a device connects to a network, it typically performs four steps. Client │ │ 1. DHCP Discover ▼ DHCP Server ▲ │ 2. DHCP Offer │ Client │ │ 3. DHCP Request ▼ DHCP Server ▲ │ 4. DHCP Acknowledgement (ACK) │ Client receives its IP configuration This process is commonly called the **DORA** process: * **D**iscover * **O**ffer * **R**equest * **A**cknowledgement ----- ===== Example ===== A laptop joins a Wi-Fi network. The DHCP server assigns: IP Address: 192.168.1.25 Subnet Mask: 255.255.255.0 Gateway: 192.168.1.1 DNS: 8.8.8.8 The user does not need to enter any of these values manually. ----- ===== DHCP Lease ===== DHCP assigns addresses for a limited period called the **lease time**. Example: Lease Time 24 hours Before the lease expires, the client usually requests to renew it. If renewal succeeds, the device typically keeps the same IP address. ----- ===== DHCP Server ===== A DHCP server may be: * A home Wi-Fi router * A dedicated server * A firewall * A Layer 3 switch In most home networks, the wireless router also acts as the DHCP server. ----- ===== Static vs Dynamic Addresses ===== A device may use either: === Dynamic Address === Assigned automatically by DHCP. Suitable for: * Computers * Smartphones * Tablets * Guest devices ----- === Static Address === Configured manually. Often used for: * Servers * Printers * Network cameras * Firewalls ----- ===== DHCP Reservation ===== Many DHCP servers support **reservations**. A reservation means a particular device always receives the same IP address. Example: Printer MAC Address 00:1A:2B:3C:4D:5E ↓ Always receives 192.168.1.100 This combines automatic management with predictable addressing. ----- ===== DHCP and IPv6 ===== IPv6 also supports DHCP. However, IPv6 devices may obtain network information through: * Router Advertisements (RA) * DHCPv6 * Both Unlike IPv4, DHCP is not always required in IPv6 networks. ----- ===== What Happens If DHCP Fails? ===== If no DHCP server is available, a device may: * Fail to obtain an IP address. * Assign itself a link-local address. Example (Windows): 169.254.x.x Such an address allows limited communication within the local network but usually does not provide Internet access. ----- ===== DHCP and Telenegar ===== Current Telenegar Internet tools do not directly display DHCP information because DHCP operates only within the local network. However, understanding DHCP helps explain why: * A device receives its IP address automatically. * Local network configuration changes. * Internet access may fail after connecting to a network. ----- ===== Common Misconceptions ===== * **DHCP changes the MAC address.** * False. DHCP assigns IP configuration, not hardware addresses. * **DHCP always assigns a different IP address.** * False. A device often receives the same address repeatedly, especially if its lease is renewed. * **Only large organizations use DHCP.** * False. Almost every home router includes a DHCP server. ----- ===== Related Topics ===== * [[networking:internet:ip-addresses|IP Addresses]] * [[networking:internet:default-gateway|Default Gateway]] * [[networking:internet:mac-address|MAC Address]] * [[networking:internet:subnetting|Subnetting]] * [[networking:internet:nat|Network Address Translation (NAT)]] ----- {{tag>dhcp ip networking ipv4 ipv6 dora}}