---
title: MAC-Trigger Configuration
slug: enterprise-v5p2/mac-trigger-configuration
description: IP Service Configuration
createdAt: 2025-11-14T03:58:48.043Z
---

# <font color="#1d50a2">Introduction</font>

MAC-Trigger is a feature that triggers the learning of HostRoutes (32-bit host routes) based on the source MAC address (SMAC). It works primarily in conjunction with DHCP-Snooping entries. Its purpose is to ensure timely updating of host routes when a user's IP address and gateway MAC address remain unchanged after migration. This guarantees the quality of the network during user migration when they send business traffic.

# <font color="#1d50a2">Explanation of Principles</font>

As depicted in the diagram, when a terminal migrates to a new device and sends its first packet, this packet might not be an ARP/ND packet. Consequently, it cannot trigger the ARP/ND learning process, leading to a delay in updating the host route. This inconsistency in the data packet's round-trip path hinders the terminal from accessing the network properly.

::Image[]{src="https://app.archbee.com/api/optimize/zl-MD6bX0o2Ab3p8w66u1/smWY7eO1jJLD12GNVetfI-20251202-112945.png" size="90" width="1450" height="497" position="center" showCaption="false"}

When the MAC-Trigger feature is enabled, after a terminal user migrates to a new device, the device checks its local MAC table. If there is no entry in the local MAC address table that matches the source MAC address of the packet, the MAC-Trigger learning is triggered. This learning process is combined with the ARP-TO-HOST learning feature. The newly learned ARP/ND entries are converted into corresponding host routes. These routes are then synchronized to other devices in the network environment via the BGP protocol. This ensures that when a terminal user migrates without changes in their IP address and gateway MAC address, the host routes are promptly updated. This effective update safeguards the network quality during user migration.

For instance, when a user comes online on LeafB, the device checks its local MAC table. If there is no entry that matches the source MAC address of the packet, the MAC-Trigger is triggered. It learns both MAC and ARP/NDP entries. This is often used in conjunction with cluster configuration. The newly learned ARP/NDP entries are transformed into host routes, which are synchronized to the Spine devices through the BGP protocol. This triggers the removal of entries on the source device, achieving fast migration effects.

::Image[]{src="https://app.archbee.com/api/optimize/zl-MD6bX0o2Ab3p8w66u1/N7u5DlCIfmaSNZQFHlTXW-20251202-113007.png" size="90" width="1368" height="497" position="center" showCaption="false"}

# <font color="#1d50a2">MAC-Trigger Configuration</font>

| **Operation**                        | **Command**             | **Description** |
| ------------------------------------ | ----------------------- | --------------- |
| Enter the system  configuration view | **configure  terminal** |                 |
| Enter the VLAN view                  | **vlan** *ID*           |                 |
| Enable mac-trigger  function         | **mac-trigger enable**  |                 |

## <font color="#1d50a2">Display and Maintenance</font>

| **Operation**                                 | **Command**                                | **Description** |
| --------------------------------------------- | ------------------------------------------ | --------------- |
| Display  the configuration of the MAC-Trigger | **show  vlan mac-trigger \[vlan-id** *ID]* |                 |

# <font color="#1d50a2">Configuration Example</font>

<font color="#1d50a2">**Network requirements**</font>

Users access network through APs, requirement terminal can come online quickly after migration from Leaf A to Leaf B.

::Image[]{src="https://app.archbee.com/api/optimize/zl-MD6bX0o2Ab3p8w66u1/52b82nHikr2JeHCbiOvUg-20251202-113119.png" size="80" width="1078" height="660" position="center" showCaption="false"}

<font color="#1d50a2">**Procedure**</font>

1. Leaf A Configuration

\# Leaf A creates a BGP neighbor with Spine

```text
sonic(config)# vlan 500
sonic(config)# interface ethernet 50
sonic(config-if-50)# switchport access vlan 500
sonic(config)# interface vlan 500
sonic(config-vlanif-500)# ip address 10.255.8.1/30
sonic(config-vlanif-500)# exit
sonic(config)# router bgp 65200
sonic(config-router)# bgp router-id 10.15.1.1
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 10.255.8.2 remote-as 65100
sonic(config-router)# neighbor 10.255.8.2 bfd 
sonic(config-router)# neighbor 10.255.8.2 description SPineA
```

\# Leaf A configures the AP downlink port to configure the MAC address of the VLAN gateway where the user segment of the downlink port is located as a fixed MAC address

```text
sonic(config)# vlan 800
sonic(config-vlan-800)# mac-address 00:01:01:01:08:00
sonic(config-vlan-800)# exit
sonic(config)# interface ethernet 1
sonic(config-if-1)# switchport access vlan 800
sonic(config)# interface vlan 800
sonic(config-vlanif-800)# ip address 192.168.52.1/24
sonic(config-vlanif-800)# exit
```

\# Leaf A configures DHCP Relay related functions

```text
sonic(config)# dhcp-relay test v4 
sonic(config-dhcp-relay-test__v4)# down_link interface vlan 800
sonic(config-dhcp-relay-test__v4)# up_link interface vlan500
sonic(config-dhcp-relay-test__v4)# server_ip 150.1.0.1
sonic(config-dhcp-relay-test__v4)# loopback_interface loopback 0
sonic(config-dhcp-relay-test__v4)# exit
```

\# Leaf A Enables MAC-Trigger

```text
sonic(config)# vlan 800 
sonic(config-vlan-800)# mac-trigger enable
```

2. Leaf B and Leaf A configurations are identical
3. Spine

```text
sonic(config)# router bgp 65100
sonic(config-router)# bgp router-id 10.15.1.3
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 10.255.8.1 remote-as 65200
sonic(config-router)# neighbor 10.255.8.1 bfd 
sonic(config-router)# neighbor 10.255.8.1 description LeafA
```

<font color="#1d50a2">**Verify configuration**</font>

```text
sonic# show vlan mac_trigger 
+---------+----------+
| VLANID  | STATUS   |
+=========+==========+
|   800   | enabled  |
+---------+----------+
```

When a user migrates from Leaf A to Leaf B, Leaf B can quickly learn the ARP table entries.

****

