MAC address management properties include: MAC address aging time, and the MAC address learning capability of ports.
Each dynamic MAC address entry has aging time. If no packet whose source MAC address matches a MAC address entry is received by the specified VLAN, the device deletes the MAC address entry. If the specified VLAN receives a packet whose source MAC address matches a MAC address entry, the device resets the aging time of the MAC address entry.
Static MAC addresses can only be configured and deleted by users, so static MAC addresses cannot age.
If devices in the network have idle ports and the ports do not allow free use, then the MAC address learning capability can be disabled on the port. Then, the packets received by the port will all be discarded. In this way, these ports cannot access the network, and hence the security of the network is improved.
Configuration Condition
None
Configure the MAC Address Aging Time
The dynamic MAC address aging time set in a device takes effect globally. The value range of the MAC address aging time is:
- 0: MAC addresses do not age, that is, the learned dynamic MAC addresses do not age.
- 60-1000000: Aging time of dynamic MAC addresses. Unit: second. Default: 300.
If the aging time is configured too long, the MAC address table in the device may contain a large number of MAC address entries that are no long in use. In this way, the large number of invalid entries may use up MAC address resources, and new valid MAC address entries fail to be added to the device. If the aging time is configured too short, the device may frequently delete valid MAC address entries, affecting the device forwarding performance. Therefore, you need to configure a reasonable value for the aging time according to the actual environment.
Table 8-2 Configuring the MAC Address Aging Time
Step
|
Command
|
Description
|
Enter the global configuration mode.
|
configure terminal
|
-
|
Configure the MAC address aging time.
|
mac-address aging-time aging-time-value
|
Mandatory.
By default, the MAC address aging time is set to 300 seconds.
|
Configure the MAC Address Learning Capability
MAC address learning capability can be enabled and disabled only for dynamic MAC address learning. By default, the MAC address learning capability is enabled on a port. Then the port learns MAC address entries and forwards corresponding packets. If the MAC address learning capability is enabled on a port, the port does not learn dynamic MAC addresses, and the received packets are discarded.
Table 8-3 Configuring the MAC Address Learning Capability
Step
|
Command
|
Description
|
Enter the global configuration mode.
|
configure terminal
|
-
|
Enter the L2 Ethernet interface configuration mode.
|
interface interface-name
|
Either
After entering the L2 Ethernet interface configuration mode, the subsequent configuration takes effect only on the current port. After entering the aggregation group configuration mode, the subsequent configuration takes effect only on the aggregation group.
|
Enter the aggregation group configuration mode.
|
interface link-aggregation link-aggregation-id
|
Enable the MAC address learning capability on a port or aggregation group.
|
mac-address learning
|
Mandatory.
By default, the MAC address learning capability is enabled on a port.
|
Configure the MAC Address Learning Function
Enable/disable the MAC address learning function is valid for learning the dynamic MAC address and forwarding the packet. By default, the MAC address learning function is enabled on the port, and the port can learn the MAC address entry, and forward the packet. If the MAC address learning function is disabled on the port, the port does not learn the dynamic MAC address any more, but still can forward the packet.
Table 8-4 Configuring MAC address learning function
Step
|
Command
|
Description
|
Enter the global configuration mode.
|
config terminal
|
-
|
Enter the L2 Ethernet interface configuration mode.
|
interface interface-name
|
Either
After entering the L2 Ethernet interface configuration mode, the subsequent configuration takes effect only on the current port. After entering the aggregation group configuration mode, the subsequent configuration takes effect only on the aggregation group.
|
Enter the aggregation group configuration mode. |
interface link-aggregation link-aggregation-id
|
Enable the learning function of the port or aggregation group MAC address |
mac-address learning action forward |
Mandatory
By default, enable the MAC address learning function on the port. |