R&S Blog

Just another WordPress.com site

Archive for the month “March, 2012”

STP Port Cost

Vlans from 1-10 created on both switches will the default priority with sw2 being the root bridge based on the bridge priority field + Mac.
On SW1 fa 0/2 is blocking state for all vlans which based on the port priority
SW1 Interface        Role Sts Cost      Prio.Nbr Type

—————- —- — ——— ——– ——————————–

Fa0/1            Root FWD 19        128.1    P2p

Fa0/2            Altn BLK 19        128.2    P2p

We want to change fa 0/2 to be the root port for VLANS 1-5 and blocking for VLANS 6-10, we can either change the port-priority or the path cost. We will look at both methods as an example below.

The BPDU are sent by the Root Bridge which include the port-priority field, so we have to make the changes on SW2 fa 0/2 for the vlans 1-5

SW2(config-if)#spanning-tree vlan 1-5 port-priority 64

SW1#sh spanning-tree vlan 1 interface fa 0/2 detail

 Port 2 (FastEthernet0/2) of VLAN0001 is root forwarding

   Port path cost 19, Port priority 128, Port Identifier 128.2 (Local Port Priority)

   Designated root has priority 32769, address 0009.7c0b.9880

   Designated bridge has priority 32769, address 0009.7c0b.9880

   Designated port id is 64.2(SW2 Port Priority)

   Timers: message age 15, forward delay 0, hold 0

   Number of transitions to forwarding state: 3

   Link type is point-to-point by default

   BPDU: sent 10, received 1066

 Port 2 SW1 are in the blocking state as the command includes only vlans 1-5

SW1#sh spanning-tree vlan 6 interface fa 0/2 detail

 
 Port 2 (FastEthernet0/2) of VLAN0006 is alternate blocking

   Port path cost 19, Port priority 128, Port Identifier 128.2.

   Designated root has priority 32774, address 0009.7c0b.9880

   Designated bridge has priority 32774, address 0009.7c0b.9880

   Designated port id is 128.2, designated path cost 0

   Timers: message age 16, forward delay 0, hold 0

   Number of transitions to forwarding state: 0

   Link type is point-to-point by default

   BPDU: sent 1, received 936

Option 2 Changing the Pathc

Change the path cost on Interface fa 0/2 for vlans 1-5

Interface        Role Sts Cost      Prio.Nbr Type

—————- —- — ——— ——– ——————————–

Fa0/1            Root FWD 19        128.1    P2p

Fa0/2            Altn BLK 19        128.2    P2p

 

SW1(config-if)#spanning-tree vlan 1-5 cost 16

Interface        Role Sts Cost      Prio.Nbr Type

—————- —- — ——— ——– ——————————–

Fa0/1            Altn BLK 19        128.1    P2p

Fa0/2            Root FWD 16        128.2    P2p

 

 

Advertisements

EtherChannels

EtherChannel is Cisco’s term for bundling two or more physical Ethernet links for the purposes of aggregating available bandwidth and, to a lesser extent, providing a measure of physical redundancy. Under normal conditions, all but one redundant physical link between two switches will be disabled by STP at one end.

without_etherchannel.png

With EtherChannel configured, multiple links are grouped into a port-channel, which is assigned its own configurable virtual interface. The bundle is treated as a single link.

with_etherchannel.png

EtherChannel Negotiation

An EtherChannel can be established using one of three mechanisms:

  • PAgP – Cisco’s proprietary negotiation protocol
  • LACP (IEEE 802.3ad) – Standards-based negotiation protocol
  • Static Persistence (“On”) – No negotiation protocol is used

Any of these three mechanisms will suffice for most scenarios, however the choice does deserve some consideration. PAgP, while perfectly able, should probably be disqualified as a legacy proprietary protocol unless you have a specific need for it (such as ancient hardware). That leaves LACP and “on”, both of which have a specific benefit.

LACP helps protect against switching loops caused by misconfiguration; when enabled, an EtherChannel will only be formed after successful negotiation between its two ends. However, this negotiation introduces an overhead and delay in initialization. Statically configuring an EtherChannel (“on”) imposes no delay yet can cause serious problems if not properly configured at both ends.

To configure an EtherChannel using LACP negotiation, each side must be set to either active or passive; only interfaces configured in active mode will attempt to negotiate an EtherChannel. Passive interfaces merely respond to LACP requests. PAgP behaves the same, but its two modes are refered to as desirable and auto.

negotiation_modes.png

Only a single line is needed to configure a group of ports as an EtherChannel:

S1(config)# interface range f0/13 -15
S1(config-if-range)# channel-group 1 mode ?
  active     Enable LACP unconditionally
  auto       Enable PAgP only if a PAgP device is detected
  desirable  Enable PAgP unconditionally
  on         Enable Etherchannel only
  passive    Enable LACP only if a LACP device is detected

S1(config-if-range)# channel-group 1 mode active
Creating a port-channel interface Port-channel 1

As noted, a virtual port-channel interface Port-channel1 has been created to represent the logical link. Switchport configurations applied to this interface are replicated to the physical member interfaces. We can inspect the health of the EtherChannel with the show etherchannel summary command:

S1# show etherchannel summary
Flags:  D - down        P - bundled in port-channel
        I - stand-alone s - suspended
        H - Hot-standby (LACP only)
        R - Layer3      S - Layer2
        U - in use      f - failed to allocate aggregator

M - not in use, minimum links not met
        u - unsuitable for bundling
        w - waiting to be aggregated
        d - default port

Number of channel-groups in use: 1
Number of aggregators:           1

Group  Port-channel  Protocol    Ports
------+-------------+-----------+-----------------------------------------------
1      Po1(SD)         LACP      Fa0/13(D)   Fa0/14(D)   Fa0/15(D)

The opposite side of the LACP EtherChannel will typically be configured as passive, however it can be active as well.

S2(config-if-range)# channel-group 1 mode passive
Creating a port-channel interface Port-channel 1

When the member ports on both sides of the EtherChannel are enabled, the port-channel interface also transitions to the up state. However, note the timing of the system messages:

*Mar  1 00:45:50.647: %LINK-3-UPDOWN: Interface FastEthernet0/14, changed state to up
*Mar  1 00:45:50.683: %LINK-3-UPDOWN: Interface FastEthernet0/13, changed state to up
*Mar  1 00:45:50.691: %LINK-3-UPDOWN: Interface FastEthernet0/15, changed state to up
*Mar  1 00:45:53.487: %LINK-3-UPDOWN: Interface Port-channel1, changed state to up

Almost a full three seconds elapsed between the member ports transitioning to the up state and the port-channel interface coming up. Once it did, we can see the state of the EtherChannel has changed to “in use”:

S1# show etherchannel summary
Flags:  D - down        P - bundled in port-channel
        I - stand-alone s - suspended
        H - Hot-standby (LACP only)
        R - Layer3      S - Layer2
        U - in use      f - failed to allocate aggregator

M - not in use, minimum links not met
        u - unsuitable for bundling
        w - waiting to be aggregated
        d - default port

Number of channel-groups in use: 1
Number of aggregators:           1

Group  Port-channel  Protocol    Ports
------+-------------+-----------+-----------------------------------------------
1      Po1(SU)         LACP      Fa0/13(P)   Fa0/14(P)   Fa0/15(P)

Note the S indicating layer two operation; on multilayer platforms, EtherChannel interfaces can be configured for routed operation as well.

For comparison, let’s reconfigure the EtherChannel to function without a negtiation protocol (“on” mode):

S1(config)# no interface po1
S1(config)# interface range f0/13 -15
S1(config-if-range)# channel-group 1 mode on
Creating a port-channel interface Port-channel 1

S1(config-if-range)# no shutdown

This time we observe that the port-channel interface is enabled as soon as its first member port comes up, as there is no delay imposed by negotiation:

*Mar  1 00:56:12.271: %LINK-3-UPDOWN: Interface FastEthernet0/13, changed state to up
*Mar  1 00:56:12.287: %LINK-3-UPDOWN: Interface Port-channel1, changed state to up
*Mar  1 00:56:12.291: %LINK-3-UPDOWN: Interface FastEthernet0/14, changed state to up
*Mar  1 00:56:12.307: %LINK-3-UPDOWN: Interface FastEthernet0/15, changed state to up

In the Campus Network High Availability Design Guide, Cisco recommend forgoing the use of a negotiation protocol and configuring EtherChannels for static “on/on” operation; however they also caution that this approach offers no protection against the effect of misconfigurations.

EtherChannel Load-Balancing

Another consideration to make when implementing EtherChannels is the type of load-balancing in effect. EtherChannel provides load-balancing only per frame, not per bit. A switch decides which member link a frame will traverse by the outcome of a hash function performed against one or more fields of each frame. Which fields are considered is dependent on the switch platform and configuration. For example, a Catalyst 3550 can match only against a frame’s destination or source MAC address:

S1(config)# port-channel load-balance ?
  dst-mac  Dst Mac Addr
  src-mac  Src Mac Addr

The show etherchannel load-balance command reveals that source MAC address load-balancing is default on the Catalyst 3550:

S1# show etherchannel load-balance
EtherChannel Load-Balancing Configuration:
        src-mac

EtherChannel Load-Balancing Addresses Used Per-Protocol:
Non-IP: Source MAC address
  IPv4: Source MAC address

More powerful platforms can match against IP address(es) or layer four port(s). Generally speaking, higher layer fields are more favorable as they tend to be more dynamic, resulting in a more granular distribution of traffic across member links.

Direction of flow is also an important detail. For example, consider the following topology:

topology.png

Routed packets entering the subnet from S1 are always sourced from the MAC address of the VLAN interface. If source MAC load-balancing is in use, these frames will be forwarded down only one member link, because the outcome of the hash function will always be the same. Configuring destination MAC load-balancing on S1 is recommended to achieve a more varied distribution of frames and make better use of the available bandwidth.

The opposite is true on S2: Since all frames entering the EtherChannel from LAN hosts are destined for the MAC address of the gateway (VLAN interface), source MAC address load-balancing works better here.

EtherChannel Bandwidth and Costs

Finally, remember that the perceived bandwidth of a port-channel interface is equal to the sum of its active member links. For example, an EtherChannel with three active 100 Mbps members will show a bandwidth of 300 Mbps. Because members can still fail individually, the bandwidth of a port-channel interface can fluctuate without going down.

FHRP Cheat Sheet

First_Hop_Redundancy

STP Root Guard

In Figure 2, device D begins to participate in STP. For example, software-based bridge applications are launched on PCs or other switches that a customer connects to a service-provider network. If the priority of bridge D is 0 or any value lower than the priority of the root bridge, device D is elected as a root bridge for this VLAN. If the link between device A and B is 1 gigabit and links between A and C as well as B and C are 100 Mbps, the election of D as root causes the Gigabit Ethernet link that connects the two core switches to block. This block causes all the data in that VLAN to flow via a 100-Mbps link across the access layer. If more data flow via the core in that VLAN than this link can accommodate, the drop of some frames occurs. The frame drop leads to a performance loss or a connectivity outage.

Figure 2

74b.gif

The root guard feature protects the network against such issues.

The configuration of root guard is on a per-port basis. Root guard does not allow the port to become an STP root port, so the port is always STP-designated. If a better BPDU arrives on this port, root guard does not take the BPDU into account and elect a new STP root. Instead, root guard puts the port into the root-inconsistent STP state. You must enable root guard on all ports where the root bridge should not appear. In a way, you can configure a perimeter around the part of the network where the STP root is able to be located.

In Figure 2, enable root guard on the Switch C port that connects to Switch D.

Switch C in Figure 2 blocks the port that connects to Switch D, after the switch receives a superior BPDU. Root guard puts the port in the root-inconsistent STP state. No traffic passes through the port in this state. After device D ceases to send superior BPDUs, the port is unblocked again. Via STP, the port goes from the listening state to the learning state, and eventually transitions to the forwarding state. Recovery is automatic; no human intervention is necessary.

This message appears after root guard blocks a port:

%SPANTREE-2-ROOTGUARDBLOCK: Port 1/1 tried to become non-designated in VLAN 77.
Moved to root-inconsistent state

Default STP Timers

This is pretty basic, but you need to remember a couple of important things when tasked with tweaking spanning-tree timers:

1) Make the changes on the root bridge.
2) The root bridge settings are the timers that are used – not the local settings on the non-root bridge(s).

You can see the timers with the “show spanning-tree vlan x” command.  The timers are set on the root. Non-root bridges will still show the local timer values, but will use the root values:

sw2#sh span v 1

VLAN0001
Spanning tree enabled protocol ieee
Root ID    Priority    24577
Address     0012.018f.d580
Cost        19
Port        15 (FastEthernet0/13)
Hello Time   2 sec  Max Age 20 sec  Forward Delay  4 sec <-note

Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
Address     0012.009c.ca00 <-sw2 is not the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec <-note
Aging Time 300

Interface        Role Sts Cost      Prio.Nbr Type
—————- —- — ——— ——– ——————————–
Fa0/1            Desg FWD 19        128.3    P2p
Fa0/13           Root FWD 19        128.15   P2p
Fa0/14           Altn BLK 19        128.16   P2p
Fa0/15           Altn BLK 19        128.17   P2p

Bring up a port in VLAN 1:
sw2(config)#int fa0/1
sw2(config-if)#no sh
sw2(config-if)#^Z

*Mar  1 22:33:42: %SYS-5-CONFIG_I: Configured from console by console
*Mar  1 22:33:43: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to down
*Mar  1 22:33:44: set portid: VLAN0001 Fa0/1: new port id 8003
*Mar  1 22:33:44: STP: VLAN0001 Fa0/1 -> listening
*Mar  1 22:33:46: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 22:33:47: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
*Mar  1 22:33:48: STP: VLAN0001 Fa0/1 -> learning  [listen to learn = 4 seconds]
*Mar  1 22:33:52: STP: VLAN0001 sent Topology Change Notice on Fa0/13
*Mar  1 22:33:52: STP: VLAN0001 Fa0/1 -> forwarding [learn to forward = 4 seconds]

The non-root bridge uses the root bridge’s Forward Delay timer of 4 seconds rather than its local timer of 15 seconds.

**************************
3 different ways to change the forward delay back to default (15 seconds)

We set the forward delay to 4 seconds (sw1 is on the root bridge):

sw1(config)#do sh sp v 1 | i ID|Forward
Root ID    Priority    24577
Hello Time   2 sec  Max Age 20 sec  Forward Delay  4 sec
  Bridge ID  Priority    24577  (priority 24576 sys-id-ext 1)
Hello Time   2 sec  Max Age 20 sec  Forward Delay  4 sec

1) “no spanning-tree vlan 1 forward-time 4″

sw1(config)#no sp v 1 f 4
sw1(config)#do sh sp v 1 | i ID|Forward
Root ID    Priority    24577
Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
  Bridge ID  Priority    24577  (priority 24576 sys-id-ext 1)
Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

2) “default spanning-tree vlan 1 forward-time”

sw1(config)#default sp v 1 f
sw1(config)#do sh sp v 1 | i ID|Forward
Root ID    Priority    24577
Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
Bridge ID  Priority    24577  (priority 24576 sys-id-ext 1)
Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

3) “spanning-tree vlan 1 forward-time 15″

sw1(config)#sp v 1 f 15
sw1(config)#do sh sp v 1 | i ID|Forward
Root ID    Priority    24577
Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
  Bridge ID  Priority    24577  (priority 24576 sys-id-ext 1)
Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

Spanning-Tree Root Primary/Seconday

Spanning-tree vlan 1 root primary

Runs a macro and sets the priority lower than the current root, if the primary keyword is used and the current root bridge is more than 24,576 the local switch set it priority to 24,576.  Remember the default priority on all switches will be 32,768.

Example:

SW1#sh sp v 1

VLAN0001

Spanning tree enabled protocol ieee

Root ID    Priority    32769 priority (Default 32768 + Vlan1)

Address     000c.85aa.d6c0

Cost        19

Port        3 (FastEthernet0/2)

Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)

Address     001b.0c8d.3f80

Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

Aging Time 300

Interface        Role Sts Cost      Prio.Nbr Type

—————- —- — ——— ——– ——————————–

Fa0/1            Desg FWD 19        128.2    P2p

Fa0/2            Root FWD 19        128.3    P2p

Fa0/7            Desg FWD 19        128.8    Edge P2p

spanning-tree vlan 1 root primary

VLAN0001

Spanning tree enabled protocol ieee

Root ID    Priority    24577 (priority 24576 + 1)

Address     001b.0c8d.3f80

This bridge is the root

Bridge ID  Priority    24577  (priority 24576 sys-id-ext 1)

Address     001b.0c8d.3f80

(spanning-tree vlan 1 priority 24576 is what is actually displayed in the running config)

 

 The secondary root bridge is used to set the bridge to a lower value of 28,672, again the default is 32,768

On SW2 if we run the secondary keyword

 spanning-tree vlan 1 root secondary

 vlan 1 bridge priority set to 28672 (Telling me what the new bridge priority)

VLAN0001

Spanning tree enabled protocol ieee

Root ID    Priority    24577

Address     001b.0c8d.3f80

Cost        19

Port        1 (FastEthernet0/1)

Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

Bridge ID  Priority    28673  (priority 28672 sys-id-ext 1)

Address     000c.85b5.bb00

Just to recap spanning-tree vlan 1 root primary will set the root bridge to 24,576 + Vlan Number

The spanning vlan 1 root secondary will set the bridge priority to 28,672 + Vlan Number

 

 

Post Navigation