08-MAC Address Table Management Commands
Chapters Download (48.12 KB)
Table of Contents
1 MAC Address Table Management Configuration Commands
MAC Address Table Management Configuration Commands
display mac-address aging-time
display mac-address statistics
mac-address max-mac-count (Interface view)
Interfaces that MAC address table management involves can only be Layer 2 Ethernet ports.
Syntax
display mac-address [ mac-address [ vlan vlan-id ] | [ [ dynamic | static ] [ interface interface-type interface-number ] | blackhole ] [ vlan vlan-id ] [ count ] ]
View
Any view
Default Level
1: Monitor level
Parameters
blackhole: Destination blackhole MAC address entries. These entries do not age but you can add or remove them. Packets whose destination MAC addresses match destination blackhole MAC address entries are dropped.
vlan vlan-id: Displays MAC address entries of the specified VLAN, where vlan-id is in the range 1 to 4094.
count: Displays the total number of MAC addresses in the MAC address table.
mac-address: Displays MAC address entries in a specified MAC address, in the format of H-H-H.
dynamic: Displays dynamic MAC address entries. Aging time is set for these entries.
static: Displays static MAC address entries. Similar to blackhole MAC address entries, these entries do not age but you can add or remove them.
interface interface-type interface-number: Displays MAC address learning status of the specified interface. interface-type interface-number specifies an interface by its type and number.
Description
Use the display mac-address command to display information about the MAC address table.
Related commands: mac-address (system view), mac-address (Ethernet interface view), mac-address timer.
Examples
# Display the MAC address table entry for MAC address 000f-e201-0101.
<Sysname> display mac-address 000f-e201-0101
MAC ADDR VLAN ID STATE PORT INDEX AGING TIME
000f-e201-0101 1 Learned GigabitEthernet1/0/1 AGING
--- 1 mac address(es) found ---
Table 1-1 display mac-address command output description
Field |
Description |
MAC ADDR |
MAC address |
VLAN ID |
ID of the VLAN to which the MAC address belongs |
STATE |
State of a MAC address, includes: l Config static: static entry configured by the user manually l Config dynamic: dynamic entry configured by the user manually l Learned: entry learned by the device l Blackhole: destination blackhole entry |
PORT INDEX |
Number of the port corresponding to the MAC address, that is, packets destined to this MAC address will be sent out from this port. (Displayed as N/A for a blackhole MAC address entry). |
AGING TIME |
Aging time, which could be: l AGING, indicates that the entry is aging. l NOAGED, indicates that the entry does not age. |
Syntax
display mac-address aging-time
View
Any view
Default Level
1: Monitor level
Parameters
None
Description
Use the display mac-address aging-time command to display the aging time of dynamic entries in the MAC address table.
Related commands: mac-address (system view), mac-address (Ethernet interface view), mac-address timer, display mac-address.
Examples
# Display the aging time of dynamic entries in the MAC address table.
<Sysname> display mac-address aging-time
Mac address aging time: 300s
The above information indicates that the aging time of dynamic entries in the MAC address table is 300 seconds.
Syntax
display mac-address statistics
View
Any view
Default Level
1: Monitor level
Parameters
statistics: Displays the statistics of the MAC address table.
Description
Use the display mac-address statistics command to display the statistics of the MAC address table.
Examples
# Display the statistics of the MAC address table.
<Sysname> display mac-address statistics
MAC TYPE LEARNED USER-DEFINED SYSTEM-DEFINED IN-USE AVAILABLE
Dynamic Unicast 0 0 0 0
Static Unicast 0 1 1 2 1024
Total Unicast 2 16384
Dynamic Multicast 0 0 0 0
Static Multicast 0 0 0 0 4094
Total Multicast 0 0
Table 1-2 display mac-address statistics command output description
Field |
Description |
MAC TYPE |
MAC address type: l Dynamic Unicast l Static Unicast l Total Unicast l Dynamic Multicast l Static Multicast l Total Multicast |
LEARNED |
Dynamically learned MAC addresses |
USER-DEFINED |
User defined MAC addresses (dynamic and static) |
SYSTEM-DEFINED |
MAC addresses generated by the system (for example, 802.1x and MAC authentication) |
IN-USE |
Total MAC address types |
AVAILABLE |
Maximum number of MAC addresses supported by the system |
Syntax
mac-address { dynamic | static } mac-address vlan vlan-id
undo mac-address { dynamic | static } mac-address vlan vlan-id
View
Ethernet interface view, Layer 2 aggregate interface view
Default Level
2: System level
Parameters
dynamic: Dynamic MAC address entries. Aging time is set for these entries.
static: Static MAC address entries. They do not age but you can add or remove them.
mac-address: Specifies a MAC address in the format of H-H-H, where 0s at the beginning of each H (16-bit hexadecimal digit) can be omitted; for example, inputting “f-e2-1” indicates that the MAC address is “000f-00e2-0001”.
vlan vlan-id: Specifies an existing VLAN to which the Ethernet interface belongs, where vlan-id is the specified VLAN ID, in the range 1 to 4094.
Description
Use the mac-address command to add or modify a MAC address entry on a specified interface.
Use the undo mac-address command to remove a MAC address entry on the interface.
Note that, as your MAC address entries configuration cannot survive a reboot, save it after completing the configuration. The dynamic MAC address table entries however will be lost whether you save the configuration or not.
Related commands: display mac-address.
Examples
# Add a static entry for MAC address 000f-e201-0101 on port GigabitEthernet1/0/1 that belongs to VLAN 2.
<Sysname> system-view
[Sysname] interface gigabitethernet1/0/1
[Sysname-GigabitEthernet1/0/1] mac-address static 000f-e201-0101 vlan 2
# Add a static entry for MAC address 000f-e201-0102 on port Bridge-Aggregation 1 that belongs to VLAN 1.
<Sysname> system-view
[Sysname] interface bridge-Aggregation 1
[Sysname-Bridge-Aggregation1] mac-address static 000f-e201-0102 vlan 1
Syntax
mac-address blackhole mac-address vlan vlan-id
mac-address { dynamic | static } mac-address interface interface-type interface-number vlan vlan-id
undo mac-address [ { dynamic | static } mac-address interface interface-type interface-number vlan vlan-id ]
undo mac-address [ blackhole | dynamic | static ] [ mac-address ] vlan vlan-id
undo mac-address [ dynamic | static ] mac-address interface interface-type interface-number vlan vlan-id
undo mac-address [ dynamic | static ] interface interface-type interface-number
View
System view
Default Level
2: System level
Parameters
blackhole: Destination blackhole MAC address entries. These entries do not age but you can add or remove them. The packets whose destination MAC addresses match destination blackhole MAC address entries are dropped.
mac-address: Specifies a MAC address in the format of H-H-H, where 0s at the beginning of each H (16-bit hexadecimal digit) can be omitted; for example, inputting “f-e2-1” indicates that the MAC address is “000f-00e2-0001”.
vlan vlan-id: Specifies an existing VLAN to which the Ethernet interface belongs, where vlan-id is the specified VLAN ID, in the range 1 to 4094.
dynamic: Dynamic MAC address entries. Aging time is set for these entries.
static: Static MAC address entries. These entries do not age but you can add or remove them.
interface interface-type interface-number: Outbound interface, with interface-type interface-number representing the interface type and number.
Description
Use the mac-address command to add or modify a MAC address entry.
Use the undo mac-address command to remove one or all MAC address entries.
Note that a static or blackhole entry will not be overwritten by a dynamic entry, but a dynamic entry can be overwritten by a static or blackhole entry. However, you can delete any type of MAC address entries.
As your MAC address entries configuration cannot survive a reboot, save it after completing the configuration. The dynamic entries however will be lost whether you save the configuration or not.
Related commands: display mac-address.
Examples
# Add a static entry for MAC address 000f-e201-0101. All frames destined to this MAC address are sent out of port GigabitEthernet1/0/1 which belongs to VLAN 2.
<Sysname> system-view
[Sysname] mac-address static 000f-e201-0101 interface gigabitethernet1/0/1 vlan 2
Syntax
mac-address max-mac-count { count | disable-forwarding }
undo mac-address max-mac-count [ disable-forwarding ]
View
Ethernet interface view, port group view, Layer 2 aggregate interface view
Default Level
2: System level
Parameters
count: Maximum number of MAC addresses that can be learned on a port. When the argument takes 0, the VLAN is not allowed to learn MAC addresses. The value range for this argument is 0 to 16384.
disable-forwarding: Disables forwarding of frames with unknown source MAC addresses after the number of learned MAC addresses reaches the upper limit. Frames with the source MAC addresses listed in the MAC address table will be forwarded normally.
Description
Use the mac-address max-mac-count count command to configure the maximum number of MAC addresses that can be learned on a port.
Use the mac-address max-mac-count disable-forwarding command to configure not to forward frames with unknown source MAC addresses after the number of learned MAC addresses reaches the upper limit.
Use the undo mac-address max-mac-count command to restore the default maximum number of MAC addresses that can be learned on an Ethernet port.
Use the undo mac-address max-mac-count disable-forwarding command to allow forwarding frames received on an Ethernet port with unknown source MAC addresses after the number of learned MAC addresses reaches the upper limit.
The default maximum number of MAC addresses that can be learned is not configured. When the upper limit is reached, frames received are forwarded by default.
If the command is executed in interface view, the configuration takes effect on the current interface; if the command is executed in port group view, the configuration takes effect on all ports belonging to the port group.
Related commands: mac-address, mac-address timer.
Examples
# Set the maximum number of MAC addresses that can be learned on port GigabitEthernet1/0/1 to 600. After this upper limit is reached, frames received with unknown source MAC addresses on the port will not be forwarded.
<Sysname> system-view
[Sysname] interface gigabitethernet1/0/1
[Sysname-GigabitEthernet1/0/1] mac-address max-mac-count 600
[Sysname-GigabitEthernet1/0/1] mac-address max-mac-count disable-forwarding
Syntax
mac-address timer { aging seconds | no-aging }
undo mac-address timer aging
View
System view
Default Level
2: System level
Parameters
aging seconds: Sets an aging timer (in seconds) for dynamic MAC address entries. The value range for the seconds argument is 10 to 630.
no-aging: Sets dynamic MAC address entries not to age.
Description
Use the mac-address timer command to configure the aging timer for dynamic MAC address entries.
Use the undo mac-address timer command to restore the default.
The default of this command is 300 seconds.
Set the aging timer appropriately: a long aging interval may cause the MAC address table to retain outdated entries and fail to accommodate the latest network changes; a short interval may result in removal of valid entries and hence unnecessary broadcasts which may affect device performance.
Examples
# Set the aging timer for dynamic MAC address entries to 500 seconds.
<Sysname> system-view
[Sysname] mac-address timer aging 500