Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All

    Example: Configuring the Device as a DHCP Client

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

    Requirements

    Before you begin:

    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.

    set interfaces ge-0/0/1 unit 0 family inet dhcpset interfaces ge-0/0/1 unit 0 family inet dhcp client-identifier 00:0a:12:00:12:12 set interfaces ge-0/0/1 unit 0 family inet dhcp lease-time 86400 set interfaces ge-0/0/1 unit 0 family inet dhcp retransmission-attempt 6 set interfaces ge-0/0/1 unit 0 family inet dhcp retransmission-interval 5 set interfaces ge-0/0/1 unit 0 family inet dhcp server-address 10.1.1.1 set interfaces ge-0/0/1 unit 0 family inet dhcp vendor-id ether

    GUI Step-by-Step Procedure

    To configure the device as a DHCP client:

    1. In the J-Web user interface, select Configure>Services>DHCP>Boot DHCP Relay.
    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.
    6. Configure the DHCP client identifier as either an ASCII or hexadecimal value. Next to Client identifier, click Configure.
    7. From the Client identifier choice list, select hexadecimal.
    8. In the Hexadecimal box, type the client identifier—00:0a:12:00:12:12.
    9. Click OK.
    10. Set the DHCP lease time in seconds. From the Lease time list, select Enter Specific Value.
    11. In the Length box, type 86400.
    12. Set the retransmission number of attempts. In the Retransmission attempt box, type 6.
    13. Set the retransmission interval in seconds. In the Retransmission interval box, type 5.
    14. Set the IPv4 address of the preferred DHCP server. In the Server address box, type 10.1.1.1.
    15. Set the vendor class ID. In the Vendor id box, type ether.
    16. Click OK.
    17. Click OK to check your configuration and save it as a candidate configuration.
    18. 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 PDF Document.

    To configure the device as a DHCP client:

    1. Specify the DHCP client interface.
      [edit]user@host# edit interfaces ge-0/0/1 unit 0 family inet dhcp
    2. 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
    3. Set the DHCP lease time.
      [edit interfaces ge-0/0/1 unit 0 family inet dhcp]user@host# set lease-time 86400
    4. 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
    5. 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
    6. 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
    7. 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.

    [edit]user@host# show interfaces ge-0/0/1 unit 0 family inetdhcp { client-identifier hexadecimal 00:0a:12:00:12:12;lease-time 86400; retransmission-attempt 6; retransmission-interval 5; server-address 10.1.1.1; update-server;vendor-id ether; }

    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:

    user@host> show system services dhcp client
    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
    
    
    user@host> show system services dhcp client ge-0/0/1.0
    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
    
    user@host> show system services dhcp client statistics
    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
    
        

    Published: 2012-06-29