- Table of Contents
-
- 08-System Volume
- 00-System Volume Organization
- 01-Login Commands
- 02-Basic System Configuration Commands
- 03-Device Management Commands
- 04-File System Management Commands
- 05-SNMP Commands
- 06-RMON Commands
- 07-MAC Address Table Management Commands
- 08-System Maintaining and Debugging Commands
- 09-Information Center Commands
- 10-PoE Commands
- 11-Track Commands
- 12-NQA Commands
- 13-NTP Commands
- 14-VRRP Commands
- 15-HA Commands
- 16-Hotfix Commands
Title | Size | Download |
---|---|---|
07-MAC Address Table Management Commands | 52.68 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 mac-learning
mac-address (Ethernet interface view)
mac-address mac-learning disable
MAC Address Table Management Configuration Commands
display mac-address
Syntax
display mac-address blackhole [ vlan vlan-id ] [ count ]
display mac-address [ mac-address [ vlan vlan-id ] | [ dynamic | static ] [ interface interface-type interface-number ] [ vlan vlan-id ] [ count ] ]
View
Any view
Default Level
1: Monitor level
Parameters
blackhole: Displays blackhole MAC address entries. These entries do not age but you can add or remove them. The packets whose destination MAC addresses match 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 00e0-fc01-0101.
<Sysname> display mac-address 00e0-fc01-0101
MAC ADDR VLAN ID STATE PORT INDEX AGING TIME(s)
00e0-fc01-0101 1 Config static Ethernet2/0/2 NOAGED
--- 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: 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(s) |
Aging time, which could be: l AGING, indicates that the entry is aging. l NOAGED, indicates that the entry does not age. |
display mac-address aging-time
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.
display mac-address mac-learning
Syntax
display mac-address mac-learning [ interface-type interface-number ]
View
Any view
Default Level
1: Monitor level
Parameters
interface-type interface-number: Specifies an interface by its type and number. Displays MAC address learning status of the specified interface.
Description
Use the display mac-address mac-learning command to display MAC address learning status of the specified or all Ethernet ports.
Examples
# Display MAC address learning status of port GigabitEthernet 2/0/1.
<Sysname> display mac-address mac-learning gigabitethernet 2/0/1
Mac address learning status of the switch: enable
PortName Learning Status
GigabitEthernet2/0/1 enable
Table 1-2 display mac-address mac-learning command output description
Field |
Description |
Mac address learning status of the switch |
Global MAC address learning status, enabled or disabled |
PortName |
Port name |
Learning Status |
MAC address learning status for a port, enabled or disabled |
mac-address (Ethernet interface view)
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 Ethernet port.
Use the undo mac-address command to remove a MAC address entry on the Ethernet port.
Note that:
l 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.
l You cannot configure a static or dynamic MAC address entry on an aggregation port.
Related commands: display mac-address.
Examples
# Add a static entry for MAC address 00e0-fc01-0101 on port GigabitEthernet 2/0/1 which belongs to VLAN 2.
<Sysname> system-view
[Sysname] interface gigabitethernet 2/0/1
[Sysname-GigabitEthernet2/0/1] mac-address static 00e0-fc01-0101 vlan 2
mac-address (system view)
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: Blackhole MAC address entries. These entries do not age but you can add or remove them. The packets whose destination MAC addresses match 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.
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 00e0-fc01-0101. All frames destined to this MAC address are sent out of port GigabitEthernet 2/0/1 which belongs to VLAN 2.
<Sysname> system-view
[Sysname] mac-address static 00e0-fc01-0101 interface gigabitethernet 2/0/1 vlan 2
mac-address mac-learning disable
Syntax
mac-address mac-learning disable
undo mac-address mac-learning disable
View
System view, Ethernet interface view, Layer-2 aggregate interface view, port group view
Default Level
2: System level
Parameters
None
Description
Use the mac-address mac-learning disable command to disable MAC address learning globally, on one or a group of Ethernet ports, or on a Layer-2 aggregate interface, depending on the view you entered.
Use the undo mac-address mac-learning disable command to enable MAC address learning globally, on one or a group of Ethernet ports, or on a VLAN, depending on the view you entered.
By default, MAC address learning is enabled globally and on all Ethernet ports.
Note that:
l You may need to disable MAC address learning sometimes to prevent the MAC address table from being saturated, for example, when your device is being attacked by a great deal of packets with different source MAC addresses. This somewhat affects update of the MAC address table.
l As disabling MAC address learning may result in broadcast storms, you need to enable broadcast storm suppression after you disable MAC address learning on a port.
Related commands: display mac-address mac-learning.
When MAC address learning is disabled, the learned MAC addresses remain valid until they age out.
Examples
# Disable global MAC address learning.
<Sysname> system-view
[Sysname] mac-address mac-learning disable
# Disable MAC address learning on port GigabitEthernet 2/0/1.
<Sysname> system-view
[Sysname] interface gigabitethernet 2/0/1
[Sysname-GigabitEthernet2/0/1] mac-address mac-learning disable
mac-address max-mac-count
Syntax
mac-address max-mac-count count
undo mac-address max-mac-count
View
Ethernet interface view, port group view
Default Level
2: System level
Parameters
count: Maximum number of MAC addresses that can be learned on a port, in the range 0 to 4096. When the argument takes 0, the VLAN is not allowed to learn MAC addresses.
Description
Use the mac-address max-mac-count command to configure the maximum number of MAC addresses that can be learned on an Ethernet port.
Use the undo mac-address max-mac-count command to remove the restriction on the maximum number of MAC addresses that can be learned on an Ethernet port.
By default, no maximum number of MAC addresses that can be learned on a port is configured.
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.
By using this command with the static MAC address function, you can disable an interface or a port group from learning MAC addresses, and only allow the packets with the specified destination address to pass, thus avoiding the access to the network from the illegal devices.
The Layer-2 aggregate interface and member interface not support this function.
Related commands: mac-address (system view), mac-address (Ethernet interface view), mac-address timer.
Examples
# Set the maximum number of MAC addresses that can be learned on port GigabitEthernet 2/0/1 to 600. After this upper limit is reached, frames received with unknown destination MAC addresses on the port will not be forwarded.
<Sysname> system-view
[Sysname] interface gigabitethernet 2/0/1
[Sysname-GigabitEthernet2/0/1] mac-address max-mac-count 600
mac-address timer
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,in the range 10 to 86400.
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.
By default the default aging timer 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