Port Security Commands

Use these commands to configure port security on the switch.

This section describes the command you use to configure Port Security on the switch. Port security, which is also known as port MAC locking, allows you to secure the network by locking allowable MAC addresses on a port. Packets with a matching source MAC address are forwarded normally, and all other packets are discarded.

Note: To enable the SNMP trap specific to port security, see snmp-server enable traps violation.

port-security

M4250

M4350

This command enables port locking on an interface, a range of interfaces, or at the system level.

Default disabled
Format port-security
Mode

Global Config (to enable port locking globally)

Interface Config (to enable port locking on an interface or range of interfaces)

no port-security

This command disables port locking for one (Interface Config) or all (Global Config) ports.

Format no port-security
Mode

Global Config

Interface Config

port-security aging time

M4250

M4350

Use this command to configure the aging time that defines the inactive duration of the dynamically-locked MAC addresses on an interface. The aging time is in minutes; the range is from 0 to 1440; The default is 5 minutes. An aging time of 0 implies that aging is disabled.

Default disabled
Format port-security aging time minutes
Mode Interface Config

no port-security aging time

This command resets the aging time that defines the inactive duration of the dynamically-locked MAC addresses on an interface. The default is 5 minutes.

Format no port-security aging time
Mode Interface Config

port-security max-dynamic

M4250

M4350

This command sets the maximum number of dynamically locked MAC addresses allowed on a specific port. The valid range is 0–4096.

Default 4096
Format port-security max-dynamic maxvalue
Mode Interface Config

no port-security max-dynamic

This command resets the maximum number of dynamically locked MAC addresses allowed on a specific port to its default value.

Format no port-security max-dynamic
Mode Interface Config

port-security max-static

M4250

M4350

This command sets the maximum number of statically locked MAC addresses allowed on a port. The valid range is 0–48.

Default 1
Format port-security max-static maxvalue
Mode Interface Config

no port-security max-static

This command sets the maximum number of statically locked MAC addresses to the default value.

Format no port-security max-static
Mode Interface Config

port-security mac-address

M4250

M4350

This command adds a MAC address to the list of statically locked MAC addresses for an interface or range of interfaces. The vlan-id is the VLAN ID.

Format port-security mac-address mac-address vlan-id
Mode Interface Config

no port-security mac-address

This command removes a MAC address from the list of statically locked MAC addresses.

Format no port-security mac-address mac-address vlan-id
Mode Interface Config

port-security mac-address move

M4250

M4350

This command converts dynamically locked MAC addresses to statically locked addresses for an interface or range of interfaces.

Format port-security mac-address move
Mode Interface Config

port-security mac-address sticky

M4250

M4350

This command enables sticky mode Port MAC Locking on a port. If accompanied by a MAC address and a VLAN id (for interface config mode only), it adds a sticky MAC address to the list of statically locked MAC addresses. These sticky addresses are converted back to dynamically locked addresses if sticky mode is disabled on the port. The vlan-id is the VLAN ID. The Global command applies the sticky mode to all valid interfaces (physical and LAG). There is no global sticky mode as such.

Sticky addresses that are dynamically learned display in the output of the show running-config command as port-security mac-address sticky mac vlan-id entries. This distinguishes them from static entries.

Format port-security mac-address sticky
Mode Global Config
Format port-security mac-address sticky [mac-address vlan-id]
Mode Interface Config

Command example:

CODE
(NETGEAR)(Config)# port-security mac-address sticky
(NETGEAR)(Interface)# port-security mac-address sticky
(NETGEAR)(Interface)# port-security mac-address sticky
  00:00:00:00:00:01 2

no port-security mac-address sticky

Use this command to disable the sticky mode.

Format no port-security mac-address sticky
Mode Global Config
Format no port-security mac-address sticky [mac-address vlan-id]
Mode Interface Config

port-security violation shutdown

M4250

M4350

This command allows an interface to be diagnostically disabled when a violation occurs for port MAC locking.

Format port-security violation shutdown
Mode Interface Config

no port-security violation shutdown

This command prevents an interface from being diagnostically disabled when a violation occurs for port MAC locking.

Format no port-security violation shutdown
Mode Interface Config

mac-address-table limit

M4250

M4350

This command enables VLAN port security. VLAN MAC locking lets you secure the network by locking down allowable MAC addresses on a specific VLAN. Packets with a matching source MAC address can be forwarded normally. All other packets are discarded. VLAN MAC locking locks the dynamic MAC entries.

If both VLAN and port MAC locking are enabled, VLAN MAC locking is given precedence over port MAC locking.

Default Disabled
Format mac-address-table limit [action shutdown] [notification trap] [maximum-num] [vlan vlan-id]
Mode Global Config
Parameter Description
action shutdown After the MAC limit is reached, the action shuts down the ports participating in the VLAN.
notification trap Enables the snmp-server enable traps violation command on the ports participating in the VLAN. After the MAC limit is reached, a log message is generated with the violation MAC address details.
maximum-num The maximum number of MAC addresses.
vlan vlan-id

VLAN on which the MAC limit is applied.

(Packets on all other VLANs are discarded.)

Command example:

CODE
(NETGEAR Switch) (Config)#mac-address-table limit 3 vlan 10

Command example:

CODE
(NETGEAR Switch) (Config)#mac-address-table limit action shutdown notification trap 6
vlan 100

no mac-address-table limit

This command disables VLAN port security on the specified VLAN.

Format no mac-address-table limit [action shutdown] [notification trap] [maximum-num] [vlan vlan-id]
Mode Global Config

show port-security

M4250

M4350

This command displays the port-security settings for the port or ports. If you do not use a parameter, the command displays the Port Security Administrative mode. Use the optional parameters to display the settings on a specific interface or on all interfaces. To specify an actual interface or port, do the following:

  • For an M4250 series switch, use the argument slot/port.
  • For an M4350 series switch, use the argument unit/slot/port, as shown in the command description and format.

Instead of unit/slot/port, lag lag-intf-num can be used as an alternate way to specify the LAG interface, in which lag-intf-num is the LAG port number.

Format show port-security [unit/slot/port | lag lag-intf-num | all]
Mode Privileged EXEC
Term Definition
Admin Mode Port Locking mode for the entire system. This field displays if you do not supply any parameters.

For each interface, or for the interface you specify, the following information displays.

Term Definition
Admin Mode Port Locking mode for the Interface.
Dynamic Limit Maximum dynamically allocated MAC Addresses.
Static Limit Maximum statically allocated MAC Addresses.
Violation Trap Mode Whether violation traps are enabled.
Sticky Mode The administrative mode of the port security Sticky Mode feature on the interface.

Command example:

CODE
(NETGEAR Switch) #show port-security 0/1

        Admin    Dynamic     Static     Violation  Sticky
Intf    Mode      Limit      Limit      Trap Mode  Mode
------  -------  ----------  ---------  ---------  --------
0/1     Disabled    1          1        Disabled   Enabled

show port-security dynamic

M4250

M4350

This command displays the dynamically locked MAC addresses for the port. To specify an actual interface or port, do the following:

  • For an M4250 series switch, use the argument slot/port.
  • For an M4350 series switch, use the argument unit/slot/port, as shown in the command description and format.

Instead of unit/slot/port, lag lag-intf-num can be used as an alternate way to specify the LAG interface, in which lag-intf-num is the LAG port number.

Format show port-security dynamic {unit/slot/port | lag lag-intf-num}
Mode Privileged EXEC
Term Definition
MAC Address MAC Address of dynamically locked MAC.

show port-security static

M4250

M4350

This command displays the statically locked MAC addresses for a port. This command displays the dynamically locked MAC addresses for the port. To specify an actual interface or port, do the following:

  • For an M4250 series switch, use the argument slot/port.
  • For an M4350 series switch, use the argument unit/slot/port, as shown in the command description and format.

Instead of unit/slot/port, lag lag-intf-num can be used as an alternate way to specify the LAG interface, in which lag-intf-num is the LAG port number.

Format show port-security static {unit/slot/port | lag lag-intf-num}
Mode Privileged EXEC
Term Definition
Statically Configured MAC Address The statically configured MAC address.
VLAN ID The ID of the VLAN that includes the host with the specified MAC address.
Sticky Indicates whether the static MAC address entry is added in sticky mode.

Command example:

CODE
(NETGEAR Switch) #show port-security static 1/0/1
Number of static MAC addresses configured: 2
Statically configured MAC Address    VLAN ID    Sticky
 ---------------------------------    -------    ------
 00:00:00:00:00:01                    2            Yes
 00:00:00:00:00:02                    2            No

show port-security violation

M4250

M4350

This command displays the source MAC address of the last packet discarded on a locked port. To specify an actual interface or port, do the following:

  • For an M4250 series switch, use the argument slot/port.
  • For an M4350 series switch, use the argument unit/slot/port, as shown in the command description and format.

Instead of unit/slot/port, lag lag-intf-num can be used as an alternate way to specify the LAG interface, in which lag-intf-num is the LAG port number.

Format show port-security violation {unit/slot/port | lag lag-intf-num}
Mode Privileged EXEC
Term Definition
MAC Address The source MAC address of the last frame that was discarded at a locked port.
VLAN ID The VLAN ID, if applicable, associated with the MAC address of the last frame that was discarded at a locked port.