• Aucun résultat trouvé

Working with the Spanning Tree Protocol

Dans le document Cisco Catalyst LAN Switching (Page 182-185)

A switch is a bridge and must run the Spanning Tree Protocol (STP). Catalyst switches run a version of STP for every VLAN. I realize that we have not yet discussed creating VLANs, But this is not necessary yet. Chapter 4 talked about the STP and all its related parameters. This section explains how to configure those parameters.

The root bridge is the bridge with the lowest priority. To change the bridge priority from the default of 32768, use the set spantree priority command:

Cat5000> (enable) set spantree priority [bridge_priority] [vlan]

If no VLAN is specified, this sets the bridge priority for VLAN 1.

Page 194

BONEHEAD ALERT: It is a common mistake to forget to specify the VLAN after the bridge priority. This can cause problems when you intend to

configure another VLAN's bridge priority.

Example

To set a switch as the root for VLAN 10:

Cat5000> (enable) set spantree priority 1 10

This will set the bridge priority low enough that it will become the root bridge. If there is another bridge with its priority set to 1 for VLAN 10, the tiebreaker will be the MAC address.

The ports that will be placed in the forwarding state will be determined by several parameters, as mentioned earlier. Two of them are port priority and port cost. To set the port cost two

commands may be used. If the port cost is going to be changed on a port for all VLANs, the command set port cost is used. However, if the port cost of a single VLAN is to be changed, then set portvlan cost is used. The default cost of a port is based on its

bandwidth and typically is 1000/bandwidth, except for Fast Ethernet, which uses a default cost of 19 instead of 10.

To set the port cost for all VLANs:

Cat5000> (enable) set spantree portcost [module_number/port_number]

[cost]

To set the port cost for a specific VLAN:

Cat5000> (enable) set spantree portvlancost [module_number/

port_number] cost [cost] [VLAN]

Example

To set the port cost of port 1/1 to 10 from the default value of 19 for all VLANs:

Cat5000> (enable) set spantree portcost 1/1 10 Spantree port 1/2 path cost set to 10.

To set the port cost of port 1/1 to 10 for only VLAN 1, leaving the port cost at 19 for all other VLANs:

Page 195 Cat5000> (enable) set spantree portvlancost 1/2 cost 10 1

Port 1/1 VLANs 2-1005 have path cost 19.

Port 1/1 VLANs 1 have path cost 10.

Cat5000> (enable)

The port that is placed in the forwarding mode also can rely on the port priority. By default, all ports are set to a priority of 32 (1-63). The lower the priority, the better are the port's chances of being placed in the forwarding mode. The priority, like the port cost, can be configured for all VLANs or for a single VLAN with the set spantree portvlan priority and set spantree priority commands.

To set the priority of a port for all VLANs:

Cat5000> (enable) set spantree portpri mod_num/port_num priority [vlans]

To set the priority of a port for one VLAN:

Cat5000> (enable) set spantree portvlanpri mod_num/port_num priority [vlans]

Example

To configure the 2/1 port with a priority of 1 for all VLANs:

Cat5000> (enable) set spantree portpri 2/1 1 Bridge port 2/1 port priority set to 1.

Cat5000> (enable)

To configure the 2/1 port with a priority of 1 for only VLAN 1:

Cat5000> (enable) set spantree portvlanpri 2/1 1 10 Port 2/1 vlans 1-9,11-1005 using portpri 32.

Port 2/1 vlans 10 using portpri 1 Cat5000> (enable)

A problem with switched Ethernet to the desktop, as mentioned in Chapter 2, and the listening and learning states that a port must traverse before being placed in the forwarding state can be remedied easily with the set spantree portfast command. This command causes the port to forward while it is listening and learning. Workstations connected to the port therefore will have connectivity to the appropriate servers while the BPDUs are being transmitted and the STP is making its calculations. This does not shut off the STP! If a loop is present, the switch will identify it and block on the culprit port. There may be a small loss of connectivity, but I have observed these times to be fewer than 10 seconds.

Page 196

To enable a port to forward while in the listening and learning states:

Cat5000> (enable) set spantree portfast [module_number/port_number]

[enable or disable]

Example

If port 2/1 is connected directly to a workstation or server, it is not necessary to block during the listening and learning modes:

Cat5000> (enable) set spantree portfast 2/1 enable

Warning: Spantree port fast start should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to a fast start port can cause temporary spanning

tree loops. Use with caution.

Spantree port 2/1 fast start enabled.

These parameters can all be viewed with the show spantree command:

Cat5000> (enable) show spantree [module/number] [vlan_number]

Example

To view the STP settings for the 2/1 port:

Cat5000> (enable) show spantree 2/1

2/1 Console> (enable)

To view the spanning tree statistics for all the ports of VLAN 1:

Cat5000> show spantree 1 VLAN 1 Bridge ID MAC ADDR

Bridge ID Priority

Cost Priority Fast-Start Group-method Port-State

Cost Priority Fast-Start Group-method Port-State

This show screen can be very helpful when troubleshooting an STP problem. The designated root port is the port that is the closest to the root bridge. In this case it is the 1/0 port. There is no 1/0 port! This indicates that this switch is the root bridge for VLAN 1. However, this switch may not be the root bridge for VLAN 10. This show screen also gives the MAC address and priority of the root bridge. This information will be helpful when determining what priority at which to place a switch if that switch is to be made the root.

Dans le document Cisco Catalyst LAN Switching (Page 182-185)