Related Documentation
- J Series
- DHCP Server, Client, and Relay Agent Overview
- Understanding DHCP Server Operation
- Understanding DHCP Client Operation
- DHCP Settings and Restrictions Overview
- SRX Series
- DHCP Server, Client, and Relay Agent Overview
- Understanding DHCP Server Operation
- Understanding DHCP Client Operation
- DHCP Settings and Restrictions Overview
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. See Example: Viewing DHCP Address Pools.
- Obtain the MAC addresses of the clients that require permanent
IP addresses. Determine the IP addresses to use for these clients.
See the Junos OS Security Configuration Guide
. - 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 Junos OS Security Configuration Guide
. - Determine the DHCP options required by the subnets and clients in your network. See Creating User-Defined DHCP Options Not Included in the Default Junos Implementation of the DHCP Server.
Overview
In this example, you configure the device as a DHCP client. You specify the interface as ge-0/0/1, 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 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 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 10.1.1.1 and the vendor class ID to ether.
Configuration
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, and then copy and paste the commands into the CLI at the [edit] hierarchy level.
GUI Step-by-Step Procedure
To configure the device as a DHCP client:
- In the J-Web user interface, select Configure>Services>DHCP>Boot DHCP Relay.
- Under Interfaces, click ge-0/0/1.
- Under Unit, next to the unit number, click Edit.
- Under Family, select the Inet check box and click Edit.
- Next to Dhcp, click Yes and click Configure.
- Configure the DHCP client identifier as either an ASCII or hexadecimal value. Next to Client identifier, click Configure.
- From the Client identifier choice list, select hexadecimal.
- In the Hexadecimal box, type the client identifier—00:0a:12:00:12:12.
- Click OK.
- Set the DHCP lease time in seconds. From the Lease time list, select Enter Specific Value.
- In the Length box, type 86400.
- Set the retransmission number of attempts. In the Retransmission attempt box, type 6.
- Set the retransmission interval in seconds. In the Retransmission interval box, type 5.
- Set the IPv4 address of the preferred DHCP server. In the Server address box, type 10.1.1.1.
- Set the vendor class ID. In the Vendor id box, type ether.
- Click OK.
- Click OK to check your configuration and save it as a candidate configuration.
- If you are done configuring the device, click Commit Options>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 Junos OS CLI User Guide
.
To configure the device as a DHCP client:
- Specify the DHCP client interface.[edit]user@host# edit interfaces ge-0/0/1 unit 0 family inet dhcp
- Configure the DHCP client identifier as a hexadecimal
value. [edit interfaces ge-0/0/1 unit 0 family inet dhcp]user@host# set client-identifier 00:0a:12:00:12:12
- Set the DHCP lease time. [edit interfaces ge-0/0/1 unit 0 family inet dhcp]user@host# set lease-time 86400
- Set the number of attempts allowed to retransmit a DHCP
packet. [edit interfaces ge-0/0/1 unit 0 family inet dhcp]user@host# set retransmission-attempt 6
- Set the interval (in seconds) allowed between retransmission
attempts. The range is 4 through 64. The default is 4 seconds.[edit interfaces ge-0/0/1 unit 0 family inet dhcp]user@host# set retransmission-interval 5
- Set the IPv4 address of the preferred DHCP server.[edit interfaces ge-0/0/1 unit 0 family inet dhcp]user@host# set server-address 10.1.1.1
- Set the vendor class ID for the DHCP client.[edit interfaces ge-0/0/1 unit 0 family inet dhcp]user@host# set vendor-id ether
Results
From configuration mode, confirm your configuration by entering the show interfaces ge-0/0/1 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 system services dhcp client command to display DHCP client information.
- show system services dhcp client interface-name command to display more information about a specific interface.
- show system services dhcp client statistics command to show client statistics.
These commands produce the following sample output:
Logical Interface Name ge-0/0/1.0 Hardware address 00:0a:12:00:12:12 Client Status bound Vendor Identifier ether Server Address 10.1.1.1 Address obtained 10.1.1.89 update server enables Lease Obtained at 2006-08-24 18:13:04 PST Lease Expires at 2006-08-25 18:13:04 PST DHCP Options: Name: name-server, Value: [ 10.209.194.131, 2.2.2.2, 3.3.3.3 ] Name: server-identifier, Value: 10.1.1.1 Name: router, Value: [ 10.1.1.80 ] Name: domain-name, Value: netscreen-50
Logical Interface Name ge-0/0/1.0 Hardware address 00:12:1e:a9:7b:81 Client Status bound Address obtained 30.1.1.20 update server enables Lease Obtained at 2007-05-10 18:16:04 PST Lease Expires at 2007-05-11 18:16:04 PST DHCP Options: Name: name-server, Value: [ 30.1.1.2 ] Code: 1, Type: ip-address, Value: 255.255.255.0 Name: name-server, Value: [ 77.77.77.77, 55.55.55.55 ] Name: domain-name, Value: englab.juniper.net
Packets dropped:
Total 0
Messages Received:
DHCPOFFER 0
DHCPACK 8
DHCPNAK 0
Messages Sent:
DHCPDECLINE 0
DHCPDISCOVER 0
DHCPREQUEST 1
DHCPINFORM 0
DHCPRELEASE 0
DHCPRENEW 7
DHCPREBIND 0
Related Documentation
- J Series
- DHCP Server, Client, and Relay Agent Overview
- Understanding DHCP Server Operation
- Understanding DHCP Client Operation
- DHCP Settings and Restrictions Overview
- SRX Series
- DHCP Server, Client, and Relay Agent Overview
- Understanding DHCP Server Operation
- Understanding DHCP Client Operation
- DHCP Settings and Restrictions Overview