Chapter 1 MAC
Address Table Management Commands
1.1.1 display mac-address aging-time
Syntax
display mac-address aging-time
View
Any view
Parameter
None
Description
Use the display mac-address aging-time command
to display the aging time of the dynamic entry in the MAC address table.
Related command: mac-address, mac-address
timer, display mac-address.
Example
# Display the aging time for the 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 for the dynamic entries in the MAC address is 300 seconds.
1.1.2 display mac-address
Syntax
display mac-address [ mac-address [ vlan vlan-id ]
| [ blackhole | dynamic | static ] [ interface interface-type
interface-number ] [ vlan vlan-id ] [ count ] ]
View
Any view
Parameter
mac-address:
MAC address whose MAC address table entry is to be displayed. Provide this
argument in the format of H-H-H.
static:
Specifies to display the static entries in the MAC address table.
dynamic:
Specifies to display the dynamic entries in the MAC address table.
blackhole: Specifies
to display the blackhole MAC address entries in the MAC address table.
interface-type
interface-number: Port whose MAC address table entry is to be
displayed. interface-type and interface-number indicate port type
and port number.
vlan-id:
VLAN whose MAC address table entry is to be displayed. This argument
ranges from 1 to 4,094.
count: Specifies
to display the total number of MAC addresses in the MAC address table.
Description
Use the display mac-address command
to display MAC address table information.
Related command: mac-address, mac-address
timer.
Example
# Display the information about a specified
entry in the MAC address table.
<Sysname> display mac-address
00e0-fc01-0101
MAC ADDR VLAN ID STATE PORT
INDEX AGING TIME(s)
00e0-fc01-0101 1 Learned GigabitEthernet1/0/7 NOAGED
Table 1-1
Descriptions on the fields of the display mac-address
command
|
Field
|
Description
|
|
MAC ADDR
|
MAC address
|
|
VLAN ID
|
The ID of the MAC address’ native
VLAN
|
|
STATE
|
MAC address state, which can be:
l
Config static: Static MAC address entry
configured by the user
l
Config dynamic: Dynamic MAC address entry
configured by the user
l
Learned: MAC address entry learned by the
switch
l
Blackhole: Blackhole MAC address entry
|
|
PORT INDEX
|
Port index
|
|
AGING TIME(s)
|
Aging time, which could be:
“AGING”, indicating that the
entry can be aged;
“NOAGED”, indicating that the
entry cannot be aged.
|
1.1.3 mac-address (System view)
Syntax
mac-address {
blackhole | dynamic | static } mac-address
interface interface-type interface-number vlan
vlan-id
undo mac-address [ [ blackhole | dynamic | static ] mac-address
[ interface interface-type interface-number ]
[ vlan vlan-id ] ]
View
System view
Parameter
blackhole: Specifies
a blackhole MAC table entry.
dynamic: Specifies
a dynamic entry in the MAC address table.
static: Specifies
a static entry in the MAC address table.
mac-address:
MAC address, in the format of H-H-H.
interface-type
interface-number: Port to be specified by type and number.
vlan-id:
VLAN ID to be specified, in the range of 1 to 4,094.
Description
Use the mac-address command to add
or modify a MAC address table entry.
Use the undo mac-address command to
delete a MAC address table entry.
Note the following:
l
MAC address entry attribute follows the
following rules: If the existing address is a dynamic address, it can be
modified as a static or blackhole MAC address, if the existing address is a
static or blackhole MAC address, the system will prompt that the entry already
exists and will not be modified.
l
All the addresses on a certain interface can be
deleted. The user can choose to delete dynamic addresses, static addresses, or blackhole
MAC addresses.
l
If you have not saved the configuration, all table
entries will be lost after system resetting. If you have saved the
configuration, after system resetting, static and blackhole MAC address entries
will be kept, while dynamic table entries will be lost.
Related command: display mac-address.
Example
# Configure the port number corresponding
to the MAC address 00e0-fc01-0101 as GigabitEthernet1/0/7 in the address table,
and set this entry as a static entry and set its native VLAN as VLAN 2.
<Sysname> system-view
[Sysname] mac-address static
00e0-fc01-0101 interface gigabitethernet 1/0/7 vlan 2
1.1.4 mac-address (Ethernet port view)
Syntax
mac-address
{ blackhole | dynamic | static } mac-address vlan
vlan-id
undo mac-address
[ { blackhole | dynamic | static } mac-address vlan
vlan-id ]
View
Ethernet port view,
Parameter
blackhole: Specifies
a blackhole table entry.
dynamic: Specifies
a dynamic entry in the MAC address table
static: Specifies
a static entry in the MAC address table
mac-address:
MAC address to be specified, in the format of H-H-H.
vlan-id:
VLAN ID to be specified , in the range of 1 to 4,094.
Description
Use the mac-address command to add
or modify the MAC address table entry on a specified interface.
Use the undo mac-address command to
delete the MAC address table entry.
Note:
l
If the input address already exists in the
address table, the original entry will be modified. That is, replace the VLAN
ID pointed by this address with the new value.
l
All the addresses on a certain interface can be
deleted. The user can choose to delete dynamic addresses or static addresses.
l
If you have not saved the configuration, all
table entries will be lost after system resetting. If you have saved the
configuration, after system resetting, static and blackhole MAC address entries
will be kept, while dynamic table entries will be lost.
Related command: display mac-address.
Example
# Add the MAC address 00e0-fc01-0101 on the
interface GigabitEthernet1/0/1. Set its native VLAN as VLAN 2.
<Sysname> system-view
[Sysname] interface GigabitEthernet 1/0/1
[Sysname-GigabitEthernet1/0/1] mac-address
static 00e0-fc01-0101 vlan 2
Syntax
mac-address max-mac-count count
undo mac-address max-mac-count
View
Ethernet port view / port group view
Parameter
count: Number
of MAC addresses that a port can learn, ranging from 0 to 4096. A value of 0
means that the port is not allowed to learn any MAC address.
Description
Use the mac-address max-mac-count command
to configure the maximum number of MAC addresses that can be learned by a specified
Ethernet port.
Use the undo mac-address max-mac-count command
to remove the limit on the maximum number of MAC addresses that can be learned
by a specified Ethernet port.
By default, the maximum number of MAC
addresses that can be learned by an Ethernet port is not configured.
Use this command to set a limit on the
number of MAC addresses that can be learned by a specified Ethernet interface.
If the maximum number is set to count, then after the number of learned
MAC addresses has reached count, the interface will no longer learn any
more MAC addresses. Use the undo mac-address max-mac-count command to
restore the default maximum number of MAC addresses that can be learned by a specified
Ethernet port.
Related command: mac-address, mac-address
timer.
Example
# Set the maximum number of MAC addresses
that can be learned by the interface GigabitEthernet 1/0/5 to be 600.
<Sysname> system-view
[Sysname] interface GigabitEthernet 1/0/5
[Sysname-GigabitEthernet1/0/5] mac-address
max-mac-count 600
1.1.6 mac-address
timer
Syntax
mac-address timer { aging seconds | no-aging }
undo mac-address timer aging
View
System view
Parameter
aging
seconds: Specifies the aging time (in seconds) of
dynamic MAC address table entries. The seconds argument ranges from 10
to 1,000,000
no-aging:
Specifies that dynamic MAC address table entries are not to be aged.
Description
Use the mac-address timer command to
configure the aging time of the dynamic address table entry.
Use the undo mac-address timer command
to restore the default value.
By default, the aging time for dynamic MAC
address entries is 300 seconds.
Setting the aging time too short will
result in MAC addresses being deleted prematurely and a large number of packets
being broadcast because no MAC addresses can be found. This will degrade the device’s
performance.
If the aging time is set too long, a large
number of outdated MAC addresses will be stored in the MAC address table, preventing
the device from updating MAC address table in a timely manner. In this case,
moving the device from one interface to another will result in delay.
Example
# Configure the aging time for dynamic
address table entries as 500 seconds.
<Sysname> system-view
[Sysname] mac-address timer aging 500