Configuring DHCP Relay

This article describes how configure DHCP relay on FlexSWitch.

The first part of this article explains how to configure a DHCP Relay using the FlexSwitch CLI and the second part explains the process using the REST interface with examples in cURL.

Using the CLI to Configure DHCP Relay

The following steps explain how to configure DHCP Relay using the FlexSwitch CLI. See Accessing the Command Line Reference for more information about logging into the CLI facility.

The configuration process requires two steps:

  • Enable dhcp relay on an interface.
  • Configure the DHCP interface.

Enable DHCP Relay on an Interface.

Note

This example uses fpPort1 as the interface example. You will need to use an appropriate interface on your FlexSwitch.

Enable DHCP Relay on eth 1. Enter the following command at the config prompt.

localhost(config)#interface eth 1
localhost(config-if-eth-1)#

This brings into the eth1 object so you can enable dhcp relay on that interface and assign a server IP address.

Enter the following command at the config-if-eth-1 prompt, it enables dhcp relay.

localhost(config-if-eth-1)#dhcp_relay true
localhost(config-if-eth-1-dhcp-relay)#

Configuring the Interface

Enter the following command at the config-if-eth-1-dhcp-relay, it assigns the IP address of a DHCP server to the eth1 interface.

localhost(config-if-eth-1-dhcp-relay)#server_ip 192.168.255.100 

Enter the following command at the config-if-eth-1-dhcp-relay prompt, it turn on dhcp relay for this interface.

localhost(config-if-eth-1-dhcp-relay)#no shutdown 

Verify your configuration with the showunapplied command.

localhost(config-if-eth-1-dhcp-relay)#showunapplied 
Pending Config
NOTE: If attribute is not user provisioned default values shown, when config is applied a
read before write action will occur to fill in values of attributes not set by user.

d: 5    object: DHCPRelayIntf   status: PENDING CONFIG  valid: True delete: True num user cmds: 4
 command                      attr          value                  model attr    iskey    required    userprov    time provisioned         
-------------------------------------------------------------------------------------------------------------------------------------------
 interface fpPort 1           fpPort        1                      IntfRef       True     X           X           Tue Aug 15 14:44:20 2017 
 dhcp_relay true              dhcp_relay    true                                 True                 X           Tue Aug 15 14:44:20 2017 
 server_ip 192.168.255.100    server_ip     ['192.168.255.100']    ServerIp      False                X           Tue Aug 15 14:44:46 2017 
 no shutdown False            shutdown      False                  Enable        True     X           X           Tue Aug 15 14:44:54 2017 

Apply the Configuration

Once you have verified the configuration, apply it using the following command at the config-if-eth-1-dhcp-relay prompt.

localhost(config-if-eth-1-dhcp-relay)#apply

Using Rest (cURL) to Configure DHCP Relay

This section explains how to use the REST interface to configure DHCP Relay using cURL.

Configure the Global Object

In this step we set the Enable attribute of the DHCPRelayGlobal object to true. Execute the following cURL command.

curl -k -u <user>:<password> -H “Content-Type: application/json” -d ‘{“Enable”:true}’ http://localhost:443/public/v1/config/DHCPRelayGlobal

Configure the DHCP Relay Interface

In this step we set the interface IntfRef, Enable, and ServerIP attributes in the DHCPRelayIntf object. Execute the following cURL command.

curl -k -u <user>:<password> -H “Content-Type: application/json” -d ‘{“IntfRef”:“fpPort1”,“Enable”:true,“ServerIp”:[“192.168.255.100"]}’ http://localhost:443/public/v1/config/DHCPRelayIntf