---
title: MAC
slug: aidc/mac
createdAt: 2025-12-01T11:11:06.000Z
---

## <font color="#1d50a2">MAC View</font>

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

| **Command**                                                                                                          | ****<font color="#0C121D">**Purpose**</font> |
| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------- |
| **show mac-address** \[\{**ethernet\|link-aggregation**} *interface\_name\|all*]                                     | Display MAC address table.                   |
| **clear mac-address** \[\{*ethernet\|link-aggregation*} *interface\_name\|vlan* *vlan-id*] \{*static\|dynamic\|all*} | Clear MAC entries.                           |
| **show mac-limit**                                                                                                   | Display MAC limit configuration.             |

### <font color="#1d50a2">show mac-address \[\{ethernet|link-aggregation\} *interface\_name*|all\]</font>

**\[Command]**
**show mac-address** \[\{**ethernet**|**link-aggregation**} *interface\_name*|**all**]

**\[Purpose]**
Display MAC address table.

**\[Parameters]**

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

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show mac-address
  No.    Vlan  MacAddress         Port       Type
-----  ------  -----------------  ---------  ---------
    1     100  E2:8C:56:85:4A:11  0/0        Static
Total number of entries 1
sonic# show mac-address all
  No.    Vlan  MacAddress         Port         Type
-----  ------  -----------------  -----------  -------
    1     200  AA:BB:CC:11:22:33  0/129        Dynamic
Total number of entries 1
+--------+-------------------+--------------+-------+--------+
|   VLAN | MAC               | RemoteVTEP   |   VNI | Type   |
+========+===================+==============+=======+========+
|    200 | 60:EB:5A:01:10:B1 | 10.193.2.102 |   200 | Static |
+--------+-------------------+--------------+-------+--------+

Total count : 1
Aging time for switch is 1800 seconds
```

### <font color="#1d50a2">clear mac-address \[\{ethernet|link-aggregation\} *interface\_name*|vlan *vlan-id*\] \{static|dynamic|all\}</font>

**\[Command]**
**clear mac-address** \[\{**ethernet**|**link-aggregation**} *interface\_name*|**vlan** *vlan-id*] \{**static**|**dynamic**|**all**}

**\[Purpose]**
Clear MAC entries.

**\[Parameters]**

| **Parameter**     | **Description**                  |
| ----------------- | -------------------------------- |
| *interface\_name* | Interface name (eg.0/1)          |
| *vlan-id*         | VLAN ID, the range is \[1,4094]. |

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# clear mac-address dynamic
```

### <font color="#1d50a2">show mac-limit</font>

**\[Command]**
**show mac-limit**

**\[Purpose]**
Display MAC limit configuration.

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show mac-limit
Interface      Mac-limit
-----------  -----------
0/1                  100
0/2                  200
```

## <font color="#1d50a2">MAC Config</font>

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

| **Command**                                                                                                            | **Purpose**                                             |
| ---------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
| **mac-address static** *HH\:HH\:HH\:HH\:HH\:HH* **vlan** *vlan-id* **\{ethernet\|link-aggregation}** *interface\_name* | Configure a static MAC entry.                           |
| **mac-address static** *HH\:HH\:HH\:HH\:HH\:HH* **vlan** *vlan-id* **blackhole**                                       | Configure a blackhole MAC entry.                        |
| **mac-address timer** \{**aging** *aging-time\|no-aging*}                                                              | Set MAC aging time.                                     |
| **mac-limit dynamic** *mac-limit-value*                                                                                | Set a limit to the number of dynamic MAC table entries. |

### <font color="#1d50a2">mac-address static *HH\:HH\:HH\:HH\:HH\:HH* vlan *vlan-id* \{ethernet|link-aggregation\} *interface\_name*</font>

**\[Command]**
**mac-address static** *HH\:HH\:HH\:HH\:HH\:HH* **vlan** *vlan-id* \{**ethernet**|**link-aggregation**} *interface\_name*

**\[Purpose]**
Configure a static MAC entry.

**\[Parameters]**

| **Parameter**            | **Description**                  |
| ------------------------ | -------------------------------- |
| *HH\:HH\:HH\:HH\:HH\:HH* | MAC address.                     |
| *vlan-id*                | VLAN ID, the range is \[1,4094]. |
| *interface\_name*        | Interface name (eg.0/1)          |

**\[View]**
Global Configuration View

**\[Notes]**
Run command **no mac-address static** *HH\:HH\:HH\:HH\:HH\:HH* **vlan** *vlan-id* to delete a static MAC entry.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# mac-address static aa:aa:aa:aa:aa:aa vlan 4 ethernet 0/4
```

### <font color="#1d50a2">mac-address static *HH\:HH\:HH\:HH\:HH\:HH* vlan *vlan-id* blackhole</font>

**\[Command]**
**mac-addressstatic** *HH\:HH\:HH\:HH\:HH\:HH* **vlan** *vlan-id* **blackhole**

**\[Purpose]**
Configure a blackhole MAC entry.

**\[Parameters]**

| **Parameter**            | **Description**                  |
| ------------------------ | -------------------------------- |
| *HH\:HH\:HH\:HH\:HH\:HH* | MAC address.                     |
| *vlan-id*                | VLAN ID, the range is \[1,4094]. |

**\[View]**
Global Configuration View

**\[Notes]**
Run command **no mac-address static** *HH\:HH\:HH\:HH\:HH\:HH* **vlan** *vlan-id* to delete a blackhole MAC entry.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# mac-address  aa:bb:bb:bb:bb:bb vlan 5 blackhole
```

### <font color="#1d50a2">mac-address timer \{aging *aging-time*|no-aging\}</font>

**\[Command]**
**mac-address timer** \{**aging** *aging-time*|**no-aging**}

**\[Purpose]**
Set MAC aging time.

**\[Parameters]**

| **Parameter** | **Description**                                                                           |
| ------------- | ----------------------------------------------------------------------------------------- |
| *aging-time*  | Specify the aging time in seconds, the default is 1800, and the range is from 30 to 7200. |

**\[View]**
Global Configuration View

**\[Notes]**
MAC aging time is a parameter that affects MAC self-learning on the switch.
Dynamic MAC entries will be automatically discarded after aging; and static MAC entries are not affected by MAC aging time.
Run command **mac-address timer no-aging** to disable MAC aging.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# mac-address timer aging 3600
sonic(config)# mac-address timer no-aging
```

### <font color="#1d50a2">mac-limit dynamic *mac-limit-value*</font>

**\[Command]**
**mac-limit dynamic** *mac-limit-value*

**\[Purpose]**
Set a limit to the number of dynamic MAC table entries.

**\[Parameters]**

| **Parameter**     | **Description**                |
| ----------------- | ------------------------------ |
| *mac-limit-value* | The range is from 1 to 131072. |

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

**\[Notes]**
Only CX308P-48Y-N-V2 and CX532P-N-V2 support this feature.
Only VLAN or VLAN member ports are allowed to configure the MAC number limit.
Run command **no mac-limit dynamic** to delete MAC limit configuration.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface ethernet 0/0
sonic(config-if-0/0)# mac-limit dynamic 1000
sonic(config-if-0/0)# exit
sonic(config)# vlan 30
sonic(config-vlan-30)# mac-limit dynamic 2000
```

