3.21.2 MAC Table and VLAN Learning

Each port can do learning in Auto mode (done automatically as soon as the frame with an unknown MAC is received) or Secured mode (only static MAC entries are learned, and all other frames are dropped). MAC learning can also be disabled, and no learning is done. Specific VLANs can also be learning-disabled.

Command Syntax:

mac address-table learning [ secure ]
mac address-table learning vlan <vlan_list>
Table 3-90. Command Description

Argument

Description

Parameter

[ secure ]

Port Secure mode

Default

All ports are in Auto Learning mode

Mode

Port List Interface mode (for specific port) and Global Configuration mode (for VLANs)

Usage

Set MAC address table learning mode to Secure or back to Auto (command without [ secure ] argument). To disable learning, use the ‘no’ version of the command.

Example

Example 1:

Set MAC address learning to Secure on port 1.

(config)# interface GigabitEthernet 1/1
(config-if)#mac address-table learning secure

Example 2:

Disable MAC address learning on ports 2–4.

(config)# interface GigabitEthernet 1/2-4
(config-if)#no mac address-table learning

Example 3:

Add VLAN2 to the list of learning disabled VLANs.

(config)# no mac address-table learning vlan 2