Managing the MAC Address Table 251
Perform the following configuration in system view.
Disabling or Enabling Global MAC Address Learning
With the address learning function, an Ethernet switch can learn new MAC
addresses. When it receives a packet destined for a MAC address it has already
learned, the switch forwards the packet directly, instead of flooding all ports.
Sometimes, for the sake of security, it is necessary to disable the address learning
function. A common threat is from hackers who attack the switch with packets
from different source MAC addresses, thereby exhausting the address table
resources and making it impossible for the switch to update the MAC address
table to reflect network changes. Such an attack can be avoided by disabling the
MAC address learning function.
You can use the following commands to disable or enable the MAC address
learning globally.
Perform the following configuration in system view.
By default, the MAC address learning function is enabled.
Disabling or Enabling MAC Address Learning on a Port
After the MAC address learning has been enabled globally, you can disable it on
individual ports.
Use the following commands to disable the MAC address learning on a specified
port.
Perform the following configurations in the Ethernet port view.
Tabl e 271 Setting MAC Address Table Entries
Operation Command
Add or modify an address entry mac-address { static | dynamic }
hw-addr interface {
interface-name | interface-type
interface-num }
Delete an address entry undo mac-address [ { static |
dynamic } mac-address interface {
interface-name | interface-type
interface-num } vlan-id ]
Tabl e 272 Disabling or Enabling the MAC Address Learning
Operation Command
Disable the MAC address learning mac-address mac-learning disable
Enable the MAC address learning undo mac-address mac-learning
disable
Tabl e 273 Disable/Enable the MAC Address Learning
Operation Command
Disable the MAC address learning mac-address mac-learning disable
Enable the MAC address learning undo mac-address mac-learning
disable