04-MAC Address Table Configuration
Chapters Download (70.54 KB)
Table of Contents
1 MAC Address Table Management Configuration
Configuring MAC Address Table Management
Configuring MAC Address Table Entries
Disabling Global MAC Address Learning
Disabling MAC Address Learning on Port
Configuring MAC Address Aging Timer
Configuring the MAC Learning Limit
Displaying and Maintaining MAC Address Table Management
MAC Address Table Management Configuration Example
When configuring MAC address table management, go to these sections for information you are interested in:
l Overview
l Configuring MAC Address Table Management
l Displaying and Maintaining MAC Address Table Management
l MAC Address Table Management Configuration Example
A device maintains a MAC address table for frame forwarding. Each entry in this table indicates the MAC address of a connected device, to which interface this device is connected and to which VLAN the interface belongs.
A MAC address table consists of three types of entries: static, dynamic and blackhole. Static and blackhole entries are manually configured and never age out. Dynamic entries can be manually configured or dynamically learned and may age out.
The following is how your device learns a MAC address after it receives a frame from a port, Port A for example:
1) Check the frame for the source MAC address (MAC-SOURCE for example).
2) Look up the MAC address table for an entry corresponding to the MAC address and do the following:
l If an entry is found for the MAC address, update the entry.
l If no entry is found, add an entry for the MAC address and indicate from which port the frame is received.
When receiving a frame destined for MAC-SOURCE, the device then looks up the MAC address table and forwards it from Port A.
Dynamically-learned MAC addresses cannot overwrite static or blackhole MAC address entries, but the latter can overwrite the former.
When forwarding a frame, the device adopts the following two forwarding modes based on the MAC address table:
l Unicast mode: If an entry is available for the destination MAC address, the device forwards the frame out the outgoing interface indicated by the MAC address table entry.
l Broadcast mode: If the device receives a frame with the destination address being all ones, or no entry is available for the destination MAC address, the device broadcasts the frame to all the interfaces except the receiving interface.
Figure 1-1 Forward frames using the MAC address table
The MAC address table management configuration tasks include:
l Configuring MAC Address Table Entries
l Disabling Global MAC Address Learning
l Disabling MAC Address Learning on Port
l Configuring MAC Address Aging Timer
l Configuring the MAC Learning Limit
Follow these steps to add, modify, or remove entries in the MAC address table globally:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Add/modify a MAC address entry |
mac-address blackhole mac-address vlan vlan-id |
Required |
mac-address { dynamic | static } mac-address interface interface-type interface-number vlan vlan-id |
Follow these steps to add, modify, or remove entries in the MAC address table on an interface:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter interface view |
interface interface-type interface-number |
— |
Add/modify MAC address entries under the specified interface view |
mac-address { dynamic | static } mac-address vlan vlan-id |
Required |
When you configuring MAC address table , the ONU port only support the static entries to add/modify MAC address.
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.
Disabling global MAC address learning disables the learning function on all ports.
Follow these steps to disable MAC address learning:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Disable global MAC address learning |
mac-address mac-learning disable |
Required Enabled by default |
When global MAC address learning is disabled, the learned MAC addresses remain valid until they age out.
After enabling global MAC address learning, you may disable the function on a single port, or on all ports in a port group as needed.
Follow these steps to disable MAC address learning on a port or port group:
To do… |
Use the command… |
Remarks |
||
Enter system view |
system-view |
— |
||
Enable global MAC address learning |
undo mac-address mac-learning disable |
Optional Enabled by default. |
||
Enter Ethernet interface view or port group view |
Enter Ethernet interface view |
interface interface-type interface-number |
Required Use any of the three commands. Configurations made in Ethernet interface view or Layer-2 aggregate interface view take effect on the current interface only; configurations made in port group view take effect on all the member ports in the port group. |
|
Enter port group view |
port-group manual port-group-name |
|||
Enter Layer-2 aggregate interface view |
interface bridge-aggregation interface-number |
|||
Disable MAC address learning on an Ethernet port or port group |
mac-address mac-learning disable |
Required Enabled by default |
||
l When global MAC address learning is disabled, the learned MAC addresses remain valid until they age out.
l For configuration about port groups, refer to Ethernet Interface Configuration in the Access Volume.
The MAC address table on your device is available with an aging mechanism for dynamic entries to prevent its resources from being exhausted. 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.
Follow these steps to configure the MAC address aging timer:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Configure the aging timer for dynamic MAC address entries |
mac-address timer { aging seconds | no-aging } |
Optional 300 seconds by default. |
The MAC address aging timer takes effect globally on dynamic MAC address entries (learned or administratively configured) only.
To prevent a MAC address table from getting so large that it may degrade forwarding performance, you may restrict the number of MAC addresses that can be learned on a per-port or port group basis.
Follow these steps to configure the maximum number of MAC addresses that an Ethernet port, a Layer-2 aggregate interface, or a port group can learn:
To do… |
Use the command… |
Remarks |
|
Enter system view |
system-view |
— |
|
Enter Ethernet interface view, port group view, or ONU port view |
Enter Ethernet interface view |
interface interface-type interface-number |
Required Use any of these three commands. The configuration you make in Ethernet interface view or ONU port view takes effect on the current interface only; the configuration you make in port group view takes effect on all the member ports in the port group. |
Enter port group view |
port-group manual port-group-name |
||
Enter ONU port view |
interface ONU interface-number |
||
Configure the maximum number of MAC addresses that can be learned on an Ethernet port, ONU port or port group |
mac-address max-mac-count count |
Required The default maximum number of MAC addresses that can be learned is not configured. |
To do… |
Use the command… |
Remarks |
Display MAC address table information |
display mac-address blackhole [ vlan vlan-id ] [ count ] |
Available in any view |
display mac-address [ mac-address [ vlan vlan-id ] | [ dynamic | static ] [ interface interface-type interface-number ] [ vlan vlan-id ] [ count ] ] |
||
Display the aging timer for dynamic MAC address entries |
display mac-address aging-time |
|
Display MAC address statistics |
display mac-address statistics |
Log onto your device from the Console port to configure MAC address table management as follows:
l Set the aging timer to 500 seconds for dynamic MAC address entries.
l Add a static entry 000f-e235-dc71 for port GigabitEthernet1/1/1 in VLAN 1.
# Add a static MAC address entry.
<Sysname> system-view
[Sysname] mac-address static 000f-e235-dc71 interface gigabitethernet 1/1/1 vlan 1
# Set the aging timer for dynamic MAC address entries to 500 seconds.
[Sysname] mac-address timer aging 500
# Display the MAC address entry for port GigabitEthernet1/1/1.
[Sysname] display mac-address interface gigabitethernet 1/1/1
MAC ADDR VLAN ID STATE PORT INDEX AGING TIME(s)
000f-e235-dc71 1 Config static GigabitEthernet1/1/1 NOAGED
--- 1 mac address(es) found ---