Programmable Internetworking & Communication Operating System Docs ... Click Spaces -> Space Directory to see docs for all releases ...
Page tree
Skip to end of metadata
Go to start of metadata

As broadcast is used to send the request message during the dynamic acquisition of IP address, DHCP is only applicable to the case where the DHCP client and the server are on the same subnet. For dynamic host configuration, you need to set up a DHCP server on all network segments, which is obviously very uneconomical.

The introduction of DHCP relay function solves this problem: the client can communicate with the DHCP server of other network segments through DHCP relay, and finally obtains the IP address. In this way, DHCP clients on multiple networks can use the same DHCP server, saving cost and facilitating centralized management.

Option82 is a relay agent used to specify the DHCP client location information. The DHCP Option82 is disabled by default. To enable Option82, use the disable false option. Then, use the circuit-id command to set the DHCP port information.

Procedure

Step 1.   Configure VLAN.

               a). Configure VLAN ID.

     set vlans <vlan-id>

       b). Add an interface to the VLAN.

    set interface gigabit-ethernet <port> family ethernet-switching native-vlan-id <vlan-id>

       c). Configure the access/trunk mode.

    set interface gigabit-ethernet <port> family ethernet-switching port-mode <port-mode>

       d). Configure the IP address for the VLAN interface to implement Layer 3 connectivity.

    set vlan-interface interface <interface-name> vif <vif-nameaddress <addressprefix-length <number>

Step 2.   Associate a Layer 3 interface with a VLAN.

       set vlans vlan-id <vlan-id> l3-interface <interface-name>

Step 3.   Enable the DHCP relay function on the VLAN interface.

       set protocols dhcp relay vlan-interface <interface-name> disable {true | false}

Step 4.   Configure the IP address of the DHCP server.

       set protocols dhcp relay vlan-interface vlan-interface-name { dhcp-server-address1 address | dhcp-server-address2 address | dhcp-server-address3 address | dhcp-server-address4 address }

Step 5.   Configure the interface connected to the DHCP server as DHCP snooping trusted interface.

       set protocols dhcp snooping port <interface-name> trust {true | false}

Step 6.   (Optional) Configure  DHCP option82.

a). Enable DHCP option82.

set protocols dhcp option82 disable  {true | false}

b). Modify the circuit-id of option82.

set protocols dhcp relay port port-name circuit-id circuit-id

NOTE:

    • If the interface connected to the DHCP server is not configured as a DHCP snooping trusted interface, the data packets sent from the DHCP server to the host will be dropped, the DHCP function will not work.
    • On the same switch, the DHCP client and DHCP relay functions are mutually exlusive. That is to say, if the command set vlan-interface interface <interface-name> dhcp true is configured on a switch, setting a VLAN interface as a DHCP client, then enabling the DHCP relay function on the same device will make the DHCP replay function take effect whereas the client function disabled.

Configuration Example

Networking Requirements

  • The IP address of the ge-1/1/1 interface of the Pica8 Switch is 192.168.1.1/24 and belongs to VLAN 2. The IP address of the ge-1/1/2 interface is 192.168.2.1/24 and belongs to VLAN 3.
  • Enable the DHCP relay function on VLAN 2.
  • The IP address of DHCP server is 192.168.2.100.


Procedure

Step 1.   Configure VLAN.   

       admin@XorPlus# set vlans vlan-id 2

       admin@XorPlus# set vlans vlan-id 3

       admin@XorPlus# set interface gigabit-ethernet ge-1/1/1 family ethernet-switching native-vlan-id 2

       admin@XorPlus# set interface gigabit-ethernet ge-1/1/2 family ethernet-switching native-vlan-id 3

       admin@XorPlus# set interface gigabit-ethernet ge-1/1/1 family ethernet-switching port-mode trunk

       admin@XorPlus# set interface gigabit-ethernet ge-1/1/2 family ethernet-switching port-mode trunk

       admin@XorPlus# set vlan-interface interface vlan-2 vif vlan-2 address 192.168.1.1 prefix-length 24

       admin@XorPlus# set vlan-interface interface vlan-3 vif vlan-3 address 192.168.2.1 prefix-length 24

       admin@XorPlus# set vlans vlan-id 2 l3-interface vlan-2

       admin@XorPlus# set vlans vlan-id 3 l3-interface vlan-3

Step 2.   Enable the DHCP relay function on VLAN 2.

       admin@XorPlus# set protocols dhcp relay vlan-interface vlan-2 disable false

Step 3.   Configure the IP address of DHCP server as 192.168.2.100.

       admin@XorPlus# set protocols dhcp relay vlan-interface vlan-2 dhcp-server-address1 192.168.2.100

Step 4.   Configure the interface connected to the DHCP server as DHCP snooping trusted interface.

       admin@XorPlus#set protocols dhcp snooping port ge-1/1/2 trust true

Step 5.   (Optional) Configure  DHCP option82.

               admin@XorPlus#set protocols dhcp option82 disable false

       admin@XorPlus#set protocols dhcp relay port ge-1/1/1 circuit-id v100

Step 6.   Commit the configuration.

       admin@XorPlus# commit

Step 7.   Verify the configuration.
               After the configuration is complete, run the show protocols dhcp relay command to view the configuration of DHCP relay.
               admin@Xorplus# show protocols dhcp relay

                  relay {       

                     vlan-interface vlan2 {           

                        dhcp-server-address1: 192.168.2.100         

                      }

                   }

 
  • No labels