Configuring Layer 2 Ethernet Interfaces


This chapter describes how to use the command-line interface (CLI) to configure Fast Ethernet and Gigabit Ethernet interfaces for Layer 2 switching on Catalyst 4500 series switches. It also provides guidelines, procedures, and configuration examples. The configuration tasks in this chapter apply to Fast Ethernet and Gigabit Ethernet interfaces on any module, including the uplink ports on the supervisor engine.

This chapter includes the following major sections:

Overview of Layer 2 Ethernet Switching

Default Layer 2 Ethernet Interface Configuration

Layer 2 Interface Configuration Guidelines and Restrictions

Configuring Ethernet Interfaces for Layer 2 Switching


Note To configure Layer 3 interfaces, see Chapter 26 "Configuring Layer 3 Interfaces."



Note For complete syntax and usage information for the switch commands used in this chapter, refer to the Catalyst 4500 Series Switch Cisco IOS Command Reference and related publications at this location:

http://www.cisco.com/en/US/products/ps6350/index.html


Overview of Layer 2 Ethernet Switching

The following sections describe how Layer 2 Ethernet switching works on Catalyst 4500 series switches:

Understanding Layer 2 Ethernet Switching

Understanding VLAN Trunks

Layer 2 Interface Modes

Understanding Layer 2 Ethernet Switching

Catalyst 4500 series switches support simultaneous, parallel connections between Layer 2 Ethernet segments. Switched connections between Ethernet segments last only for the duration of the packet. New connections can be made between different segments for successive packets.


Note With release 12.1(13)EW, the Catalyst 4500 series switches can handle packets of 1600 bytes, rather than treat them as "oversized" and discard them. This size is larger than the usual IEEE Ethernet Maximum Transmission Unit (MTU) (1518 bytes) and 802.1q MTU (1522 bytes). The ability to handle larger packets is required to support two nested 802.1q headers and Multiprotocol Label Switching (MPLS) on a network.


The Catalyst 4500 series solves congestion problems caused by high-bandwidth devices and a large number of users by assigning each device (for example, a server) to its own 10-, 100-, or 1000-Mbps segment. Because each Ethernet interface on the switch represents a separate Ethernet segment, servers in a properly configured switched environment achieve full access to the bandwidth.

Because collisions are a major bottleneck in Ethernet networks, an effective solution is full-duplex communication. Normally, Ethernet operates in half-duplex mode, which means that stations can either receive or transmit. In full-duplex mode, two devices can transmit and receive at the same time. When packets can flow in both directions simultaneously, effective Ethernet bandwidth doubles to 20 Mbps for 10-Mbps interfaces and to 200 Mbps for Fast Ethernet interfaces. Gigabit Ethernet interfaces on the Catalyst 4500 series switch are full-duplex mode only, providing 2-Gbps effective bandwidth.

Switching Frames Between Segments

Each Ethernet interface on a Catalyst 4500 series switch can connect to a single workstation or server, or to a hub through which workstations or servers connect to the network.

On a typical Ethernet hub, all ports connect to a common backplane within the hub, and the bandwidth of the network is shared by all devices attached to the hub. If two devices establish a session that uses a significant level of bandwidth, the network performance of all other stations attached to the hub is degraded.

To reduce degradation, the switch treats each interface as an individual segment. When stations on different interfaces need to communicate, the switch forwards frames from one interface to the other at wire speed to ensure that each session receives full bandwidth.

To switch frames between interfaces efficiently, the switch maintains an address table. When a frame enters the switch, it associates the MAC address of the sending station with the interface on which it was received.

Building the MAC Address Table

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

The address table can store at least 32,000 address entries without flooding any entries. The switch 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.

Understanding VLAN Trunks

A trunk is a point-to-point link between one or more Ethernet switch interfaces and another networking device such as a router or a switch. Trunks carry the traffic of multiple VLANs over a single link and allow you to extend VLANs across an entire network.

Two trunking encapsulations are available on all Ethernet interfaces:

Inter-Switch Link (ISL) Protocol—ISL is a Cisco-proprietary trunking encapsulation.


Note Supervisor Engine 6-E does not support ISL trunking. so the switchport trunk encapsulute command is not supported.



Note The blocking Gigabit ports on the WS-X4418-GB and WS-X4412-2GB-T modules do not support ISL. Ports 3 to 18 are blocking Gigabit ports on the WS-X4418-GB module. Ports 1to 12 are blocking Gigabit ports on the WS-X4412-2GB-T module.


802.1Q—802.1Q is an industry-standard trunking encapsulation.

You can configure a trunk on a single Ethernet interface or on an EtherChannel bundle. For more information about EtherChannel, see Chapter 19 "Configuring EtherChannel."

Ethernet trunk interfaces support different trunking modes (see Table 15-2). You can specify whether the trunk uses ISL encapsulation, 802.1Q encapsulation, or if the encapsulation type is autonegotiated.

To autonegotiate trunking, make sure your interfaces are in the same VTP domain. Use the trunk or nonegotiate keywords to force interfaces in different domains to trunk. For more information on VTP domains, see Chapter 15 "Configuring Layer 2 Ethernet Interfaces."

Trunk negotiation is managed by the Dynamic Trunking Protocol (DTP). DTP supports autonegotiation of both ISL and 802.1Q trunks.

Encapsulation Types

Table 15-1 lists the Ethernet trunk encapsulation types.

Table 15-1 Ethernet Trunk Encapsulation Types 

Encapsulation Type
Encapsulation Command
Purpose

ISL

switchport trunk encapsulation isl

Specifies ISL encapsulation on the trunk link.

802.1Q

switchport trunk encapsulation dot1q

Specifies 802.1Q encapsulation on the trunk link.

Negotiate

switchport trunk encapsulation negotiate

Specifies that the interface negotiate with the neighboring interface to become an ISL (preferred) or 802.1Q trunk, depending on the configuration and capabilities of the neighboring interface.


The trunking mode, the trunk encapsulation type, and the hardware capabilities of the two connected interfaces determine whether a link becomes an ISL or 802.1Q trunk.

Layer 2 Interface Modes

Table 15-2 lists the Layer 2 interface modes and describes how they function on Ethernet interfaces.

Table 15-2 Layer 2 Interface Modes 

Mode
Purpose

switchport mode access

Puts the interface into permanent nontrunking mode and negotiates to convert the link into a nontrunking link. The interface becomes a nontrunk interface even if the neighboring interface does not change.

switchport mode
dynamic desirable

Makes the interface actively attempt to convert the link to a trunking link. The interface becomes a trunk interface if the neighboring interface is set to trunk, desirable, or auto mode.

switchport mode dynamic auto

Makes the interface convert the link to a trunking link if the neighboring interface is set to trunk or desirable mode. This is the default mode for all Ethernet interfaces.

switchport mode trunk

Puts the interface into permanent trunking mode and negotiates to convert the link into a trunking link. The interface becomes a trunk interface even if the neighboring interface does not change.

switchport nonegotiate

Puts the interface into permanent trunking mode but prevents the interface from generating DTP frames. You must configure the neighboring interface manually as a trunk interface to establish a trunking link.



Note DTP is a point-to-point protocol. However, some internetworking devices might forward DTP frames improperly. To avoid this problem, ensure that interfaces connected to devices that do not support DTP are configured with the access keyword if you do not intend to trunk across those links. To enable trunking to a device that does not support DTP, use the nonegotiate keyword to cause the interface to become a trunk without generating DTP frames.


Default Layer 2 Ethernet Interface Configuration

Table 15-3 shows the Layer 2 Ethernet interface default configuration.

Table 15-3 Layer 2 Ethernet Interface Default Configuration 

Feature
Default Value

Interface mode

switchport mode dynamic auto

Trunk encapsulation

switchport trunk encapsulation negotiate

Allowed VLAN range

VLANs 1-1005

VLAN range eligible for pruning

VLANs 2-1001

Default VLAN (for access ports)

VLAN 1

Native VLAN (for 802.1Q only trunks)

VLAN 1

STP1

Enabled for all VLANs

STP port priority

128

STP port cost

100 for 10-Mbps Ethernet LAN ports

19 for 10/100-Mbps Fast Ethernet ports

19 for 100-Mbps Fast Ethernet ports

4 for 1000-Mbps Gigabit Ethernet ports

2 for 10,000-Mbps 10-Gigabit Ethernet LAN ports

1 STP = Spanning Tree Protocol


Layer 2 Interface Configuration Guidelines and Restrictions

Keep the following guidelines and restrictions in mind when you configure Layer 2 interfaces:

In a network of Cisco switches connected through 802.1Q trunks, the switches maintain one instance of spanning tree for each VLAN allowed on the trunks. Non-Cisco 802.1Q switches maintain only one instance of spanning tree for all VLANs allowed on the trunks.

When you connect a Cisco switch to a non-Cisco device through an 802.1Q trunk, the Cisco switch combines the spanning tree instance of the native VLAN of the trunk with the spanning tree instance of the non-Cisco 802.1Q switch. However, spanning tree information for each VLAN is maintained by Cisco switches separated by a cloud of non-Cisco 802.1Q switches. The non-Cisco 802.1Q cloud separating the Cisco switches is treated as a single trunk link between the switches.

Make sure the native VLAN for an 802.1Q trunk is the same on both ends of the trunk link. If the VLAN on one end of the trunk is different from the VLAN on the other end, spanning tree loops might result.

Disabling spanning tree on any VLAN of an 802.1Q trunk can cause spanning tree loops.

Configuring Ethernet Interfaces for Layer 2 Switching

The following sections describe how to configure Layer 2 switching on a Catalyst 4500 series switch:

Configuring an Ethernet Interface as a Layer 2 Trunk

Configuring an Interface as a Layer 2 Access Port

Clearing Layer 2 Configuration

Configuring an Ethernet Interface as a Layer 2 Trunk


Note The default for Layer 2 interfaces is switchport mode dynamic auto. If the neighboring interface supports trunking and is configured to trunk mode or dynamic desirable mode, the link becomes a Layer 2 trunk. By default, trunks negotiate encapsulation. If the neighboring interface supports ISL and 802.1Q encapsulation and both interfaces are set to negotiate the encapsulation type, the trunk uses ISL encapsulation.



Note Supervisor Engine 6-E does not support ISL trunking.


To configure an interface as a Layer 2 trunk, perform this task:

 
Command
Purpose

Step 1 

Switch(config)# interface {fastethernet | 
gigabitethernet | tengigabitethernet} 
slot/port 

Specifies the interface to configure.

Step 2 

Switch(config-if)# shutdown 

(Optional) Shuts down the interface to prevent traffic flow until configuration is complete.

Step 3 

Switch(config-if)# switchport trunk 
encapsulation {isl | dot1q | negotiate} 

(Optional) Specifies the encapsulation.

Note You must enter this command with either the isl or dot1q keyword to support the switchport mode trunk command, which is not supported by the default mode (negotiate).

Note Supervisor Engine 6-E does not support ISL trunking.

Step 4 

Switch(config-if)# switchport mode 
{dynamic {auto | desirable} | trunk} 

Configures the interface as a Layer 2 trunk. (Required only if the interface is a Layer 2 access port or to specify the trunking mode.)

Step 5 

Switch(config-if)# switchport access vlan 
vlan_num 

(Optional) Specifies the access VLAN, which is used if the interface stops trunking. The access VLAN is not used as the native VLAN.

Note The vlan_num parameter is either a single VLAN number from 1 to 1005 or a range of VLANs described by two VLAN numbers, the lesser one first, separated by a dash. Do not enter any spaces between comma-separated vlan parameters or in dash-specified ranges.

Step 6 

Switch(config-if)# switchport trunk 
native vlan vlan_num 

For 802.1Q trunks, specifies the native VLAN.

Note If you do not set the native VLAN, the default is used (VLAN 1).

Step 7 

Switch(config-if)# switchport trunk 
allowed vlan {add | except | all | 
remove} 
vlan_num[,vlan_num[,vlan_num[,....]]

(Optional) Configures the list of VLANs allowed on the trunk. All VLANs are allowed by default. You cannot remove any of the default VLANs from a trunk.

Step 8 

Switch(config-if)# switchport trunk 
pruning vlan {add | except | none | 
remove} 
vlan_num[,vlan_num[,vlan_num[,....]] 

(Optional) Configures the list of VLANs allowed to be pruned from the trunk (see the "VLAN Trunking Protocol" section). The default list of VLANs allowed to be pruned contains all VLANs, except for VLAN 1.

Step 9 

Switch(config-if)# no shutdown 

Activates the interface. (Required only if you shut down the interface.)

Step 10 

Switch(config-if)# end 

Exits interface configuration mode.

Step 11 

Switch# show running-config interface 
{fastethernet | gigabitethernet | 
tengigabitethernet} slot/port 

Displays the running configuration of the interface.

Step 12 

Switch# show interfaces [fastethernet | 
gigabitethernet | tengigabitethernet] 
slot/port switchport 

Displays the switch port configuration of the interface.

Step 13 

Switch# show interfaces [{fastethernet | 
gigabitethernet | tengigabitethernet} 
slot/port] trunk 

Displays the trunk configuration of the interface.

This example shows how to configure the Fast Ethernet interface 5/8 as an 802.1Q trunk. This example assumes that the neighbor interface is configured to support 802.1Q trunking and that the native VLAN defaults to VLAN 1:

Switch# configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)# interface fastethernet 5/8 
Switch(config-if)# shutdown 
Switch(config-if)# switchport mode dynamic desirable 
Switch(config-if)# switchport trunk encapsulation dot1q 
Switch(config-if)# no shutdown 
Switch(config-if)# end 
Switch# exit 
 
   

This example shows how to verify the running configuration:

Switch# show running-config interface fastethernet 5/8 
Building configuration...
Current configuration:
!
interface FastEthernet5/8
 switchport mode dynamic desirable
 switchport trunk encapsulation dot1q
end
 
   

This example shows how to verify the switch port configuration:

Switch# show interfaces fastethernet 5/8 switchport 
Name: Fa5/8
Switchport: Enabled
Administrative Mode: dynamic desirable
Operational Mode: trunk
Administrative Trunking Encapsulation: negotiate
Operational Trunking Encapsulation: dot1q
Negotiation of Trunking: Enabled
Access Mode VLAN: 1 (default)
Trunking Native Mode VLAN: 1 (default)
Trunking VLANs Enabled: ALL
Pruning VLANs Enabled: 2-1001
 
   

This example shows how to verify the trunk configuration:

Switch# show interfaces fastethernet 5/8 trunk 
 
   
Port      Mode         Encapsulation  Status        Native vlan
Fa5/8     desirable    n-802.1q       trunking      1
 
   
Port      Vlans allowed on trunk
Fa5/8 1-1005
 
   
Port      Vlans allowed and active in management domain
Fa5/8 1-6,10,20,50,100,152,200,300,303-305,349-351,400,500,521,524,570,801-8
02,850,917,999,1002-1005
 
   
Port      Vlans in spanning tree forwarding state and not pruned
Fa5/8 1-6,10,20,50,100,152,200,300,303-305,349-351,400,500,521,524,570,801-8
02,850,917,999,1002-1005
 
   
Switch# 

Configuring an Interface as a Layer 2 Access Port


Note If you assign an interface to a VLAN that does not exist, the interface is not operational until you create the VLAN in the VLAN database (see the "Configuring VLANs in Global Configuration Mode" section).


To configure an interface as a Layer 2 access port, perform this task:

 
Command
Purpose

Step 1 

Switch(config)# interface {fastethernet | 
gigabitethernet | tengigabitethernet} 
slot/port 

Specifies the interface to configure.

Step 2 

Switch(config-if)# shutdown 

(Optional) Shuts down the interface to prevent traffic flow until configuration is complete.

Step 3 

Switch(config-if)# switchport 

Configures the interface for Layer 2 switching:

You must enter the switchport command once without any keywords to configure the interface as a Layer 2 port before you can enter additional switchport commands with keywords.

Required only if you previously entered the no switchport command for the interface.

Step 4 

Switch(config-if)# switchport mode access 

Configures the interface as a Layer 2 access port.

Step 5 

Switch(config-if)# switchport access vlan 
vlan_num 

Place the interface in a VLAN.

Step 6 

Switch(config-if)# no shutdown 

Activates the interface. (Required only if you had shut down the interface.)

Step 7 

Switch(config-if)# end 

Exits interface configuration mode.

Step 8 

Switch# show running-config interface 
{fastethernet | gigabitethernet} slot/port 

Displays the running configuration of the interface.

Step 9 

Switch# show interfaces [{fastethernet | 
gigabitethernet | tengigabitethernet} 
slot/port] switchport 

Displays the switch port configuration of the interface.

This example shows how to configure the Fast Ethernet interface 5/6 as an access port in VLAN 200:

Switch# configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)# interface fastethernet 5/6 
Switch(config-if)# shutdown 
Switch(config-if)# switchport mode access 
Switch(config-if)# switchport access vlan 200 
Switch(config-if)# no shutdown 
Switch(config-if)# end 
Switch# exit 
 
   

This example shows how to verify the running configuration:

Switch# show running-config interface fastethernet 5/6
Building configuration...
!
Current configuration :33 bytes
interface FastEthernet 5/6
 switchport access vlan 200
 switchport mode access
end
 
   

This example shows how to verify the switch port configuration:

Switch# show interface fastethernet 5/6 switchport
Name:Fa5/6
Switchport:Enabled
Administrative Mode:dynamic auto
Operational Mode:static access
Administrative Trunking Encapsulation:negotiate
Operational Trunking Encapsulation:native
Negotiation of Trunking:On
Access Mode VLAN:1 (default)
Trunking Native Mode VLAN:1 (default)
Administrative private-vlan host-association:none
Administrative private-vlan mapping:none
Operational private-vlan:none
Trunking VLANs Enabled:ALL
Pruning VLANs Enabled:2-1001
Switch# 

Clearing Layer 2 Configuration

To clear the Layer 2 configuration on an interface, perform this task:

 
Command
Purpose

Step 1 

Switch(config)# default interface {fastethernet | 
gigabitethernet | tengigabitethernet} slot/port 

Specifies the interface to clear.

Step 2 

Switch(config-if)# end 

Exits interface configuration mode.

Step 3 

Switch# show running-config interface 
{fastethernet | gigabitethernet | 
tengigabitethernet} slot/port 

Displays the running configuration of the interface.

Step 4 

Switch# show interfaces [{fastethernet | 
gigabitethernet | tengigabitethernet} slot/port] 
switchport 

Displays the switch port configuration of the interface.

This example shows how to clear the Layer 2 configuration on the Fast Ethernet interface 5/6:

Switch# configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)# default interface fastethernet 5/6 
Switch(config)# end 
Switch# exit 

This example shows how to verify that the Layer 2 configuration was cleared:

Switch# show running-config interface fastethernet 5/6 
Building configuration...
Current configuration:
!
interface FastEthernet5/6
end
 
   

This example shows how to verify the switch port configuration:

Switch# show interfaces fastethernet 5/6 switchport 
Name: Fa5/6
Switchport: Enabled
Switch#