Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

DHCP Client

SRX Series device can act as a DHCP client, receiving its TCP/IP settings and the IP address for any physical interface in any security zone from an external DHCP server. The device can also act as a DHCP server, providing TCP/IP settings and IP addresses to clients in any zone. For more information, read this topic.

Understanding DHCP Client Operation

A Juniper Networks device can act as a DHCP client, receiving its TCP/IP settings and the IP address for any physical interface in any security zone from an external DHCP server. The device can also act as a DHCP server, providing TCP/IP settings and IP addresses to clients in any zone. When the device operates as a DHCP client and a DHCP server simultaneously, it can transfer the TCP/IP settings learned through its DHCP client module to its default DHCP server module. 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 client operations are supported on all SRX Series Firewalls in chassis cluster mode.

Minimum DHCP Client Configuration

The following sample output shows the minimum configuration you must use to configure an SRX300, SRX320, SRX340, SRX345, SRX550M, or SRX1500 device as a DHCP client. In this output, the interface is ge-0/0/0 and the logical unit is 0.

Note:

To configure a DHCP client in a routing instance, add the interface in a routing instance using the [edit routing-instances] hierarchy.

Configuring a DHCP Client

A Dynamic Host Configuration Protocol (DHCP) server can provide many valuable TCP/IP network services. DHCP can dynamically allocate IP parameters, such as an IP address, to clients, and it can also deliver software upgrades to clients.

DHCP configuration consists of two components, configuration of DHCP clients and configuration of a DHCP server. Client configuration determines how clients send a message requesting an IP address, whereas a DHCP server configuration enables the server to send an IP address configuration back to the client. This topic describes configuring a DHCP client. For directions for configuring a DHCP server, see Configuring a DHCP Server on Switches or Configuring a Switch as a DHCP Server.

You can change DHCP client configurations from the switch, using client identifiers to indicate which clients you want to configure.

To configure a DHCP client, you configure an interface to belong to the DHCP family and specify additional attributes, as desired:

Note:

Starting in Junos OS Release 18.1R1, DHCPv4 and DHCPv6 clients are supported on management interfaces (fxp0 and em0) configured in the non-default management routing instance, mgmt_junos.

The options that you can configure are listed in Table 1. Replace the variable configuration-statement with one or more of the statements listed in this table. If you do not explicitly configure these options, the switch uses default values for them.

Table 1: DHCP Client Settings

Configuration Statement

Description

client-identifier

Unique client ID—By default this consists of the hardware type (01 for Ethernet) and the MAC address (a.b.c.d). For this example, the value would be 01abcd.

lease-time

Time in seconds that a client holds the lease for an IP address assigned by a DHCP server. If a client does not request a specific lease time, then the server sends the default lease time. The default lease time on a Junos OS DHCP server is 1 day.

Note:

Starting in Junos OS Release 23.4R1, the DHCP client silently discards the DHCP OFFER which has a lease-time less than 15 seconds.

retransmission-attempt

Number of times the client attempts to retransmit a DHCP packet.

retransmission-interval

Time between transmission attempts.

server-address

IP address of the server that the client queries for an IP address.

update-server

TCP/IP settings learned from an external DHCP server to the DHCP server running on the switch are propagated.

vendor-option

Vendor class ID (CPU's manufacturer ID string) for the DHCP client.

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 local server in the network. You can then set the client-identifier, options no-hostname, lease time, retransmission attempts, retry interval, preferred DHCP local server address, and vendor class ID.

To configure optional DHCP client attributes on SRX300, SRX320, SRX340, SRX550M, and SRX1500 devices:

  1. Configure the DHCP client identifier prefix as the routing instance name.
  2. Configure the DHCP options no-hostname if you do not want the client to send hostname (RFC option code 12) in the packets.
  3. Set the DHCP lease time.
  4. Set the number of attempts allowed to retransmit a DHCP packet.
  5. Set the interval (in seconds) allowed between retransmission attempts. The range is 4 through 64. The default is 4 seconds.
  6. Set the IPv4 address of the preferred DHCP local server.
  7. Set the vendor class ID for the DHCP client.
    Note:

    To configure the DHCP client in a routing instance, configure the interface in the [edit routing-instances] hierarchy.

Example: Configuring the Device as a DHCP Client

This example shows how to configure the device as a DHCP client.

Requirements

Before you begin:

  • Determine the IP address pools and the lease durations to use for each subnet. You can use the show system services dhcp pool CLI command to view information on DHCP address pools.

  • Obtain the MAC addresses of the clients that require permanent IP addresses. Determine the IP addresses to use for these clients.

  • List the IP addresses that are available for the servers and devices on your network; for example, DNS, NetBIOS servers, boot servers, and gateway devices. See the Understanding Management Predefined Policy Applications.

  • Determine the DHCP options required by the subnets and clients in your network.

Overview

In this example, you configure the device as a DHCP client. You specify the interface as ge-0/0/2, set the logical unit as 0, and create a DHCP inet family. You then specify the DHCP client identifier as 00:0a:12:00:12:12 in hexadecimal. You use hexadecimal if the client identifier is a MAC address. You set the options no-hostname if you do not want the DHCP client to send the hostname with the packets. You set the DHCP lease time as 86,400 seconds. The range is from 60 through 2,147,483,647 seconds.

Then you set the number of retransmission attempts to 6. The range is from 0 through 50,000, and the default is 4. You set the retransmission interval to 5 seconds. The range is from 4 through 64, and the default is 4 seconds. Set the force-discover option if you want to force the DHCP client to send a DHCP discover packet after one to three failed dhcp-request attempts. The force-discover option ensures that the DHCP server will assign the same or a new IP address to the client. Finally, you set the IPv4 address of the preferred DHCP server to 10.1.1.1 and the vendor class ID to ether.

Warning:

Starting with Junos OS Release 15.1X49-D60 and Junos OS Release 17.3R1, the legacy DHCPD (DHCP daemon) configuration on all SRX Series Firewalls is being deprecated and only the new JDHCP CLI is supported. When you upgrade to Junos OS Release 15.1X49-D60 and later releases on a device that already has the DHCPD configuration, the following warning messages are displayed:

WARNING: The DHCP configuration command used will be deprecated in future Junos releases.

WARNING: Please see documentation for updated commands.

Note:

Starting with Junos OS Release 17.3R1, on all SRX Series Firewalls and vSRX Virtual Firewall instances, the CLI option dhcp-client at [edit interfaces interface-name unit logical-unit-number family inet] hierarchy is changed to dhcp to align with other Junos platforms. There is no change in the functionality.

Configuration

Procedure

CLI Quick Configuration

To quickly configure this example, copy the following commands, paste them into a text file, remove any line breaks, change any details necessary to match your network configuration, copy and paste the commands into the CLI at the [edit] hierarchy level, and then enter commit from configuration mode.

GUI Quick Configuration
Step-by-Step Procedure

To configure the device as a DHCP client:

  1. In the J-Web interface, select Configure > Services > DHCP > DHCP Client.

  2. Under Interfaces, add ge-0/0/2.0.

  3. Configure the DHCP client identifier as either an ASCII or hexadecimal value.

  4. From the Client identifier choice list, select hexadecimal.

  5. In the Hexadecimal box, type the client identifier—00:0a:12:00:12:12.

  6. Set the DHCP lease time in seconds. This is the lease time in seconds requested in a DHCP client protocol packet; the range is 60 through 2,147,483,647. Type 86400.

  7. Set the retransmission number of attempts to 6. This is the number of attempts to retransmit the DHCP client protocol packet. The range is 0 through 6.

  8. Set the retransmission interval in seconds to 5. This is the number of seconds between successive transmissions. The range is 4 through 64. The default is 4 seconds.

  9. Configure the force-discover option to force the DHCP client to send a DHCP discover packet after one to three failed dhcp-request attempts.

  10. Set the IPv4 address of the preferred DHCP server. Type 192.168.2.1.

  11. Set the vendor class ID. This is the vendor class identification for the DHCP client. Type ether.

  12. Configure options no-hostname if you do not want the client to send hostname in the packets (RFC option code 12).

  13. Click OK.

  14. If you are done configuring the device, click Commit >.

Step-by-Step Procedure

The following example requires you to navigate various levels in the configuration hierarchy. For instructions on how to do that, see Using the CLI Editor in Configuration Mode in the CLI User Guide.

To configure the device as a DHCP client:

  1. Specify the DHCP client interface.

  2. Configure the DHCP client identifier as a hexadecimal value.

  3. Set the DHCP lease time.

  4. Set the number of attempts allowed to retransmit a DHCP packet.

  5. Set the interval (in seconds) allowed between retransmission attempts. The range is 4 through 64. The default is 4 seconds.

  6. Configure the force-discover option.

  7. Set the IPv4 address of the preferred DHCP server.

  8. Set the vendor class ID for the DHCP client.

  9. Configure options no-hostname if you do not want the client to send the hostname in packets.

Results

From configuration mode, confirm your configuration by entering the show interfaces ge-0/0/2 unit 0 family inet command. If the output does not display the intended configuration, repeat the configuration instructions in this example to correct it.

If you are done configuring the device, enter commit from configuration mode.

Verification

Confirm that the configuration is working properly.

Verifying the DHCP Client

Purpose

Verify that the DHCP client information has been configured.

Action

From operational mode, enter these commands:

  • show dhcp client binding command to display the binding state of a Dynamic Host Configuration Protocol (DHCP) client.

  • show dhcp client statistics command to display client statistics.

These commands produce the following sample output:

Verifying and Managing DHCP Client Configuration

Purpose

View or clear information about client address bindings and statistics for the DHCP client on SRX300, SRX320, SRX340, SRX550M, and SRX1500 devices.

Action

  • To display the address bindings in the client table on the DHCP client:

  • To display DHCP client statistics:

  • To clear the binding state of a DHCP client from the client table on the DHCP client:

  • To clear all DHCP client statistics:

Note:

To clear or view information about client bindings and statistics in a routing instance, run the following commands:

  • show dhcp client binding routing instance <routing-instance name>

  • show dhcp client statistics routing instance <routing-instance name>

  • clear dhcp client binding routing instance <routing-instance name>

  • clear dhcp client statistics routing instance <routing-instance name>

Example: Configuring as a DHCP Client in Chassis Cluster Mode

This example shows how to configure the device as a DHCP client in chassis cluster mode.

Requirements

This example uses the following hardware and software components:

  • Two SRX Series Firewalls as DHCP client

  • One SRX Series Firewall as DHCP server

  • Junos OS Release 12.1X47-D10 or later for SRX Series Firewalls

Before you begin:

  • Determine the IP address pools and the lease durations to use for each subnet.

  • Obtain the MAC addresses of the clients that require permanent IP addresses. Determine the IP addresses to use for these clients.

  • List the IP addresses that are available for the servers and devices on your network; for example, DNS, NetBIOS servers, boot servers, and gateway devices.

  • Determine the DHCP options required by the subnets and clients in your network.

Overview

In this example, you configure two SRX Series Firewalls as DHCP clients and a third SRX Series Firewall as a DHCP server. Configure the two DHCP clients in chassis cluster mode.

For DHCP clients, you specify the interface as reth1, set the logical unit as 0, and create a DHCP inet family. You then specify the DHCP client identifier as 00:0a:12:00:12:12 in hexadecimal. You use hexadecimal if the client identifier is a MAC address. You set the options no-hostname if you do not want the DHCP client to send the hostname with the packets. You set the DHCP lease time as 86,400 seconds. The range is from 60 through 2,147,483,647 seconds. You set the number of retransmission attempts to 6. The range is from 0 through 6, and the default is 4. You set the retransmission interval to 5 seconds. The range is from 4 through 64, and the default is 4 seconds. Finally, you set the IPv4 address of the preferred DHCP server to 203.0.113.1 and the vendor class ID to ether.

For the DHCP server, configure the SRX Series Firewall as a DHCP local server with minimum DHCP local server configurations. You specify the server group as g1 and enable the DHCP local server on interface ge-0/0/2.0.

Configuration

Procedure

CLI Quick Configuration

To quickly configure this example, copy the following commands, paste them into a text file, remove any line breaks, change any details necessary to match your network configuration, copy and paste the commands into the CLI at the [edit] hierarchy level, and then enter commit from configuration mode.

Configure DHCP Client 1 and Client 2:

Configure chassis cluster on Client 1 and Client 2:

Configure the DHCP server:

Step-by-Step Procedure

The following example requires you to navigate various levels in the configuration hierarchy. For instructions on how to do that, see Using the CLI Editor in Configuration Mode in the CLI User Guide.

To configure the devices as DHCP clients:

  1. Specify the DHCP client interface.

  2. Configure the DHCP client identifier as a hexadecimal value.

  3. Set the hostname if you do not want the DHCP client to send hostname in the packets (RFC option code 12).

  4. Set the DHCP lease time.

  5. Set the number of attempts allowed to retransmit a DHCP packet.

  6. Set the interval (in seconds) allowed between retransmission attempts. The range is 4 through 64. The default is 4 seconds.

  7. Set the IPv4 address of the preferred DHCP server.

  8. Set the vendor class ID for the DHCP client.

Step-by-Step Procedure

To configure the DHCP clients in chassis cluster mode:

  1. Specify the number of redundant Ethernet interfaces for the chassis cluster.

  2. Enable control link recovery.

  3. Configure heartbeat settings.

  4. Configure the redundancy groups.

  5. Configure redundant Ethernet interfaces.

Step-by-Step Procedure

To configure the device as DHCP server:

  1. Configure the DHCP local server.

  2. Configure IP address of the server.

  3. Configure an address pool.

Results

From configuration mode, confirm your configuration by entering the show commands. If the output does not display the intended configuration, repeat the configuration instructions in this example to correct it.

If you are done configuring the device, enter commit from configuration mode.

Verification

Verifying the DHCP Client in Chassis Cluster Mode

Purpose

Verify that the DHCP client is working in chassis cluster mode.

Action

From operational mode, enter the show dhcp client binding, show dhcp client statistics and show dhcp client binding interface reth1 detail commands.

Meaning

The sample output shows that DHCP clients configured in the example work in a chassis cluster.

Change History Table

Feature support is determined by the platform and release you are using. Use Feature Explorer to determine if a feature is supported on your platform.

Release
Description
17.3R1
Starting with Junos OS Release 17.3R1, on all SRX Series Firewalls and vSRX Virtual Firewall instances, the CLI option dhcp-client at [edit interfaces interface-name unit logical-unit-number family inet] hierarchy is changed to dhcp to align with other Junos platforms.
15.1X49-D60
Starting with Junos OS Release 15.1X49-D60 and Junos OS Release 17.3R1, the legacy DHCPD (DHCP daemon) configuration on all SRX Series Firewalls is being deprecated and only the new JDHCP CLI is supported.