Title | Size | Downloads |
---|---|---|
07-MAC Address Table Management Commands.pdf | 46.67 KB |
- Table of Contents
- Related Documents
-
Title | Size | Download |
---|---|---|
07-MAC Address Table Management Commands | 46.67 KB |
Table of Contents
Chapter 1 MAC Address Table Management Configuration Commands
1.1 MAC Address Table Management Configuration Commands
1.1.2 display mac-address aging-time
1.1.3 display mac-address mac-learning
1.1.4 mac-address (Ethernet port view)
1.1.5 mac-address (system view)
1.1.6 mac-address mac-learning disable
1.1.7 mac-address max-mac-count
Chapter 1 MAC Address Table Management Configuration Commands
1.1 MAC Address Table Management Configuration Commands
1.1.1 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
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, which 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 port. interface-type interface-number specifies a port 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 Description on the fields of the display mac-address command
Field |
Description |
MAC ADDR |
MAC address |
VLAN ID |
ID of the VLAN to which the MAC address belongs |
STATE |
State of a MAC address, which could be Config static, Config dynamic, Learned and Blackhole |
PORT INDEX |
Port number (Displayed as N/A for a blackhole MAC address) |
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. |
1.1.2 display mac-address aging-time
Syntax
display mac-address aging-time
View
Any view
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.
1.1.3 display mac-address mac-learning
Syntax
display mac-address mac-learning [ interface-type interface-number ]
View
Any view
Parameters
interface-type interface-number: Specifies a port by its type and number. Displays MAC address learning status of the specified port.
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 Ethernet 2/0/3.
<Sysname> display mac-address mac-learning ethernet 2/0/3
Mac address learning status of the switch: enable
PortName Learning Status
Ethernet2/0/3 enable
Table 1-2 Description on the fields of display mac-address mac-learning
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 |
1.1.4 mac-address (Ethernet port view)
Syntax
mac-address { dynamic | static } mac-address vlan vlan-id
undo mac-address { dynamic | static } mac-address vlan vlan-id
View
Ethernet port view
Parameters
dynamic: Dynamic MAC address entries. Aging time is set for these entries.
static: Static MAC address entries. Similar to blackhole MAC address entries, these entries do not age but you can add or remove them.
mac-address: Specifies a MAC address in the format of H-H-H.
vlan vlan-id: Specifies the VLAN to which the Ethernet port 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 Ethernet 2/0/1 which belongs to VLAN 2.
<Sysname> system-view
[Sysname] interface ethernet 2/0/1
[Sysname-Ethernet2/0/1] mac-address static 00e0-fc01-0101 vlan 2
1.1.5 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
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.
vlan vlan-id: Specifies the VLAN to which the Ethernet port 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. Similar to blackhole MAC address entries, these entries do not age but you can add or remove them.
interface interface-type interface-number: Outbound port, with interface-type interface-number representing the port type and number.
Description
Use the mac-address command to add or modify a MAC address entry.
Use the undo mac-address [ { blackhole | dynamic | static } mac-address interface interface-type interface-number vlan vlan-id ] command to remove one or all MAC address entries.
Use the undo mac-address [ blackhole | dynamic | static ] [ mac-address ] vlan vlan-id command to remove a MAC address entry, MAC address entries of a specified type, or all MAC address entries for a VLAN.
Use the undo mac-address [ blackhole | dynamic | static ] interface interface-type interface-number command to remove a MAC address entry, MAC address entries of a specified type, or all MAC address entries for an Ethernet port.
Use the undo mac-address [ blackhole | dynamic | static ] [ mac-address ] interface interface-type interface-number vlan vlan-id command to remove a MAC address entry or all MAC address entries for an Ethernet port.
Note that you can change a dynamic entry to a static or blackhole entry but not vice versa.
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 Ethernet 2/0/1 which belongs to VLAN 2.
<Sysname> system-view
[Sysname] mac-address static 00e0-fc01-0101 interface ethernet 2/0/1 vlan 2
1.1.6 mac-address mac-learning disable
Syntax
mac-address mac-learning disable
undo mac-address mac-learning disable
View
System view, Ethernet port view, port group view
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 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 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.
& Note:
When global 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 Ethernet 2/0/1.
<Sysname> system-view
[Sysname] interface ethernet 2/0/1
[Sysname-Ethernet2/0/1] mac-address mac-learning disable
1.1.7 mac-address max-mac-count
Syntax
mac-address max-mac-count count
undo mac-address max-mac-count
View
Ethernet port view, port group view
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 port is not allowed to learn MAC addresses.
Description
Use the mac-address max-mac-count 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.
Executed in port view, this command takes effect on the current port; executed in port group view, this command takes effect on all ports in the port group.
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 Ethernet 2/0/1 to 600.
<Sysname> system-view
[Sysname] interface ethernet 2/0/1
[Sysname-Ethernet2/0/1] mac-address max-mac-count 600
1.1.8 mac-address timer
Syntax
mac-address timer { aging seconds | no-aging }
undo mac-address timer aging
View
System view
Parameters
aging seconds: Sets an aging timer in seconds for dynamic MAC address entries, in the range 10 to 1000000.
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 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