Показаны сообщения с ярлыком STP. Показать все сообщения
Показаны сообщения с ярлыком STP. Показать все сообщения

четверг, 2 августа 2012 г.

STP заметки

Коммутатор при включении анонсирует себя в качестве корневого моста.

Для того чтобы определить какие порты заблокировать, а какие будут forward, STP выполняет следующее:
  1. Выбор корневого моста (Root Bridge)
  2. Определение корневых портов (Root Port)
  3. Определение выделенных портов (Designated Port) 

Выбор корневого моста

Корневым становится коммутатор с наименьшим идентификатором моста (Bridge ID).

Только один коммутатор может быть корневым. Для того чтобы выбрать корневой коммутатор, все коммутаторы отправляют сообщения BPDU, указывая себя в качестве корневого коммутатора. Если коммутатор получает BPDU от коммутатора с меньшим Bridge ID, то он перестает анонсировать информацию о том, что он корневой и начинает передавать BPDU коммутатора с меньшим Bridge ID.
В итоге только один коммутатор останется корневым и будет передавать BPDU.


Изначально Bridge ID состоял из двух полей:
  • Приоритет — поле, которое позволяет административно влиять на выборы корневого коммутатора. Размер — 2 байта,
  • MAC-адрес — используется как уникальный идентификатор, который, в случае совпадения значений приоритетов, позволяет выбрать корневой коммутатор. Так как MAC-адреса уникальны, то и Bridge ID уникален, так что какой-то коммутатор обязательно станет корневым. 

Определение корневых портов

Порт коммутатора, который имеет кратчайший путь к корневому коммутатору, называется корневым портом. У любого не корневого коммутатора может быть только один корневой порт.

Определение назначенных портов

Коммутатор в сегменте сети, имеющий наименьшее расстояние до корневого коммутатора, называется назначенным коммутатором (мостом). Порт этого коммутатора, который подключен к рассматриваемому сегменту сети называется назначенным портом. 

Роли и состояния портов

Роли портов:
  • Root Port — корневой порт коммутатора
  • Designated Port — назначенный порт сегмента
  • Nondesignated Port — неназначенный порт сегмента
  • Disabled Port — порт который находится в выключенном состоянии.
Состояния портов:
  • Blocking — блокирование
  • Listening — прослушивание
  • Learning — обучение
  • Forwarding — пересылка 

STP (802.1d)

Изменениями топологии считается изменения ролей DP и RP.
Коммутатор, который обнаружил изменения в топологии отправляет Topology Change Notification (TCN) BPDU корневому коммутатору:
  • Коммутатор, на котором произошли изменения отправляет TCN BPDU через свой корневой порт. Отправка сообщения повторяется каждый hello interval (2 секунды) до тех пор пока получение сообщения не будет подтверждено.
  • Следующий коммутатор, который получил TCN BPDU отправляет назад подтверждение. Подтверждение отправляется в следующем Hello BPDU, которое будет отправлять коммутатор, выставлением флага Topology Change Acknowledgement (TCA).
  • Далее коммутаторы у которых порт работает в роли DP для сегмента, повторяют первые два шага и отправляют TCN через свой корневой порт и ждут подтверждения.
После того как корневой коммутатор получил TCN BPDU, он отправляет несколько следующих Hello с флагом TCA. Эти сообщения получают все коммутаторы. При получении сообщения hello с флагом TCA, коммутатор использует короткий таймер (Forward Delay time) для того чтобы обновить записи в таблице коммутации. Обновления выполняется из-за того, что после изменений в топологии STP в таблице коммутации могут храниться неправильные записи.

Если порт изменяет состояние с Blocking в Forwarding, то он должен пройти через два промежуточных состояния: Listening и Learning. Переход из Forwarding в Blocking может выполняться сразу.


RSTP (802.1w)

Роли портов:

  • Root
  • Designated
  • Alternate — альтернативный путь к корневому коммутатору. Путь отличается от того, который использует корневой порт.
  • Backup — запасной путь в сегмент.
Состояния портов:

  • Learning
  • Forwarding
  • Discarding

Отличия STP и RSTP

Соответствие между ролями портов в STP и RSTP:
Состояние в STP (802.1d)Состояние в RSTP (802.1w)
BlockingDiscarding
ListeningDiscarding
LearningLearning
ForwardingForwarding 


Флаги в BPDU

Коммутатор устанавливает флаг proposal в RSTP BPDU для того чтобы предложить себя на роль выделенного (designated) коммутатора в сегменте. Роль порта в proposal-сообщении всегда установлена в designated.
Коммутатор устанавливает флаг agreement в RSTP BPDU для того чтобы принять предыдущее предложение. Роль порта в agreement-сообщении всегда установлена в root.
В RSTP нет отдельного BPDU для анонсирования изменений в топологии (topology change notification (TCN)). Протокол использует флаг topology change (TC) для того чтобы указать на изменения. Однако, для совместимости с коммутаторами, которые используют 802.1D, коммутаторы использующие RSTP обрабатывают и генерируют TCN BPDU. 

The RSTP provides rapid convergence of the spanning tree through explicit handshaking that eliminates the IEEE 802.1D forwarding delay and quickly transitions root ports and designated ports to the forwarding state. 

The RSTP takes advantage of point-to-point wiring and provides rapid convergence of the spanning tree. Reconfiguration of the spanning tree can occur in less than 1 second (in contrast to 50 seconds with the default settings in the 802.1D spanning tree), which is critical for networks carrying delay-sensitive traffic such as voice and video.

Port Roles and the Active Topology

The RSTP provides rapid convergence of the spanning tree by assigning port roles and by determining the active topology. The RSTP builds upon the IEEE 802.1D STP to select the switch with the highest switch priority (lowest numerical priority value) as the root switch. Then the RSTP assigns one of these port roles to individual ports:

Root port—Provides the best path (lowest cost) when the switch forwards packets to the root switch.

Designated port—Connects to the designated switch, which incurs the lowest path cost when forwarding packets from that LAN to the root switch. The port through which the designated switch is attached to the LAN is called the designated port.

Alternate port—Offers an alternate path toward the root switch to that provided by the current root port.

Backup port—Acts as a backup for the path provided by a designated port toward the leaves of the spanning tree. A backup port can exist only when two ports are connected together in a loopback by a point-to-point link or when a switch has two or more connections to a shared LAN segment.

Disabled port—Has no role within the operation of the spanning tree.

A port with the root or a designated port role is included in the active topology. A port with the alternate or backup port role is excluded from the active topology.

In a stable topology with consistent port roles throughout the network, the RSTP ensures that every root port and designated port immediately transition to the forwarding state while all alternate and backup ports are always in the discarding state (equivalent to blocking in 802.1D). The port state controls the operation of the forwarding and learning processes.


 Rapid Convergence

The RSTP provides for rapid recovery of connectivity following the failure of a switch, a switch port, or a LAN. It provides rapid convergence for edge ports, new root ports, and ports connected through point-to-point links as follows:
Edge ports—If you configure a port as an edge port on an RSTP switch by using the spanning-tree portfast interface configuration command, the edge port immediately transitions to the forwarding state. An edge port is the same as a Port Fast-enabled port, and you should enable it only on ports that connect to a single end station.
Root ports—If the RSTP selects a new root port, it blocks the old root port and immediately transitions the new root port to the forwarding state.
Point-to-point links—If you connect a port to another port through a point-to-point link and the local port becomes a designated port, it negotiates a rapid transition with the other port by using the proposal-agreement handshake to ensure a loop-free topology.
As shown in Figure 15-2, Switch A is connected to Switch B through a point-to-point link, and all of the ports are in the blocking state. Assume that the priority of Switch A is a smaller numerical value than the priority of Switch B. Switch A sends a proposal message (a configuration BPDU) with the proposal flag set) to Switch B, proposing itself as the designated switch.
After receiving the proposal message, Switch B selects as its new root port the port from which the proposal message was received, forces all nonedge ports to the blocking state, and sends an agreement message (a BPDU with the agreement flag set) through its new root port.
After receiving Switch B's agreement message, Switch A also immediately transitions its designated port to the forwarding state. No loops in the network are formed because Switch B blocked all of its nonedge ports and because there is a point-to-point link between Switches A and B.
When Switch C is connected to Switch B, a similar set of handshaking messages are exchanged. Switch C selects the port connected to Switch B as its root port, and both ends immediately transition to the forwarding state. With each iteration of this handshaking process, one more switch joins the active topology. As the network converges, this proposal-agreement handshaking progresses from the root toward the leaves of the spanning tree.
The switch determines the link type from the port duplex mode: a full-duplex port is considered to have a point-to-point connection; a half-duplex port is considered to have a shared connection. You can override the default setting that is determined by the duplex setting by using the spanning-tree link-type interface configuration command. 




PVST (Cisco)

Per-VLAN Spanning Tree (PVST) — проприетарный протокол компании Cisco Systems, который для каждого VLAN строит отдельное дерево. Он предполагает использование ISL для создания транков (тегированных портов) и позволяет порту быть заблокированным для одних VLAN и разблокированным для других.

PVST+ (Cisco)

Per-VLAN Spanning Tree Plus (PVST+) — проприетарный протокол компании Cisco Systems, с функциональностью аналогичной PVST. Однако, вместо ISL он использует 802.1Q.
Различают два вида протокола PVST+:
  • PVST+ — основан на протоколе STP, с некоторыми проприетарными усовершенствованиями Cisco,
  • Rapid PVST+ — основан на протоколе RSTP.

PVST+

Проприетарные усовершенствования Cisco:
  • Backbone Fast Convergence — функция улучшает сходимость топологии spanning-tree из-за непрямых изменений топологии;
  • Loop Guard — функция проверяет, что корневой порт или альтернативный корневой порт получает BPDU. Если порт не получает BPDU, то loop guard переводит порт в состояние inconsistent, изолируя таким образом проблему и позволяя топологии spanning-tree перейти в другое состояние, до тех пор пока порт не начнет опять получать BPDU;
  • Portfast — функция позволяет порту пропустить состояния listening и learning и сразу же перейти в состояние forwarding. Настраивается на портах уровня доступа (там где подключены пользователи);
  • Portfast BPDU Guard — функция позволяет выключать порт при получении BPDU;
  • Root Guard — функция не позволяет порту стать корневым портом или заблокированным. Если порт получит BPDU от корневого коммутатора, то он перейдет в специальное заблокированное состояние, которое называется root-inconsistent;
  • Uplink Fast Convergence — функция позволяет быстро переключаться на избыточный uplink, в случае, если корневой порт выключился или пересчитывается топология spanning-tree;
  • Uplink Load Balancing — функция позволяет балансировать нагрузку между uplink-портами, непосредственно контролируя стоимость портов для VLAN на транковых (тегированых) портах. 

Источник http://xgu.ru/wiki/STP

среда, 5 октября 2011 г.

STP

Types of STP

STP was originally developed to operate in a bridged environment, basically supporting a single LAN (or one VLAN). Implementing STP into a switched environment has required additional consideration and modification to support multiple VLANs.



Common Spanning Tree

The IEEE 802.1Q standard specifies how VLANs are to be trunked between switches. It also specifies only a single instance of STP that encompasses all VLANs. This instance is referred to as the Common Spanning Tree (CST). All CST BPDUs are transmitted over trunk links using the native VLAN with untagged frames.

Having a single STP for many VLANs simplifies switch configuration and reduces switch CPU load during STP calculations. However, having only one STP instance can cause limitations, too. Redundant links between switches will be blocked with no capability for load balancing. Conditions also can occur that would cause CST to mistakenly enable forwarding on a link that does not carry a specific VLAN, whereas other links would be blocked.

Per-VLAN Spanning Tree

Cisco has a proprietary version of STP that offers more flexibility than the CST version.
Per-VLAN Spanning Tree (PVST) operates a separate instance of STP for each individual VLAN. This allows the STP on each VLAN to be configured independently, offering better performance and tuning for specific conditions. Multiple spanning trees also make load balancing possible over redundant links when the links are assigned to different VLANs. One link might forward one set of VLANs, while another redundant link might forward a different set.

Because of its proprietary nature, PVST requires the use of Cisco Inter-Switch Link (ISL) trunking encapsulation between switches. In networks where PVST and CST coexist, interoperability problems occur. Each requires a different trunking method, so BPDUs are never exchanged between STP types.

Per-VLAN Spanning Tree Plus

Cisco has a second proprietary version of STP that allows devices to interoperate with both PVST and CST. Per-VLAN Spanning Tree Plus (PVST+) effectively supports three groups of STP operating in the same campus network:

■ Catalyst switches running PVST
■ Catalyst switches running PVST+
■ Switches running CST over 802.1Q

To do this, PVST+ acts as a translator between groups of CST switches and groups of PVST switches. PVST+ can communicate directly with PVST by using ISL trunks. To communicate with CST, however, PVST+ exchanges BPDUs with CST as untagged frames over the native VLAN. BPDUs from other instances of STP (other VLANs) are propagated across the CST portions of the network by tunneling. PVST+ sends these BPDUs by using a unique multicast address so that the CST switches forward them on to downstream neighbors without interpreting them first. Eventually, the tunneled BPDUs reach other PVST+ switches where they are understood.


STP port state




STP Timers




Two types of BPDU exist:

■ Configuration BPDU, used for spanning-tree computation
■ Topology Change Notification (TCN) BPDU, used to announce changes in the net-
work topology


Topology Changes

To announce a change in the active network topology, switches send a TCN BPDU.

A topology change occurs when a switch either moves a port into the Forwarding state or moves a port from the Forwarding or Learning states into the Blocking state. In other words, a port on an active switch comes up or goes down. The switch sends a TCN BPDU out its root port so that, ultimately, the root bridge receives news of the topology change. Notice that the TCN BPDU carries no data about the change but informs recipients only that a change has occurred. Also notice that the switch will not send TCN BPDUs if the port has been configured with PortFast enabled.

Bridge ID




STP path cost





Sequence of four criteria that STP uses to choose a path:

1. Lowest bridge ID
2. Lowest root path cost
3. Lowest sender bridge ID
4. Lowest sender port ID


Tuning the Port ID

As an example, you can use the following command sequence to change the port priority of Gigabit Ethernet 3/16 from 128 (the default) to 64 for VLANs 10 and 100:

Switch(config)# interface gigabitethernet 3/16
Switch(config-if)# spanning-tree vlan 10,100 port-priority 64




Tuning the Root Path Cost


Switch (config-if)# spanning-tree [vlan vlan-id] cost cost


PortFast

Catalyst switches offer the PortFast feature, which shortens the Listening and Learning states to a negligible amount of time. When a workstation link comes up, the switch immediately moves the PortFast port into the Forwarding state. Spanning-tree loop detection is still in operation, however, and the port moves into the Blocking state if a loop is ever detected on the port.




UplinkFast: Access-Layer Uplinks

Consider an access-layer switch that has redundant uplink connections to two distribution-layer switches. Normally, one uplink would be in the Forwarding state and the other would be in the Blocking state. If the primary uplink went down, up to 50 seconds could elapse before the redundant uplink could be used.

The UplinkFast feature on Catalyst switches enables leaf-node switches or switches at the ends of the spanning-tree branches to have a functioning root port while keeping one or more redundant or potential root ports in Blocking mode. When the primary root port uplink fails, another blocked uplink immediately can be brought up for use.

When UplinkFast is enabled, it is enabled for the entire switch and all VLANs. UplinkFast works by keeping track of possible paths to the root bridge. Therefore, the command is not allowed on the root bridge switch. UplinkFast also makes some modifications to the local switch to ensure that it does not become the root bridge and that the switch is not used as a transit switch to get to the root bridge. In other words, the goal is to keep UplinkFast limited to leaf-node switches that are farthest from the root.

После включения UplinkFast на коммутаторе:

- приоритет увеличивается до 49152
- стоимость портов устанавливается равной 3000
- отслеживаются альтернативные корневые порты, на которых были получены сообщения hello от корневого коммутатора.

Если основной RP выходит из строя, то коммутатор сразу переключается на запасной и переводит его в состояние forward.
Кроме того, UplinkFast позволяет коммутаторам обновить записи в таблицах коммутации, без использования TCN. Вместо TCN коммутатор находит MAC-адреса всех локальных устройств и отправляет один multicast фрейм с каждым MAC-адресом в поле отправитель. Удаляются также остальные записи в таблицы коммутации самого коммутатора.


BackboneFast

Позволяет быстрее найти альтернативный путь, после изменения топологии. Для того чтобы функция работала, необходимо включить её на всех коммутаторах в сети.

sw(config)# spanning-tree backbonefast

Where PortFast and UplinkFast enable immediate transitions, BackboneFast can reduce the maximum convergence delay only from 50 to 30
seconds.




Permissible combinations on a switch port:
Loop guard and UDLD
Root guard and UDLD

Not permissible on a switch port:
Root guard and Loop guard
Root guard and BPDU guard