Monday, September 28, 2009

EtherChannels

EtherChannel is a way of combining several physical links between switches into one logical connection. Normally, Spanning Tree blocks redundant links; EtherChannel gets around that and allows load balancing across those links. Load is balancing on the basis of such things as source or destination MAC address or IP address. The Etherchannel load-balancing method is configured at global configuration mode.

(config)#port-channel load-balance type

A logical interface—the Port Channel interface—is created. Configuration can be applied to both the logical and physical interfaces.

Some guidelines for EtherChannels are as follows:
  • Interfaces in the channel do not have to be physically next to each other or on the same module.
  • All ports must be the same speed and duplex.
  • All ports in the bundle should be enabled.
  • None of the bundle ports can be a SPAN port.
  • Assign an IP address to the logical Port Channel interface, not the physical ones.
  • Put all bundle ports in the same VLAN, or make them all trunks.
  • If they are trunks, they must all carry the same VLANs and use the same trunking mode.
  • Configuration you apply to the Port Channel interface affects the entire EtherChannel. Configuration you apply to a physical interface only affects that interface.

Configuring an EtherChannel

Basically, for a Layer 3 EtherChannel, you should configure the logical interface and then put the physical interfaces into the channel group:

(config)#interface port-channel number
(config-if)#no switchport
(config-if)#ip address address mask

Then, at each port that is part of the EtherChannel, use the following:

(config)#interface { number | range interface – interface}
(config-if)#channel-group number mode {auto | desirable | on}

Putting the IP address on the Port Channel interface creates a Layer 3 EtherChannel. Simply putting interfaces into a channel group creates a Layer 2 EtherChannel, and the logical interface is automatically created.

The Cisco proprietary Port Aggregation Protocol (PAgP) dynamically negotiates the formation of a channel. There are three PAgP modes:
  • On—The port channels without using PAgP negotiation. The port on the other side must also be set to On.
  • Auto—Responds to PAgP messages but does not initiate them. Port channels if the port on the other end is set to Desirable. This is the default mode.
  • Desirable—Port actively negotiates channeling status with the interface on the other end of the link. Port channels if the other side is Auto or Desirable.

There is also a non-proprietary protocol called Link Aggregation Control Protocol (LACP), IEEE 802.3ad, which does the same thing. LACP has two modes:
  • Active—Port actively negotiates channeling with the port on the other end of the link. A channel forms if the other side is Passive or Active.
  • Passive—Responds to LACP messages but does not initiate them. A channel forms if the other end is set to Active.
If you want to use LACP, specify it under the interface and put the interface in either active or passive mode:

(config-if)#channel-protocol lacp


Verifying an EtherChannel

Some typical commands for verifying include:
  • #show running-config interface number
  • #show interfaces number etherchannel
  • #show etherchannel number port-channel
  • #show etherchannel summary

Thursday, September 17, 2009

Spanning Tree and PVST

With PVST (Per Vlan STP), there is a different instance of STP for each VLAN. To derive the VLAN BID, the switch picks a different MAC address from its base pool for each VLAN. Each VLAN has its own root bridge, root port, and so on. You can configure these so that data flow is optimized, and traffic load is balanced among the switches. Spanning Tree is enabled by default on every VLAN.


Configuring Spanning Tree

To change the STP priority value, use the following:

Switch (config)#spanning-tree vlan vlan_no. priority value


To configure a switch as root without manually changing priority values, use the following:

Switch (config)# spanning-tree vlan vlan_no. root {primary | secondary}


To change the STP port cost for an access port, use the following:

Switch(config-if)# spanning-tree cost value


To change the STP port cost for a VLAN on a trunk port, use the following:

Switch(config-if)# spanning-tree vlan vlan_no. cost value


To display STP information for a VLAN, use the following:

Switch# show spanning-tree vlan vlan_no.


To display the STP information for an interface, use the following:

Switch # show spanning-tree interface interface_no. [detail]


To verify STP timers, use the following:

Switch #show spanning-tree bridge brief


Spanning Tree Enhancements

Cisco has some proprietary enhancements to Spanning Tree that help speed up network convergence. They include:
  • PortFast
  • UplinkFast
  • BackboneFast

Portfast

Portfast is for access (user) ports only. It causes the port to bypass the STP listening and learning states and transition directly to forwarding. Connecting a switch to a Portfast port can cause loops to develop.

(config-if)#spanning-tree portfast


UplinkFast

UplinkFast is for speeding convergence when a direct link to an upstream switch fails. The switch identifies backup ports for the root port (these are called an uplink group). If the root port fails, then one of the ports in the uplink group is unblocked and transitions immediately to forwarding—it bypasses the listening and learning stages. It should be used in wiring closet switches with at least one blocked port. The command to enable uplinkfast is shown below. Please note that uplinkfast is enabled globally, so the command affects all ports and all VLANs.

(config)# spanning-tree uplinkfast


BackboneFast

BackboneFast is used for speeding convergence when a link fails that is not directly connected to the switch. It helps the switch detect indirect failures. If a switch running BackboneFast receives an inferior BPDU from its designated bridge, it knows a link on the path to the root has failed. (An inferior BPDU is one that lists the same switch for root
bridge and designated bridge.)

The switch then tries to find an alternate path to the root by sending a Root Link Query (RLQ) frame out all alternate ports. The root then responds with an RLQ response, and the port receiving this response can transition to forwarding. Alternate ports are determined in this way:
  • If the inferior BPDU was received on a blocked port, then the root port and any other blocked ports are considered alternates.
  • If the inferior BPDU was received on the root port, then all blocked ports are considered alternates.
  • If the inferior BPDU was received on the root port and there are no blocked ports, the switch assumes it has lost connectivity with the root and advertises itself as root.

Configure this command on all switches in the network:

(config)#spanning-tree backbonefast


Rapid Spanning Tree (RSTP)

Rapid Spanning Tree (RSTP) 802.1w is a standards-based, non-proprietary way of speeding STP convergence. Switch ports exchange an explicit handshake when they transition to forwarding. RSTP describes different port states than regular STP, as shown in the Table 3-3.



RSTP Port Roles

RSTP also defines different Spanning Tree roles for ports:
  • Root port—The best path to the root (same as STP).
  • Designated port—Same role as with STP.
  • Alternate port—A backup to the root port.
  • Backup port—A backup to the designated port.
  • Disabled port—One not used in the Spanning Tree.
  • Edge port—One connected only to an end user.


BPDU Differences in RSTP

In regular STP, BPDUs are originated by the root and relayed by each switch. In RSTP, each switch originates BPDUs, whether or not it receives a BPDU on its root port. All eight bits of the BPDU type field are used by RSTP. The TC and TC Ack bits are still used. The other six bits specify the port’s role and its RSTP state, and are used in the port handshake. The RSTP BPDU is set to Type 2, Version 2. PVST is done by Rapid PVST+ on Catalyst switches.


RSTP Fast Convergence

The Rapid Spanning tree process understands and incorporates topology changes much quicker than the previous version.

  • RSTP uses a mechanism similar to BackboneFast—When an inferior BPDU is received, the switch accepts it. If the switch has another path the root, it uses that and informs its downstream switch of the alternate path.
  • Edge ports work the same as Portfast ports—They automatically transition directly to forwarding.
  • Link type—If you connect two switches through a point-to-point link and the local port becomes a designated port, it exchanges a handshake with the other port to quickly transition to forwarding. Full-duplex links are assumed to be point-to-point, half-duplex links are assumed to be shared.
  • Backup and alternate ports—Ports that can transition to forwarding when no BPDUs are received from a neighbor switch (similar to UplinkFast).

If an RSTP switch detects a topology change, it sets a TC timer to twice the hello time and sets the TC bit on all BPDUs sent out to its designated and root ports until the timer expires. It also clears the MAC addresses learned on these ports.

If an RSTP switch receives a TC BPDU, it clears the MAC addresses on that port and sets the TC bit on all BPDUs sent out its designated and root ports until the TC timer expires.


Multiple Spanning Tree (MST)

With Multiple Spanning Tree (MST), you can group VLANs and run one instance of Spanning Tree for a group of VLANs. This cuts down on the number of root bridges, root ports, designated ports, and BPDUs in your network. Switches in the same MST Region share the same configuration and VLAN mappings. Configure MST with these commands:


To be compatible with 802.1Q trunking, which has one common Spanning Tree (CST) for all VLANs, MST runs one instance of an Internal Spanning Tree (IST). The IST appears as one bridge to a CST area and is MST instance number 0. The original MST Spanning Trees (called M-Trees) are active only in the region—they combine at the edge of the CST area to form one.