When configuring MAC address table
management, go to these sections for information you are interested in:
l
Introduction
to MAC Address Table
l
Configuring
MAC Address Table Management
l
Displaying
and Maintaining MAC Address Table Management
l
MAC
Address Table Management Configuration Example
This manual covers
only static, dynamic and blackhole MAC address table management. For the
management of multicast MAC address table management, refer to Multicast
Protocol Configuration.
1.1 Introduction to MAC Address Table
A switch maintains a MAC address table for
frame forwarding. Each entry in this table contains the MAC address of a
connected device, to which port this device is connected and to which VLAN the
port belongs.
A MAC address table consists of two types
of entries: static and dynamic. Static 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 a switch 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), and consider frames with destination MAC address
MAC-SOURCE be forwarded through port A.
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 containing
the MAC address and port A.
When receiving a frame destined for MAC A,
the switch then looks up the MAC address table and forwards it from port A.
Dynamically learned MAC addresses cannot overwrite static MAC
address entries, but the latter can overwrite the former.
As shown in Figure 1-1, when forwarding a frame, the
switch looks up the MAC address table. If an entry is available for the
destination MAC address, the switch forwards the frame directly from the
hardware. If not, it does the following:
1)
Broadcast the frame.
2)
After the frame reaches the destination, the
destination sends back a response with its MAC address. (If no response is
received, the frame will be dropped.)
3)
Upon receipt of the response, the device adds an
entry in the MAC address table, indicating from which port the frames destined
for the MAC address should be sent.
4)
Forward subsequent frames destined for the same
MAC address directly from the hardware.
5)
If the frame cannot reach the destination
device, the switch is still unable to learn the MAC address table entries of
the destination device and therefore broadcasts the frames destined to this
device afterwards.

Figure 1-1 Forward frames using the MAC
address table
1.2 Configuring MAC Address Table Management
This section covers these topics:
l
Configuring
MAC Address Entries
l
Configuring
MAC Address Aging Timer
l
Configuring
the Maximum Number of MAC Addresses an Ethernet Port or a Port Group Can Learn
1.2.1 Configuring MAC Address Entries
Follow these steps to add, modify, or
remove entries in the MAC address table:
|
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
|
|
Enter Ethernet port view
|
interface interface-type interface-number
|
—
|
|
Add/modify MAC address entries in the
specified port view
|
mac-address
{ dynamic | static } mac-address vlan
vlan-id
|
Required
|
Do not configure a
static or dynamic MAC address entry on an aggregation port.
1.2.2 Configuring MAC Address Aging Timer
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 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.
1.2.3 Configuring the Maximum Number of MAC Addresses an Ethernet Port or
a Port Group Can Learn
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. One approach is to do this on a
per-port or port group basis.
Follow these steps to configure the maximum
number of MAC addresses that an Ethernet port or port group can learn:
|
To do…
|
Use the command…
|
Remarks
|
|
Enter system view
|
system-view
|
—
|
|
Enter Ethernet port or port group view
|
Enter Ethernet port view
|
interface interface-type interface-number
|
Required
Use either command to configure on a port
or ports in a group.
|
|
Enter port group view
|
port-group { aggregation agg-id | manual port-group-name
}
|
|
Configure the maximum number of MAC addresses
that can be learned on an Ethernet port or port group.
|
mac-address max-mac-count count
|
Required
The maximum number of MAC addresses that
can be learned on a port or port group is not configured by default.
|
1.3 Displaying and Maintaining MAC Address Table Management
|
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
|
1.4 MAC Address Table Management
Configuration Example
I. Network requirements
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
GigabitEthernet 1/0/1 in VLAN 1.
II. Configuration procedure
# Add a static MAC address entry.
<Sysname> system-view
[Sysname] mac-address static
000f-e235-dc71 interface GigabitEthernet 1/0/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
GigabitEthernet 1/0/1.
[Sysname] display mac-address
interface GigabitEthernet 1/0/1
MAC ADDR VLAN ID
STATE PORT INDEX AGING TIME(s)
000f-e235-dc71 1 Config
static GigabitEthernet 1/0/1 NOAGED
--- 1 mac address(es) found
---