Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

DHCP Overview

 
Summary

Learn about Dynamic Host Configuration Protocol (DHCP), a network management protocol where a DHCP server dynamically assigns an IP address and other network configuration parameters to end hosts in the network to facilitate communication among the endpoints.

Benefits of DHCP

Benefits of DHCP include:

  • DHCP enables network administrators centrally manage a pool of IP addresses among hosts and automate the assignment of IP addresses in a network.

  • DHCP help you reduce the number of IP addresses needed on the network when you use it to manage a pool of IP addresses among hosts. DHCP does this by leasing an IP address to a host for a limited period of time, allowing the DHCP server to share a limited number of IP addresses.

  • DHCP minimizes the overhead required to add clients to the network by providing a centralized, server-based setup, which means that you do not have to manually create and maintain IP address assignments for clients.

  • DHCP provides a central database of devices that are connected to the network and eliminates duplicate resource assignments.

  • DHCP automates network-parameter assignment to network devices. Even in small networks, DHCP is useful because it makes it easy to add new machines to the network.

  • DHCP provides other configuration information, particularly the IP addresses of local caching Domain Name System (DNS) resolvers, network boot servers, or other service hosts in addition to IP addresses for clients.

  • DHCP on the Junos OS device can automatically upgrade software on client systems.

Introduction to DHCP

Dynamic Host Configuration Protocol (DHCP) is a network management protocol used in TCP/IP networks to dynamically assign IP addresses and other related configuration information to network devices.

On Junos OS devices, DHCP provides:

  • A framework for passing configuration information to clients in the subnet.

  • Reusable network addresses and configuration options to Internet hosts.

DHCP is based on BOOTP, a bootstrap protocol that allows a client to discover its own IP address, the IP address of a server host, and the name of a bootstrap file. DHCP servers can handle requests from BOOTP clients, but provide additional capabilities beyond BOOTP, such as the automatic allocation of reusable IP addresses and additional configuration options.

The Juniper Networks device acts as the DHCP server, providing IP addresses and settings to hosts that are connected to the device interfaces. The DHCP server is compatible with the DHCP servers of other vendors on the network. The device can also operate as a DHCP client and DHCP relay agent.

Understand DHCP

DHCP Use Cases

  • In a typical carrier edge network configuration, the DHCP client is on the subscriber’s computer or customer premises equipment (CPE), and the DHCP local server is configured on the router.

  • In a typical network configuration, the DHCP client is on an access device, such as a personal computer, and the DHCP local server is configured on the switch.

  • In a typical branch network configuration, the DHCP client is on the subscriber’s computer, and the DHCP relay agent is configured on the device between the DHCP client and one or more DHCP local servers.

DHCP Components

The DHCP architecture consists DHCP servers, DHCP clients, and DHCP relay agents. The client interacts with servers using DHCP messages in a DHCP conversation to obtain and renew IP address leases and network configuration parameters. Here is a brief description of the DHCP components:

DHCP Server

A DHCP server is a device or server in the network that automatically assigns IP addresses and other network parameters to client devices. A Junos OS device acting as a DHCP server is compatible with DHCP servers from other vendors on the network.

DHCP server assigns the following configuration parameters to client device:

  • Provides temporary IP addresses from an IP address pool to all clients on a specified subnet (dynamic binding)

  • Assigns permanent IP addresses to specific clients based on their media access control (MAC) addresses (static binding).

  • Assigns following configuration parameters:

    • IP address

    • Subnet mask

    • Default gateway for the network

    • DNS server

  • A DHCP server provides persistent storage of network parameters for clients. Because DHCP is an extension of BOOTP, DHCP servers can handle BOOTP requests.

The server does not support IPv6 address assignment, user class-specific configuration, DHCP failover protocol, dynamic DNS updates, or VPN connections. The Junos-FIPS software does not support the DHCP server.

Note

You cannot configure a router as a DHCP server and a BOOTP relay agent at the same time.

DHCP Client

A DHCP client is any IP device connected in the network that is configured to act as a host requesting configuration parameters such as an IP address from a DHCP server.

A Juniper Networks device acting as a DHCP client receives its TCP/IP settings and the IP address for any physical interface in any security zone from an external DHCP server. For the device to operate as a DHCP client, you configure a logical interface on the device to obtain an IP address from the DHCP server in the network. You set the vendor class ID, lease time, DHCP server address, retransmission attempts, and retry interval. You can renew DHCP client releases.

DHCP Relay

DHCP relay agent is any TCP/IP host that forwards DHCP messages between servers and clients when DHCP client and a DHCP server reside in different subnets. For example, in large network that has multiple subnets, a single DHCP server can serve all the clients in the entire network with help of DHCP relay agents located on the interconnecting routers.

You can configure a Junos OS device either as a DHCP server or as a DHCP relay server, but not both. Whereas a DHCP server replies to a client with an IP address, a DHCP relay server relays DHCP messages to and from the configured DHCP server, even if the client and server are on different IP networks. Configure a device to be a DHCP relay agent if you have locally attached hosts and a remote DHCP server.

DHCP Client and Server Model

DHCP IP address allocation works on a client/server model in which the server, in this case a Junos OS, assigns the client reusable IP information from an address pool. A DHCP client might receive offer messages from multiple DHCP servers and can accept any one of the offers; however, the client usually accepts the first offer it receives. See Figure 1.

Figure 1: DHCP Client/Server Model
DHCP Client/Server Model
Figure 2: DHCP Four-Step Transfer
DHCP Four-Step Transfer

DHCP consists of a four-step transfer process beginning with a broadcast DHCP discovery message from the client. As the second step, the client receives a DHCP offer message from the server. This message includes the IP address and mask, and some other specific parameters. The client then sends a DHCP request message to accept the IP address and other parameters that it received from the server in the previous step. The DHCP server sends a DHCP response message and removes the now-allocated address from the DHCP address pool. See Figure 2.

Note

Because the DHCP discovery message from the client is a broadcast message and because broadcast messages cross other segments only when they are explicitly routed, you might have to configure a DHCP relay agent on the switch interface so that all DHCP discovery messages from the clients are forwarded to one DHCP server.

The device supports DHCP client requests received on any Ethernet interface. DHCP requests received from a relay agent are supported on all interface types. DHCP is not supported on interfaces that are part of a virtual private network (VPN).

DHCP Client, Server, and Relay Agent Model

The DHCP relay agent is located between a DHCP client and DHCP server and forwards DHCP messages between servers and clients as following:

  1. The DHCP client sends a discover packet to find a DHCP server in the network from which to obtain configuration parameters for the subscriber (or DHCP client), including an IP address.

  2. The DHCP relay agent receives the discover packet and forwards copies to each of the two DHCP servers. The DHCP relay agent then creates an entry in its internal client table to keep track of the client’s state.

  3. In response to receiving the discover packet, each DHCP server sends an offer packet to the client. The DHCP relay agent receives the offer packets and forwards them to the DHCP client.

  4. On receipt of the offer packets, the DHCP client selects the DHCP server from which to obtain configuration information. Typically, the client selects the server that offers the longest lease time on the IP address.

  5. The DHCP client sends a request packet that specifies the DHCP server from which to obtain configuration information.

  6. The DHCP relay agent receives the request packet and forwards copies to each of the two DHCP servers.

  7. The DHCP server requested by the client sends an acknowledgement (ACK) packet that contains the client’s configuration parameters.

  8. The DHCP relay agent receives the ACK packet and forwards it to the client.

  9. The DHCP client receives the ACK packet and stores the configuration information.

  10. If configured to do so, the DHCP relay agent installs a host route and Address Resolution Protocol (ARP) entry for this client.

  11. After establishing the initial lease on the IP address, the DHCP client and the DHCP server use unicast transmission to negotiate lease renewal or release. The DHCP relay agent “snoops” on all of the packets unicast between the client and the server that pass through the router (or switch) to determine when the lease for this client has expired or been released. This process is referred to as lease shadowing or passive snooping.

DHCP Conflict Detection and Resolution

A client that receives an IP address from the device operating as a DHCP server performs a series of Address Resolution Protocol (ARP) tests to verify that the address is available and no conflicts exist. If the client detects an address conflict, it informs the DHCP server about the conflict and can request another IP address from the DHCP server.

The device maintains a log of all client-detected conflicts and removes addresses with conflicts from the DHCP address pool. To display the conflicts list, you use the show system services dhcp conflict command. The addresses in the conflicts list remain excluded until you use the clear system services dhcp conflict command to manually clear the list.

Enable a DHCP Local Server, DHCP Relay Agent, and DHCP Client in a Routing Instance

The following considerations apply when you enable a DHCP local server, DHCP relay agent, or DHCP client in a routing instance:

  • The DHCP local server, DHCP relay agent, and DHCP client can be configured in one routing instance, but the functionality is mutually exclusive on one interface. If the DHCP client is enabled on one interface, the DHCP local server or the DHCP relay agent cannot be enabled on that interface.

  • The DHCP client, DHCP relay agent and DHCP local server services act independently in their respective routing instance. The following features can function simultaneously on a device:

    • DHCP client and DHCP local server

    • DHCP client and DHCP relay agent

    • Multiple routing instances. Each instance can have a DHCP local server, DHCP relay agent, or DHCP client, or each routing instance can have a DHCP client and DHCP local server or a DHCP client and DHCP relay agent.

  • Before you enable DHCP services in a routing instance, you must remove all the configuration related to DHCP services that does not include routing instance support. If you do not do this, the old default routing instance configuration will override the new routing instance configuration.

  • On all SRX Series devices, logical systems and routing instances are not supported for a DHCP client in chassis cluster mode.