Configuring DHCP with a Configuration Editor

This section contains the following topics:

Configuring the Device as a DHCP Server

A typical DHCP server configuration provides the following configuration settings for a particular subnet on a device interface:

In addition, the DHCP server might assign a static address to at least one client on the subnet. Table 40 provides the settings and values for the sample DHCP server configuration used in this section.

Table 40: Sample DHCP Configuration Settings

Settings

Sample Value or Values

DHCP Subnet Configuration

Address pool subnet address

192.168.2.0/24

High address in the pool range

192.168.2.254

Low address in the pool range

192.168.2.2

Address pool default lease time, in seconds

1,209,600 (14 days)

Address pool maximum lease time, in seconds

2,419,200 (28 days)

Domain search suffixes

mycompany.net

mylab.net

Address to exclude from the pool

192.168.2.33

DNS server address

192.168.10.2

Identifier code for router solicitation address option

32

Type choice for router solicitation address option

Ip address

IP address for router solicitation address option

192.168.2.33

DHCP MAC Address Configuration

Static binding MAC address

01:03:05:07:09:0B

Fixed address

192.168.2.50

To configure the device as a DHCP server for a subnet and a single client:

  1. Navigate to the top of the configuration hierarchy in either the J-Web or CLI configuration editor.
  2. Perform the configuration tasks described in Table 41.
  3. If you are finished configuring the device, commit the configuration.
  4. To verify DHCP server configuration and operation, see Verifying a DHCP Configuration.

Table 41: Configuring the Device as a DHCP Server

Task

J-Web Configuration Editor

CLI Configuration Editor

Navigate to the Dhcp server level in the configuration hierarchy.

  1. In the J-Web interface, select CLI Tools>Point and Click CLI.
  2. Next to System, click Configure.
  3. Next to Services, make sure the check box is selected, and click Configure.
  4. Next to Dhcp, click Configure.

From the [edit] hierarchy level, enter

edit system services dhcp

Define the IP address pool.

  1. Next to Pool, click Add new entry.
  2. In the Subnet address box, type 192.168.2.0/24.
  3. Next to Address range, select the check box.
  4. Next to Address range, click Configure.
  5. In the High box, type 192.168.2.254.
  6. In the Low box, type 192.168.2.2.
  7. Click OK.

Set the IP address pool range:

set pool 192.168.2.0/24 address-range low 192.168.2.2 high 192.168.2.254

Define the default and maximum lease times, in seconds.

  1. From the Default lease time list, select Enter Specific Value.
  2. In the Length box, type 1209600.
  3. From the Maximum lease time list, select Enter Specific Value.
  4. Next to Maximum lease time, type 2419200.

Set the default and maximum lease times:

set pool 192.168.2.0/24 default-lease-time 1209600 maximum-lease-time 2419200

Define the domain search suffixes to be used by the clients.

  1. Next to Domain search, click Add new entry.
  2. In the Suffix box, type mycompany.net.
  3. Click OK.
  4. Next to Domain search, click Add new entry.
  5. In the Suffix box, type mylab.net.
  6. Click OK.

Set the domain search suffixes:

set pool 192.168.2.0/24 domain-search mycompany.net

set pool 192.168.2.0/24 domain-search mylab.net

Define a DNS server.

  1. Next to Name server, click Add new entry.
  2. In the Address box, type 192.168.10.2.
  3. Click OK.

Set the DNS server IP address:

set pool 192.168.2.0/24 name-server 192.168.10.2

Define DHCP option 32—the router solicitation address option.

  1. Next to Option, click Add new entry.
  2. In the Option identifier code box, type 32.
  3. From the Option type choice list, select Ip address.
  4. In the Ip address box, type 192.168.2.33.
  5. Click OK twice.

Set the router solicitation IP address:

set pool 192.168.2.0/24 option 32 ip-address 192.168.2.33

Assign a static IP address of 192.168.2.50 to MAC address 01:03:05:07:09:0B.

  1. Next to Static binding, click Add new entry.
  2. In the Mac address box, type 01:03:05:07:09:0B.
  3. Next to Fixed address, click Add new entry.
  4. In the Address box, type 192.168.2.50.
  5. Click OK until you return to the Configuration page.

Associate a fixed IP address with the MAC address of the client:

set static-binding 01:03:05:07:09:0B fixed-address 192.168.2.50

Configuring the Device as a DHCP Client

To configure the J Series or SRX Series device as a DHCP client:

  1. Navigate to the top of the configuration hierarchy in either the J-Web or CLI configuration editor.
  2. Perform the configuration tasks described in Table 42.
  3. If you are finished configuring the device, commit the configuration.
  4. To verify DHCP client configuration and operation, see Verifying the DHCP Client.

Table 42: Configuring the Device as a DHCP Client

Task

J-Web Configuration Editor

CLI Configuration Editor

Navigate to the Interfaces level in the configuration hierarchy, and select the interface on which to configure DHCP client information—for example, ge-0/0/1.0.

  1. In the J-Web interface, select CLI Tools>Point and Click CLI.
  2. Under Interfaces, click ge-0/0/1.
  3. Under Unit, next to the unit number, click Edit.
  4. Under Family, select the Inet check box and click Edit.
  5. Next to Dhcp, click Yes and click Configure.

From the [edit] hierarchy level, enter

set interfaces ge-0/0/1 unit 0 family inet dhcp

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

Use hexadecimal if the client identifier is a MAC address—for example, 00:0a:12:00:12:12.

  1. Next to Client identifier, click Configure.
  2. From the Client identifier choice list, select hexadecimal.
  3. In the Hexadecimal box, type the client identifier—00:0a:12:00:12:12.
  4. Click OK.

Set the DHCP client identifier as a hexadecimal value:

set interfaces ge-0/0/1 unit 0 family inet dhcp client-identifier 00:0a:12:00:12:12

Set the DHCP lease time in seconds—for example, 86400 (24 hours).

The range is 60 through 2147483647 seconds.

  1. From the Lease time list, select Enter Specific Value.
  2. In the Length box, type 86400.

Set the DHCP lease time to 86400 seconds:

set interfaces ge-0/0/1 unit 0 family inet dhcp lease-time 86400

Define the number of attempts allowed to retransmit a DHCP packet—for example, 6.

The range is 0 through 6. The default is 4 times.

In the Retransmission attempt box, type 6.

Set the number of attempts allowed to retransmit a DHCP packet to 6:

set interfaces ge-0/0/1 unit 0 family inet dhcp retransmission-attempt 6

Define the interval, in seconds, allowed between retransmission attempts—for example, 5.

The range is 4 through 64. The default is 4 seconds.

In the Retransmission interval box, type 5.

Set the interval allowed between retransmission attempts to 5 seconds:

set interfaces ge-0/0/1 unit 0 family inet dhcp retransmission-interval 5

Set the IPv4 address of the preferred DHCP server—for example, 10.1.1.1.

In the Server address box, type 10.1.1.1.

Set the IPv4 address of the preferred DHCP server to 10.1.1.1:

set interfaces ge-0/0/1 unit 0 family inet dhcp server-address 10.1.1.1

Set the vendor class ID for the DHCP client—for example, ether.

  1. In the Vendor id box, type ether.
  2. Click OK.

Set the vendor class ID to ether:

set interfaces ge-0/0/1 unit 0 family inet dhcp vendor-id ether

Configuring the Device as a DHCP Relay Agent

You can configure the device or an interface to act as a DHCP relay agent. Doing so enables the device to respond to DHCP or BOOTP requests broadcast by request as a broadcast message. If the device or an interface detects a broadcast message, it relays the message to a specified DHCP or BOOTP server.

We recommend you to configure the device or an interface to be a DHCP/BOOTP relay agent if you have locally attached hosts and a distant DHCP or BOOTP server. For more information, see Junos Policy Framework Configuration Guide

Configuring the Device as a BootP/DHCP Relay Agent

To configure the J Series or SRX Series device as a BootP/DHCP relay agent:

  1. Navigate to the top of the configuration hierarchy in either the J-Web or CLI configuration editor.
  2. Perform the configuration tasks described in Table 43.
  3. If you are finished configuring the device, commit the configuration.
  4. To verify DHCP client configuration and operation, see Displaying DHCP Relay Statistics.

Table 43: Configuring the Device as a BootP/DHCP Relay Agent

Task

J-Web Configuration Editor

CLI Configuration Editor

Navigate to the Forwarding-options level in the configuration hierarchy, and select the interface on which to configure the BootP/DHCP relay agent information.

In the J-Web interface, select Configure>Services>DHCP>Boot DHCP Relay.

From the [edit] hierarchy level, enter

set forwarding-options helpers bootp

Enable the DHCP relay agent to relay bootp/DHCP messages to BootP server.

Select the DHCP relay agent check box to enable the BootP/DHCP relay agent.

Enable the DHCP relay agent:

set forwarding-options helpers bootp relay agent-option

Enable VPN encryption to allow client requests to pass through the VPN tunnel.

Select the VPN encryption check box.

Enable VPN encryption to allow client requests to pass through VPN tunnel:

set forwarding-options helpers bootp vpn

Define the IP time-to-live value to be set in responses to client—for example, 20.

The range is 1—255.

In the Client response TTL box, type20.

Set the IP time-to-live value to be set in responses to client to 20:

set forwarding-options helpers bootp client-response-ttl 20

Define the maximum number of hops allowed per packet—for example, 10.

The range is 4—16.

In the Maximum hop count box, type 10.

Set the maximum number of hops allowed per packet to 10:

set forwarding-options helpers bootp maximum-hop-count 10

Define the minimum number of seconds before requests are forwarded—for example, 300.

The range is 0—30000 seconds.

In the Minimum wait time box, type 300.

Set the minimum number of seconds before requests are forwarded to 300:

set forwarding-options helpers bootp minimum-wait-time seconds 300

Define the text description of the server.

The value is a string.

In the Description box, type the description of the server.

Set the description of the server:

set forwarding-options helpers bootp description text

Adding a new server

Define a valid server name or address to the server to forward.

The value is an IPv4 address.

  1. Next to Sever, click Add new Entry.
  2. Next to the Name box, type 2.2.2.2.

Set the server name:

set forwarding-options helpers bootp server

Define the routing instance. The value is a nonreserved text string of 128 characters or less.

  1. Next to Routing instance, click Add new entry.
  2. In the Name box, type rt-i-1 and click OK.

    A routing instance is optional.

Set the routing instance:

set forwarding-options helpers bootp server routing instance

Adding a new interface

Define the incoming BootP/DHCP request forwarding interface—for example, ge-0/0/0.

  1. Next to Interface, click Add new entry.
  2. In the Interface name box, type the interface name. For example: ge-0/0/0.

Set the incoming BootP/DHCP request forwarding interface to ge-0/0/0:

set forwarding-options helpers bootp interface ge-0/0/0

Enable broadcast option, if the layer 2 interface is unknown.

Select the Broadcast check box, if the layer 2 interface in unknown.

Set the broadcast option:

set forwarding-options helpers bootp interface ge-0/0/0 broadcast

Define the IP time-to-live value to be set in responses to client—for example, 30.

The range is 1—255.

In the Client response TTL box, type30.

Set the IP time-to-live value to be set in responses to client to 30:

set forwarding-options helpers bootp interface ge-0/0/0 client-response-ttl 30

Define the text description of the server.

The value is a string.

In the Description box, type the description of the server.

Set the description of the server:

set forwarding-options helpers bootp interface ge-0/0/0 description text

Define Dhcp option 82, to configure DHCP option 82.

Select the Dhcp option 82 check box.

Set the Dhcp option 82:

set forwarding-options helpers bootp interface ge-0/0/0 dhcp option 82

Define the maximum number of hops allowed per packet—for example, 20.

The range is 4—16.

In the Maximum hop count box, type 20.

Set the maximum number of hops allowed per packet to 20:

set forwarding-options helpers bootp interface ge-0/0/0 maximum-hop-count 20

Define the minimum number of seconds before requests are forwarded—for example, 400.

The range is 0—30000 seconds.

In the Minimum wait time box, type 400.

Set the minimum number of seconds before requests are forwarded to 400:

set forwarding-options helpers bootp interface ge-0/0/0 minimum-wait-time seconds 400

Enable No listen option.

Select the No listen check box.

Set the No listen option:

set forwarding-options helpers bootp interface ge-0/0/0 no-listen

Enable VPN encryption to allow client requests to pass through the VPN tunnel.

Select the VPN encryption check box.

Enable VPN encryption to allow client requests to pass through VPN tunnel:

set forwarding-options helpers bootp interface ge-0/0/0 vpn

Commit changes.

Click OK until you return to the Configuration page.