Skip to content
Ask AI

MAC

Table 1 MAC View

CommandPurpose
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-limitDisplay MAC limit configuration.
Section titled “show mac-address [{ethernet|link-aggregation} interface_name|all]”

[Command]

show mac-address [{ethernet|link-aggregation} interface_name|all]

[Purpose]

Display MAC address table.

[Parameters]

ParameterDescription
interface_nameInterface name (eg.0/1)

[View]

Privileged User View

[Use Cases]

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
Section titled “clear mac-address [{ethernet|link-aggregation} interface_name|vlan vlan-id] {static|dynamic|all}”

[Command]

clear mac-address [{ethernet|link-aggregation} interface_name|vlan vlan-id] {static|dynamic|all}

[Purpose]

Clear MAC entries.

[Parameters]

ParameterDescription
interface_nameInterface name (eg.0/1)
vlan-idVLAN ID, the range is [1,4094].

[View]

Privileged User View

[Use Cases]

sonic# clear mac-address dynamic

[Command]

show mac-limit

[Purpose]

Display MAC limit configuration.

[View]

Privileged User View

[Use Cases]

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

Table 2 MAC Config

CommandPurpose
mac-address static HH:HH:HH:HH:HH:HH vlan vlan-id {ethernet|link-aggregation} interface_nameConfigure a static MAC entry.
mac-address static HH:HH:HH:HH:HH:HH vlan vlan-id blackholeConfigure a blackhole MAC entry.
mac-address timer {aging aging-time|no-aging}Set MAC aging time.
mac-limit dynamic mac-limit-valueSet a limit to the number of dynamic MAC table entries.
Section titled “mac-address static HH:HH:HH:HH:HH:HH vlan vlan-id {ethernet|link-aggregation} interface_name”

[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]

ParameterDescription
HH:HH:HH:HH:HH:HHMAC address.
vlan-idVLAN ID, the range is [1,4094].
interface_nameInterface 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]

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

mac-address static HH:HH:HH:HH:HH:HH vlan vlan-id blackhole

Section titled “mac-address static HH:HH:HH:HH:HH:HH vlan vlan-id blackhole”

[Command]

mac-addressstatic HH:HH:HH:HH:HH:HH vlan vlan-id blackhole

[Purpose]

Configure a blackhole MAC entry.

[Parameters]

ParameterDescription
HH:HH:HH:HH:HH:HHMAC address.
vlan-idVLAN 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]

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

mac-address timer {aging aging-time|no-aging}

Section titled “mac-address timer {aging aging-time|no-aging}”

[Command]

mac-address timer {aging aging-time|no-aging}

[Purpose]

Set MAC aging time.

[Parameters]

ParameterDescription
aging-timeSpecify 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]

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

[Command]

mac-limit dynamic mac-limit-value

[Purpose]

Set a limit to the number of dynamic MAC table entries.

[Parameters]

ParameterDescription
mac-limit-valueThe 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]

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