---
title: DHCP
slug: aidc/dhcp
createdAt: 2025-12-01T11:11:06.000Z
---

# <font color="#1d50a2">DHCP Relay</font>

## <font color="#1d50a2">DHCP Relay View</font>

<font color="#1d05a2">Table 1 DHCP Relay View</font>

| **Command**          | **Purpose**                       |
| -------------------- | --------------------------------- |
| **show dhcp\_relay** | Display DHCP Relay configuration. |

### <font color="#1d50a2">show dhcp\_relay</font>

**\[Command]**
**show dhcp\_relay**

**\[Purpose]**
Display DHCP Relay configuration.

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show dhcp_relay
+------------------------------+-------------+-----------+------------+----------+--------+
| Name                         | down link   | up link   | loopback   | server   | vrf    |
+==============================+=============+===========+============+==========+========+
| test__v4(v4)                 | NA          | NA        | NA         | NA       | NA     |
+------------------------------+-------------+-----------+------------+----------+--------+
| test_dhcp_over_vxlan__v4(v4) | vlan20      |    0/2    | NA         | 21.0.0.2 | vrf 123|
+------------------------------+-------------+-----------+------------+----------+--------+
| test_dhcp_over_vxlan__v6(v6) | vlan20      |    0/2    | NA         | 2123::2  | vrf 123|
+------------------------------+-------------+-----------+------------+----------+--------+
```

## <font color="#1d50a2">DHCP Relay Config</font>

<font color="#1d05a2">Table 2 DHCP Relay Config</font>

| **Command**                                                                         | **Purpose**                                                  |
| ----------------------------------------------------------------------------------- | ------------------------------------------------------------ |
| **feature dhcp state enable**                                                       | Enable feature DHCP.                                         |
| **dhcp-relay** *name* \{*v4*\|*v6*} \[**vrf** *vrf\_name*]                          | Create an IPv4 or IPv6 DHCP Relay instance.                  |
| **downlink vlan** *vlan-id* \[**giaddr** *A.B.C.D* \| **option82\_sub5** *A.B.C.D*] | Specify the VLAN for DHCP Relay (on DHCP Client side).       |
| **giaddr loopback** *loopback-id*                                                   | Specify the gateway IP address.                              |
| **server** *dhcp\_server\_ip*                                                       | Set DHCP Server IP.                                          |
| **uplink \{ethernet\|link-aggregation\|vlan}** *interface\_name*                    | Specify the uplink port (on DHCP Server side) of DHCP Relay. |

### <font color="#1d50a2">feature dhcp state enable</font>

**\[Command]**
**feature dhcp state enable**

**\[Purpose]**
Enable feature DHCP.

**\[View]**
Global Configuration View

**\[Notes]**
Run command **feature dhcp state disable** to disable DHCP feature.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# feature dhcp state enable
```

### <font color="#1d50a2">dhcp-relay *name* \{v4|v6\} \[vrf *vrf\_name*\]</font>

**\[Command]**
**dhcp-relay** *name* \{**v4**|**v6**} \[**vrf** *vrf\_name*]

**\[Purpose]**
Create an IPv4 or IPv6 DHCP Relay instance.

**\[Parameters]**

| **Parameter** | **Description**                                                        |
| ------------- | ---------------------------------------------------------------------- |
| *name*        | Name of DHCP Relay instance.                                           |
| *vrf\_name*   | VRF name, specifying the VRF where the DHCP Relay instance is located. |

**\[View]**
Global Configuration View

**\[Notes]**
Please run feature dhcp state enable to enable DHCP before you configure DHCP Relay.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# dhcp-relay test v4
```

### <font color="#1d50a2">downlink vlan *vlan-id* \[giaddr *A.B.C.D* | option82\_sub5 *A.B.C.D*\]</font>

**\[Command]**
**downlink vlan** *vlan-id* \[**giaddr** *A.B.C.D* | **option82\_sub5** *A.B.C.D*]

**\[Purpose]**
Specify the VLAN for DHCPv4 Relay (on DHCP Client side).

**\[Parameters]**

| **Parameter**      | **Description**                                               |
| ------------------ | ------------------------------------------------------------- |
| *vlan-id*          | VLAN ID, the range is \[1,4094].                              |
| **giaddr**         | Relay agent address, only supported by DHCPv4 Relay instance. |
| **option82\_sub5** | Set option82, only supported by DHCPv4 Relay instance.        |

**\[View]**
DHCP Relay Instance Configuration View

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# dhcp-relay test v4
sonic(config-dhcp-relay-test)# downlink vlan 10 giaddr 10.0.0.1
```

### <font color="#1d50a2">downlink vlan *vlan-id* \[option client-linklayer-addr\]</font>

**\[Command]**
**downlink vlan** *vlan-id* \[**option option client-linklayer-addr**]

**\[Purpose]**
Specify the VLAN for DHCPv6 Relay (on DHCP Client side).

**\[Parameters]**

| **Parameter**             | **Description**                                                                                                                                                                        |
| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| *vlan-id*                 | VLAN ID, the range is \[1,4094].                                                                                                                                                       |
| **client-linklayer-addr** | Relay agent address,only IP,Configure option 79,after configuration, the message forwarded by Relay will carry the MAC address of the client. Only supported by DHCPv6 Relay instance. |

**\[View]**
DHCP Relay Instance Configuration View

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# dhcp-relay test v6
sonic(config-dhcp-relay-test)# downlink vlan 100 option client-linklayer-addr
```

### <font color="#1d50a2">giaddr loopback *loopback-id*</font>

**\[Command]**
**giaddr loopback** *loopback-id*

**\[Purpose]**
Specify the gateway IP address.

**\[Parameters]**

| **Parameter** | **Description**                                               |
| ------------- | ------------------------------------------------------------- |
| *loopback-id* | Loopback interface number, integer form, range from 0 to 999. |

**\[View]**
DHCP Relay Instance Configuration View

**\[Notes]**
By default, the switch will set the giaddr to the IP address of the host VLAN interface when it receives a DHCP request.

**\[Use Cases]**

```plaintext
sonic(config)# dhcp-relay test v4
sonic(config-dhcp-relay-test)# giaddr loopback 0
```

### <font color="#1d50a2">server *dhcp\_server\_ip*</font>

**\[Command]**
**server** *dhcp\_server\_ip*

**\[Purpose]**
Set DHCP Server IP.

**\[Parameters]**

| **Parameter**      | **Description**                     |
| ------------------ | ----------------------------------- |
| *dhcp\_server\_ip* | Specify the DHCP server IP address. |

**\[View]**
DHCP Relay Instance Configuration View

**\[Use Cases]**

```plaintext
sonic(config)# dhcp-relay test v4
sonic(config-dhcp-relay-test)# server 10.248.0.1
```

### <font color="#1d50a2">uplink \{ethernet|link-aggregation|vlan\} *interface\_name*</font>

**\[Command]**
**uplink** \{**ethernet**|**link-aggregation|vlan**} *interface\_name*

**\[Purpose]**
Specify the uplink port ( on DHCP Server side) of DHCP Relay.

**\[Parameters]**

| **Parameter**     | **Description**         |
| ----------------- | ----------------------- |
| *interface\_name* | Interface name (eg.0/1) |

**\[View]**
DHCP Relay Instance Configuration View

**\[Use Cases]**

```plaintext
sonic(config)# dhcp-relay test v4
sonic(config-dhcp-relay-test)# uplink ethernet 0/2
```

# <font color="#1d50a2">DHCP Server</font>

## <font color="#1d50a2">DHCP Server View</font>

<font color="#1d05a2">Table 3 DHCP Server View</font>

| **Command**                                                    | **Purpose**                                             |
| -------------------------------------------------------------- | ------------------------------------------------------- |
| **show dhcp pool info** \[**ip-version** \{**v4**\|**v6**}]    | Display DHCP Server pool information.                   |
| **show dhcp pool ip-use** \[**ip-version** \{**v4**\|**v6**}]  | Display the address assigned to clients by DHCP Server. |
| **show dhcp pool expired** \[**ip-version** \{**v4**\|**v6**}] | Display DHCP Server expired ip information.             |
| **show dhcp class**                                            | Display DHCP Server User Class configuration.           |
| **show dhcp option-group**                                     | Display DHCP Server option group configuration.         |

### <font color="#1d50a2">show dhcp pool info \[ip-version \{v4|v6\}\]</font>

**\[Command]**
**show dhcp pool info** \[**ip-version** \{**v4**|**v6**}]

**\[Purpose]**
Display DHCP Server pool infomation.

**\[View]**
Privileged User View

**\[Notes]**
When no IP address version is specified, default view of IPv4 version address pool information

**\[Use Cases]**

```plaintext
sonic# show dhcp pool info
--------------------------------------------------
Pool-name               : t1
Network                 : 201.0.0.0
Mask                    : 255.255.255.0
Lease                   : 201.0.0.20 - 201.0.0.50
Lease_default_time      : 600
Lease_max_time          : 7200
Used  Lease             : 0
Total Lease             : 72
```

### <font color="#1d50a2">show dhcp pool ip-use \[ip-version \{v4|v6\}\]</font>

**\[Command]**
**show dhcp pool ip-use** \[**ip-version** \{**v4**|**v6**}]

**\[Purpose]**
Display the addresses assigned to clients by DHCP Server.

**\[View]**
Privileged User View

**\[Notes]**
When no IP address version is specified, the default view is the IP address information assigned by the IPv4 version

**\[Use Cases]**

```plaintext
sonic# show dhcp pool ip-in-use ip-version v4
Reading leases from /var/lib/dhcp/dhcpd.leases
IP              MAC                hostname       binding state       starts                ends
==================================================================================================================
total lease :0
```

### <font color="#1d50a2">show dhcp pool expired \[ip-version \{v4|v6\}\]</font>

**\[Command]**
**show dhcp pool expired** \[**ip-version** \{**v4**|**v6**}]

**\[Purpose]**
Display DHCP Server expired ip information.

**\[View]**
Privileged User View

**\[Notes]**
When no IP address version is specified, the default view is the IP address information reclaimed by IPv4 version

**\[Use Cases]**

```plaintext
sonic# show dhcp pool expired
Reading leases from /var/lib/dhcp/dhcpd.leases
IP              MAC                hostname       binding state       starts                ends
==================================================================================================================
201.0.0.35      18:17:25:37:64:40  -NA-           free                2024-10-21 03:07:01   2024-10-21 03:09:07
total lease :1
```

### <font color="#1d50a2">show dhcp class</font>

**\[Command]**
**show dhcp class**

**\[Purpose]**
Display DHCP Server User Class configuration.

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show dhcp class
!
dhcp class t1
!
dhcp class test1
 if-match rule 1 option 93 hex ffff
```

### <font color="#1d50a2">show dhcp option-group</font>

**\[Command]**
**show dhcp option-group**

**\[Purpose]**
Display DHCP Server option group configuration.

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show dhcp option-group
!
dhcp option-group 1
 option43 hex 01 force
```

## <font color="#1d50a2">DHCP Server Config</font>

<font color="#1d05a2">Table 4 DHCP Server Config</font>

| **Command**                                           | **Purpose**                                                                      |
| ----------------------------------------------------- | -------------------------------------------------------------------------------- |
| **dhcp server**                                       | Enable interface DHCP Server function.                                           |
| **dhcp pool** *name* \[**v6**]                        | Create a DHCP server address pool and enter the DHCP pool configuration view.    |
| **dhcp class** *name*                                 | Create DHCP Server user class and enter DHCP user class configuration view.      |
| **dhcp option-group** *id*                            | Create a DHCP Server option group and enter the option group configuration view. |
| **network** \{*A.B.C.D A.B.C.D\|A\::B A\::B*}         | Configure the network of the address pool.                                       |
| **address-pool** *start\_ip end\_ip*                  | Configure address pool IP range.                                                 |
| **lease-time** *default\_time max\_time*              | Configure lease time.                                                            |
| **bootfile** *name*                                   | Configure bootfile option.                                                       |
| **dns** \{*A.B.C.D\|A\::B*}                           | Configure DNS option.                                                            |
| **next-server** \{*A.B.C.D\|A\::B*}                   | Configure next server option.                                                    |
| **tftp-server** \{*A.B.C.D\|A\::B*}                   | Configure tftp server option.                                                    |
| **capwap-ac** *A.B.C.D*                               | Configure capwap-ac option.                                                      |
| **routers** *A.B.C.D*                                 | Configure routers option.                                                        |
| **option43 hex** *value* **force**                    | Configure option43 option.                                                       |
| **class** *name* **address-pool** *start\_ip end\_ip* | Configure user class IP range.                                                   |
| **class** *name* **option-group** *id*                | Bind class and option-group.                                                     |
| **if-match rule** *rule\_id* **option** *option\_id*  | Create user class matching rule.                                                 |
| **dhcp failover** *name*                              | Enable DHCP Server failover.                                                     |
| **adddress** \{*A.B.C.D*\|**loopback** **0**}         | Configure failover local IP.                                                     |
| **peer address** *A.B.C.D*                            | Configure failover peer IP.                                                      |
| **auto-partner-down** *time*                          | Configure peer offline time.                                                     |
| **max-response-delay** *time*                         | Configure maximum communication interruption time.                               |
| **role** \{**primary**\|**secondary**}                | Configure primary and secondary roles.                                           |

### <font color="#1d50a2">dhcp server</font>

**\[Command]**
**dhcp server**

**\[Purpose]**
Enable interface DHCP Server function.

**\[View]**
Physical Interface / VLANIF Configuration View

**\[Notes]**
Run command **no dhcp server** *to* disable interface DHCP Server fuction.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# dhcp pool test1
```

### <font color="#1d50a2">dhcp pool *name* \[v6\]</font>

**\[Command]**
**dhcp pool** *name* \[**v6**]

**\[Purpose]**
Create a DHCP server address pool and enter the DHCP pool configuration view.

**\[Parameters]**

| **Parameter** | **Description**        |
| ------------- | ---------------------- |
| *name*        | DHCP Server pool name. |

**\[View]**
Global Configuration View

**\[Notes]**
Default creation of IPv4 type address pool, with v6 parameter, creates IPv6 type address pool
Run command **no dhcp pool** *name* \[**v6**] to delete DHCP pool.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# dhcp pool test1
```

### <font color="#1d50a2">dhcp class *name*</font>

**\[Command]**
**dhcp class** *name*

**\[Purpose]**
Create DHCP Server user class and enter DHCP user class configuration view.

**\[Parameters]**

| **Parameter** | **Description**         |
| ------------- | ----------------------- |
| *name*        | DHCP Server class name. |

**\[View]**
Global Configuration View

**\[Notes]**
Run command **no dhcp class** *name* to delete DHCP class.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# dhcp class t1
```

### <font color="#1d50a2">dhcp option-group *id*</font>

**\[Command]**
**dhcp option-group** *id*

**\[Purpose]**
Create a DHCP Server option group and enter the option group configuration view.

**\[Parameters]**

| **Parameter** | **Description**                                             |
| ------------- | ----------------------------------------------------------- |
| *id*          | DHCP Server option group ID, with a value range of 1-65535. |

**\[View]**
Global Configuration View

**\[Notes]**
Run command **no dhcp option-group** *id* to delete DHCP option-group.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# dhcp option-group 1
```

### <font color="#1d50a2">network \{*A.B.C.D A.B.C.D*|*A\:\:B A\:\:B*\}</font>

**\[Command]**
**network** \{*A.B.C.D A.B.C.D*|*A\::B A\::B*}

**\[Purpose]**
Configure the network of the address pool.

**\[Parameters]**

| **Parameter**     | **Description**        |
| ----------------- | ---------------------- |
| *A.B.C.D A.B.C.D* | IPv4 address and mask. |
| *A:;B A\::B*      | IPv6 address and mask. |

**\[View]**
DHCP pool Configuration View

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# dhcp pool test1
sonic(config-dhcp-pool-t1)# network 100.0.0.1 255.255.255.0
```

### <font color="#1d50a2">address-pool *start\_ip end\_ip*</font>

**\[Command]**
**address-pool** *start\_ip end\_ip*

**\[Purpose]**
Configure address pool IP range.

**\[Parameters]**

| **Parameter** | **Description** |
| ------------- | --------------- |
| *start\_ip*   | Start\_ip.      |
| *end\_ip*     | End\_ip         |

**\[View]**
DHCP pool Configuration View

**\[Notes]**
The end\_ip address must be after the start\_ip address

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# dhcp pool test1
sonic(config-dhcp-pool-t1)# address-pool 100.0.0.10 100.0.0.100
```

### <font color="#1d50a2">lease-time *default\_time max\_time*</font>

**\[Command]**
**lease-time** *default\_time max\_time*

**\[Purpose]**
Configure lease time.

**\[Parameters]**

| **Parameter**   | **Description**                                                                                                 |
| --------------- | --------------------------------------------------------------------------------------------------------------- |
| *default\_time* | Default lease time, in seconds, with a value range greater than 300, default value is 600.                      |
| *max\_time*     | The maximum lease time, in seconds, needs to be greater than the default lease time, the default value is 7200. |

**\[View]**
DHCP pool Configuration View

**\[Notes]**
Run command **no lease-time** to restore lease time to default value

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# dhcp pool test1
sonic(config-dhcp-pool-t1)# lease-time 300 1000
```

### <font color="#1d50a2">bootfile *name*</font>

**\[Command]**
**bootfile** *name*

**\[Purpose]**
Configure bootfile option.

**\[Parameters]**

| **Parameter** | **Description** |
| ------------- | --------------- |
| *name*        | File name.      |

**\[View]**
DHCP pool Configuration View/DHCP option-group Configuration View

**\[Notes]**
Run command **no bootfile** to delete bootfile option

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# dhcp pool test1
sonic(config-dhcp-pool-t1)# bootfile-name test.txt
```

### <font color="#1d50a2">dns \{*A.B.C.D*|*A\:\:B*\}</font>

**\[Command]**
**dns** \{*A.B.C.D*|*A\::B*}

**\[Purpose]**
Configure DNS option.

**\[Parameters]**

| **Parameter** | **Description** |
| ------------- | --------------- |
| *A.B.C.D*     | IPv4 address.   |
| *A\::B*       | IPv6 address.   |

**\[View]**
DHCP pool Configuration View/ DHCP option-group Configuration View

**\[Notes]**
Run command **no dns** to delete DNS option

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# dhcp pool test1
sonic(config-dhcp-pool-t1)# dns 8.8.8.8
```

### <font color="#1d50a2">next-server \{*A.B.C.D*|*A\:\:B*\}</font>

**\[Command]**
**next-server** \{*A.B.C.D*|*A\::B*}

**\[Purpose]**
Configure next-server option.

**\[Parameters]**

| **Parameter** | **Description** |
| ------------- | --------------- |
| *A.B.C.D*     | IPv4 address.   |
| *A\::B*       | IPv6 address.   |

**\[View]**
DHCP pool Configuration View

**\[Notes]**
Run command **no next-server** to delete next-server option

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# dhcp pool test1
sonic(config-dhcp-pool-t1)# next-server 1.1.1.1
```

### <font color="#1d50a2">tftp-server \{*A.B.C.D*|*A\:\:B*\}</font>

**\[Command]**
**tftp-server** \{*A.B.C.D*|*A\::B*}

**\[Purpose]**
Configure tftp-server option.

**\[Parameters]**

| **Parameter** | **Description** |
| ------------- | --------------- |
| *A.B.C.D*     | IPv4 address.   |
| *A\::B*       | IPv6 address.   |

**\[View]**
DHCP pool Configuration View/DHCP option-group Configuration View

**\[Notes]**
Run command **no tftp-server** to delete tftp-server option

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# dhcp pool test1
sonic(config-dhcp-pool-t1)# tftp-server 2.2.2.2
```

### <font color="#1d50a2">capwap-ac *A.B.C.D*</font>

**\[Command]**
**capwap-ac** *A.B.C.D*

**\[Purpose]**
Configure capwap-ac option.

**\[Parameters]**

| **Parameter** | **Description** |
| ------------- | --------------- |
| *A.B.C.D*     | IPv4 address.   |

**\[View]**
DHCP pool Configuration View/DHCP option-group Configuration View

**\[Notes]**
Run command **no capwap-ac** to delete capwap-ac option

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# dhcp pool test1
sonic(config-dhcp-pool-t1)# capwap-ac 3.3.3.3
```

### <font color="#1d50a2">routers *A.B.C.D*</font>

**\[Command]**
**routers** *A.B.C.D*

**\[Purpose]**
Configure routers option.

**\[Parameters]**

| **Parameter** | **Description** |
| ------------- | --------------- |
| *A.B.C.D*     | IPv4 address.   |

**\[View]**
DHCP pool Configuration View/DHCP option-group Configuration View

**\[Notes]**
Only supports IPv4 addresses
Run command **no routers** to delete routers option

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# dhcp pool test1
sonic(config-dhcp-pool-t1)# routers 100.0.0.1
```

### <font color="#1d50a2">option43 hex *value* force</font>

**\[Command]**
**option43 hex** *value* **force**

**\[Purpose]**
Configure option43 option.

**\[Parameters]**

| **Parameter** | **Description**     |
| ------------- | ------------------- |
| *value*       | Hexadecimal number. |

**\[View]**
DHCP pool Configuration View/DHCP option-group Configuration View

**\[Notes]**
Run command **no option43** to delete routers option

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# dhcp pool test1
sonic(config-dhcp-pool-t1)# option43 hex 10 force
```

### <font color="#1d50a2">class *name* address-pool *start\_ip end\_ip*</font>

**\[Command]**
**class** *name* **address-pool** *start\_ip end\_ip*

**\[Purpose]**
Configure DHCP user class IP range.

**\[Parameters]**

| **Parameter** | **Description** |
| ------------- | --------------- |
| *name*        | Class name      |
| *start\_ip*   | Start\_ip       |
| *end\_ip*     | End\_ip         |

**\[View]**
DHCP pool Configuration View

**\[Notes]**
Run command **no class** *name* **address-pool** to delete DHCP user class IP range

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# dhcp pool test1
sonic(config-dhcp-pool-t1)# class test1 address-pool 100.0.0.110 100.0.0.150
```

### <font color="#1d50a2">class *name* option-group *id*</font>

**\[Command]**
**class** *name* **option-group** *id*

**\[Purpose]**
Bind class and option-group.

**\[Parameters]**

| **Parameter** | **Description** |
| ------------- | --------------- |
| *name*        | Class name.     |
| *id*          | Option-group ID |

**\[View]**
DHCP pool Configuration View

**\[Notes]**
Run command **no class** *name* **option-group** to unbind class and option-group

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# dhcp pool test1
sonic(config-dhcp-pool-t1)# class test1 option-group 1
```

### <font color="#1d50a2">if-match rule *rule\_id* option *option\_id*</font>

**\[Command]**
**if-match rule** *rule\_id* **option** *option\_id*

**\[Purpose]**
Create user class matching rule.

**\[Parameters]**

| **Parameter** | **Description**                                                                                               |
| ------------- | ------------------------------------------------------------------------------------------------------------- |
| *rule\_id*    | Rule id, also indicating priority, with a value range of 1-16. The larger the value, the higher the priority. |
| *option\_id*  | Option ID, currently only supports 82 and 93.                                                                 |

**\[View]**
DHCP class Configuration View

**\[Notes]**
Run command **no if-match rule** *rule\_id* to delete user class matching rule.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# dhcp class test1
sonic(config-dhcp-class-test1)# if-match rule 1 option 93 hex ffff
```

### <font color="#1d50a2">dhcp failover *name*</font>

**\[Command]**
**dhcp failover** *name*

**\[Purpose]**
Enable DHCP Server failover.

**\[Parameters]**

| **Parameter** | **Description** |
| ------------- | --------------- |
| *name*        | Instance name.  |

**\[View]**
Global Configuration View

**\[Notes]**
Run command **no dhcp failover** *name* to disable DHCP Server failover.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# dhcp failover t456
```

### <font color="#1d50a2">a</font><font color="#1d50a2">dddress \{*A.B.C.D*|loopback 0\}</font>

**\[Command]**
**adddress** \{*A.B.C.D*|**loopback 0**}

**\[Purpose]**
Configure local IP.

**\[Parameters]**

| **Parameter** | **Description** |
| ------------- | --------------- |
| *A.B.C.D*     | IPv4 address.   |

**\[View]**
DHCP failover Configuration View

**\[Notes]**
Run command **no address** to delete local IP

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# dhcp failover t456
sonic(config-dhcp-failover-t456)# address 20.0.0.1
```

### <font color="#1d50a2">peer address *A.B.C.D*</font>

**\[Command]**
**peer address** *A.B.C.D*

**\[Purpose]**
Configure peer IP.

**\[Parameters]**

| **Parameter** | **Description** |
| ------------- | --------------- |
| *A.B.C.D*     | IPv4 address.   |

**\[View]**
DHCP failover Configuration View

**\[Notes]**
Run command **no peer address** to delete peer IP

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# dhcp failover t456
sonic(config-dhcp-failover-t456)# peer address 20.0.0.2
```

### <font color="#1d50a2">auto-partner-down *time*</font>

**\[Command]**
**auto-partner-down** *time*

**\[Purpose]**
Configure peer offline time.

**\[Parameters]**

| **Parameter** | **Description**                                                                                  |
| ------------- | ------------------------------------------------------------------------------------------------ |
| *time*        | Peer offline time, in seconds and ranging from 1 to 3600. By default, peers will not go offline. |

**\[View]**
DHCP failover Configuration View

**\[Notes]**
Run command **auto-partner-down** to disable peer offline function

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# dhcp failover t456
sonic(config-dhcp-failover-t456)# auto-partner-down 100
```

### <font color="#1d50a2">max-response-delay *time*</font>

**\[Command]**
**max-response-delay** *time*

**\[Purpose]**
Configure maximum communication interruption time.

**\[Parameters]**

| **Parameter** | **Description**                                                                                                       |
| ------------- | --------------------------------------------------------------------------------------------------------------------- |
| *time*        | The maximum communication interruption time, measured in seconds, ranges from 30 to 3600, with a default value of 60. |

**\[View]**
DHCP failover Configuration View

**\[Notes]**
Run command **nomax-response-delay** to restore maximum communication time to default value

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# dhcp failover t456
sonic(config-dhcp-failover-t456)# max-response-delay 100
```

### <font color="#1d50a2">role \{primary|secondary\}</font>

**\[Command]**
**role** \{**primary|secondary**}

**\[Purpose]**
Configure primary and secondary roles.

**\[Parameters]**

| **Parameter** | **Description** |
| ------------- | --------------- |
| *A.B.C.D*     | IPv4 address.   |

**\[View]**
DHCP failover Configuration View

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# dhcp failover t456
sonic(config-dhcp-failover-t456)# role primary
```

