Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All

    Configuring MAC Limiting (CLI Procedure)

    MAC limiting restricts the MAC addresses that can be learned and added to the MAC address forwarding table. You can impose a limit on either a single Layer 2 access interface, on all the Layer 2 access interfaces on the switch, or on a specific VLAN. There are two ways you can limit the MAC addresses added to the MAC address forwarding table:

    • Limit the number of MAC addresses added to the table—Configure the maximum number of dynamic MAC addresses that can be added to the MAC address forwarding table. This limit can be set either for the entire switch, for one interface, or for one VLAN. When this limit is exceeded, incoming packets with new MAC addresses are either dropped, logged, ignored, or the interface is shut down. Note that only learned MAC addresses, not static MAC addresses, count toward the limit you specify for dynamic MAC addresses.
    • Allow only named MAC addresses to be added to the table—Configure specific “allowed” MAC addresses for an access interface. Any MAC address that is not in the list of configured addresses is not learned and the switch logs a corresponding message. Using this allowed MAC option binds MAC addresses to a VLAN so that the address is not registered outside the VLAN. If an allowed MAC setting conflicts with a dynamic MAC setting, the allowed MAC setting takes precedence.

    Note: If you do not want the switch to log messages received for invalid MAC addresses, disable that logging using the command no-allowed-mac-log .

    When the configured limit of MAC addresses is exceeded, any one of the following actions can be performed :

    • drop—Drop the packet and generate an alarm, an SNMP trap, or a system log entry. This is the default.
    • log—Do not drop the packet but generate an alarm, an SNMP trap, or a system log entry.
    • none—Take no action.
    • shutdown—Disable the interface or VLAN and generate an alarm. If you have configured the switch with the port-error-disable statement, the disabled interface (or VLAN) recovers automatically upon expiration of the specified disable timeout. If you have not configured the switch for autorecovery from port error disabled conditions, you can bring up the disabled interfaces or VLAN using the command clear ethernet-switching port-error .

    To configure MAC limiting, using the CLI:

    1. Limit the number of dynamic MAC addresses to5.

      Because no action is specified, the switch performs the default action drop if the limit is exceeded:

      • Limit a single interface (here, the interface is ge-0/0/1):
        [edit ethernet-switching-options secure-access-port]
        user@switch# set interface ge–0/0/1 mac-limit (Access Port Security) 5
      • Limit all interfaces:
        [edit ethernet-switching-options secure-access-port]
        user@switch# set interface all mac–limit 5
      • Limit a specific VLAN:
        [edit vlans]
        user@switch# set vlan-abc mac–limit 20

      Note: Do not set the mac-limit to 1. The first learned MAC address is often inserted into the forwarding database automatically (for instance, for Routed VLAN Interfaces the first MAC address inserted into the forwarding database is the MAC address of the RVI. For Aggregated Ethernet bundles using LACP, the first MAC address inserted into the forwarding database in the forwarding table is the source address of the protocol packet). The switch will therefore not learn MAC addresses other than the automatic addresses when the mac-limit is set to 1, and this will cause problems with MAC learning and forwarding.

      Note: You must clear existing entries in the MAC address forwarding table that correspond to the change you make with the command mac-limit. For example, if you change the limit on an interface, clear the MAC address forwarding table entries for that interface. If you change the limit on all interfaces and VLANs, clear all MAC address forwarding table entries. If you change the limit on a VLAN, clear the MAC address forwarding table entries for that VLAN. This action is performed in the next step.

    2. Clear the current MAC address forwarding table entries for the MAC limited entity, either the interface, all entries, or a VLAN :
      • Clear MAC address entries from a specific interface (here, the interface is ge-0/0/1) in the forwarding table:
        user@switch# clear ethernet-switching-table interface ge-0/0/1
      • Clear all MAC address entries in the forwarding table:
        user@switch# clear ethernet-switching-table
      • Clear MAC address entries from a specific VLAN (here, the VLAN is vlan-abc) in the forwarding table:
        user@switch1# clear ethernet-switching-table vlan vlan-abc
    3. Specify specific allowed MAC addresses:
      • On a single interface (here, the interface is ge-0/0/2):
        [edit ethernet-switching-options secure-access-port]
        user@switch# set interface ge–0/0/2 allowed-mac 00:05:85:3A:82:80
        user@switch# set interface ge–0/0/2 allowed-mac 00:05:85:3A:82:81
        user@switch# set interface ge–0/0/2 allowed-mac 00:05:85:3A:82:83
      • On all interfaces:
        [edit ethernet-switching-options secure-access-port]
        user@switch# set interface all allowed-mac 00:05:85:3A:82:80
        user@switch# set interface all allowed-mac 00:05:85:3A:82:81
        user@switch# set interface all allowed-mac 00:05:85:3A:82:83

    Published: 2012-06-19