Configuring Layer 2 Switching

Information About Layer 2 Switching

You can configure Layer 2 switching ports as access or trunk ports. Trunks carry the traffic of multiple VLANs over a single link and allow you to extend VLANs across an entire network. All Layer 2 switching ports maintain MAC address tables.


Note

See Cisco Nexus 3550-T Interfaces Configuration Guide, for information on creating interfaces.


Switching Frames Between Segments

Each LAN port on a device can connect to a single workstation, server, or to another device through which workstations or servers connect to the network.

To reduce signal degradation, the device considers each LAN port to be an individual segment. When stations connected to different LAN ports need to communicate, the device forwards frames from one LAN port to the other at wire speed to ensure that each session receives full bandwidth.

To switch frames between LAN ports efficiently, the device maintains an address table. When a frame enters the device, it associates the media access control (MAC) address of the sending network device with the LAN port on which it was received.

Building the Address Table and Address Table Changes

The device dynamically builds the address table by using the MAC source address of the frames received. When the device receives a frame for a MAC destination address not listed in its address table, it floods the frame to all LAN ports of the same VLAN except the port that received the frame. When the destination station replies, the device adds its relevant MAC source address and port ID to the address table. The device then forwards subsequent frames to a single LAN port without flooding all LAN ports.

You can configure MAC addresses, which are called static MAC addresses, to statically point to specified interfaces on the device. These static MAC addresses override any dynamically learned MAC addresses on those interfaces. You cannot configure broadcast addresses as static MAC addresses. The static MAC entries are retained across a reboot of the device.

The address table can store a number of MAC address entries depending on the hardware I/O module. The device uses an aging mechanism, defined by a configurable aging timer, so if an address remains inactive for a specified number of seconds, it is removed from the address table.

Layer 3 Static MAC Addresses

You can configure a static MAC address for the following Layer 3 interfaces:

  • Layer 3 interfaces

  • Layer 3 port channels

  • VLAN network interface


Note

When you configure static MAC on SVI interface, ensure that the first 42 bits match the Virtual Device Context (VDC) MAC.


See the Cisco Nexus Series NX-OS Interfaces Configuration Guide, for information on configuring Layer 3 interfaces.

Prerequisites for Configuring MAC Addresses

MAC addresses have the following prerequisites:

  • You must be logged onto the device.

  • If necessary, install the Advanced Services license.

Default Settings for Layer 2 Switching

This table lists the default setting for Layer 2 switching parameters.

Table 1. Default Layer 2 Switching Parameters

Parameters

Default

Aging time

1800 seconds

Configuring Layer 2 Switching by Steps


Note

If you are familiar with the Cisco IOS CLI, be aware that the Cisco NX-OS commands for this feature might differ from the Cisco IOS commands that you would use.


Configuring a Static MAC Address

You can configure MAC addresses, which are called static MAC addresses, to statically point to specified interfaces on the device. These static MAC addresses override any dynamically learned MAC addresses on those interfaces. You cannot configure broadcast or multicast addresses as static MAC addresses.

Procedure

  Command or Action Purpose
Step 1

config t

Example:

switch# config t
switch(config)#

Enters configuration mode.

Step 2

mac address-table static mac-address vlan vlan-id {[ interface {type slot/port} | port-channel number]}

Example:

switch(config)# mac address-table static 1.1.1 vlan 2 interface ethernet 1/2

Specifies a static MAC address to add to the Layer 2 MAC address table.

Step 3

exit

Example:

switch(config)# exit
switch#

Exits the configuration mode.

Step 4

(Optional) show mac address-table static

Example:

switch# show mac address-table static
(Optional)

Displays the static MAC addresses.

Step 5

(Optional) copy running-config startup-config

Example:

switch# copy running-config startup-config
(Optional)

Copies the running configuration to the startup configuration.

Example

This example shows how to put a static entry in the Layer 2 MAC address table:

switch# config t
switch(config)# mac address-table static 1.1.1 vlan 2 interface ethernet 1/2
switch(config)#

Configuring a Static MAC Address on a Layer 3 Interface

You can configure static MAC addresses on Layer 3 interfaces. You cannot configure broadcast or multicast addresses as static MAC addresses.

See Cisco Nexus 3550-T Series NX-OS Interfaces Configuration Guide, for information on configuring Layer 3 interfaces.

Procedure

  Command or Action Purpose
Step 1

config t

Example:

switch# config t
switch(config)#

Enters configuration mode.

Step 2

interface [ethernet slot/port | ethernet slot/port.number | port-channel number | vlan vlan-id]

Example:

switch(config)# interface ethernet 1/3

Specifies the Layer 3 interface and enters the interface configuration mode.

Note 

You must create the Layer 3 interface before you can assign the static MAC address.

Step 3

mac-address mac-address

Example:

switch(config-if)# mac-address 22ab.47dd.ff89
switch(config-if)#

Specified a static MAC address to add to the Layer 3 interface.

Step 4

exit

Example:

switch(config-if)# exit
switch(config)#

Exits the interface mode.

Step 5

(Optional) show interface [ethernet slot/port | ethernet slot/port.number | port-channel number | vlan vlan-id]

Example:

switch# show interface ethernet 1/3
(Optional)

Displays information about the Layer 3 interface.

Step 6

(Optional) copy running-config startup-config

Example:

switch# copy running-config startup-config
(Optional)

Copies the running configuration to the startup configuration.

Example

This example shows how to configure the Layer 3 interface on slot 1, port 3 with a static MAC address:

switch# config t
switch(config)# interface ethernet 1/3
switch(config-if)# mac-address 22ab.47dd.ff89
switch(config-if)# 

This example shows how to configure the SVI MAC address:


switch(config-if)# show vdc
vdc_id  vdc_name    state        mac                 type        lc
------  --------     -----       ----------          ---------   ------
1       triton5     active       64:3f:5f:84:37:9a   Ethernet    None

switch(config-if)# interface vlan 10
switch(config-if)# mac-address 64:3f:5f:84:37:93

Configuring the Aging Time for the MAC Table

You can configure the amount of time that a MAC address entry (the packet source MAC address and port on which that packet was learned) remains in the MAC table, which contains the Layer 2 information.


Note

MAC addresses are aged out up to two times the configured MAC address table aging timeout.



Note

You can also configure the MAC aging time in interface configuration mode or VLAN configuration mode.


Procedure

  Command or Action Purpose
Step 1

config t

Example:

switch# config t
switch(config)#

Enters configuration mode.

Step 2

mac address-table aging-time seconds

Example:

switch(config)# mac address-table aging-time 600

Specifies the time before an entry ages out and is discarded from the Layer 2 MAC address table. The range is from 120 to 918000; the default is 1800 seconds. Entering the value 0 disables the MAC aging.

Step 3

exit

Example:

switch(config)# exit
switch#

Exits the configuration mode.

Step 4

(Optional) show mac address-table aging-time

Example:

switch# show mac address-table aging-time
(Optional)

Displays the aging time configuration for MAC address retention.

Step 5

(Optional) copy running-config startup-config

Example:

switch# copy running-config startup-config
(Optional)

Copies the running configuration to the startup configuration.

Example

This example shows how to set the ageout time for entries in the Layer 2 MAC address table to 600 seconds (10 minutes):

switch# config t 
switch(config)# mac address-table aging-time 600
switch(config)#

Clearing Dynamic Addresses from the MAC Table

You can clear all dynamic Layer 2 entries in the MAC address table. (You can also clear entries by designated interface or VLAN.)

Procedure

  Command or Action Purpose
Step 1

clear mac address-table dynamic {address mac_addr} {interface [ethernet slot/port | port-channel channel-number]} {vlan vlan_id}

Example:


switch# clear mac address-table dynamic

Clears the dynamic address entries from the MAC address table in Layer 2.

Step 2

(Optional) show mac address-table

Example:

switch# show mac address-table
(Optional)

Displays the MAC address table.

Example

This example shows how to clear the dynamic entries in the Layer 2 MAC address table:

switch# clear mac address-table dynamic
switch# 

Verifying the Layer 2 Switching Configuration

To display Layer 2 switching configuration information, perform one of the following tasks:

Command

Purpose

show mac address-table

Displays information about the MAC address table.

show mac address-table aging-time

Displays information about the aging time set for the MAC address entries.

show mac address-table static

Displays information about the static entries on the MAC address table.

show interface [interface] mac-address

Displays the MAC addresses and the burn-in MAC address for the interfaces.

Configuration Example for Layer 2 Switching

The following example shows how to add a static MAC address and how to modify the default global aging time for MAC addresses:

switch# configure terminal
switch(config)# mac address-table static 0000.0000.1234 vlan 10 interface ethernet 1/15
switch(config)# mac address-table aging-time 120

Additional References for Layer 2 Switching -- CLI Version

Related Documents

Related Topic

Document Title

Static MAC addresses

Cisco Nexus® 3550-T Security Configuration Guide

Interfaces

Cisco Nexus® 3550-T Interfaces Configuration Guide

System management

Cisco Nexus® 3550-T System Management Configuration Guide

Licensing

Cisco Nexus 3550-T NX-OS Smart Licensing Using Policy User Guide

Release Notes

Cisco Standalone Series NX-OS Release Notes