Конфигурация протокола Spanning Tree
Эта глава содержит полный пример конфигурации STP. STP предотвращает дублирование пакетов, устраняя петли в сети.
Топология
Следующий пример представляет собой простую топологию с несколькими bridges.
Рисунок 2-34: Топология STP
Примечание: Выполните команду switchport
на каждом порту, чтобы переключить его в режим уровня 2.
Конфигурации
Switch 1
Switch1#configure terminal | Перейти в режим конфигурации. |
Switch1(config)#bridge 1 protocol ieee | Добавить bridge (1) в таблицу spanning tree. |
Switch1(config)#interface eth2 | Перейти в режим интерфейса. |
Switch1(config-if)#bridge-group 1 | Ассоциировать интерфейс с bridge group 1 . |
Switch1(config-if)#exit | Выйти из режима интерфейса. |
Switch1(config)#interface eth3 | Перейти в режим интерфейса. |
Switch1(config-if)#bridge-group 1 | Ассоциировать интерфейс с bridge group 1 . |
Switch1(config-if)#exit | Выйти из режима интерфейса. |
Switch1(config)#interface eth4 | Перейти в режим интерфейса. |
Switch1(config-if)#bridge-group 1 | Ассоциировать интерфейс с bridge group 1 . |
Switch1(config-if)#exit | Выйти из режима интерфейса. |
Switch1(config)#interface eth5 | Перейти в режим интерфейса. |
Switch1(config-if)#bridge-group 1 | Ассоциировать интерфейс с bridge group 1 . |
Switch 2
Switch2#configure terminal | Перейти в режим конфигурации. |
Switch2(config)#bridge 2 protocol ieee | Добавить bridge (2) в таблицу spanning tree. |
Switch2(config)#interface eth2 | Перейти в режим интерфейса. |
Switch2(config-if)#bridge-group 2 | Ассоциировать интерфейс с bridge group 2 . |
Switch2(config-if)#exit | Выйти из режима интерфейса. |
Switch2(config)#interface eth3 | Перейти в режим интерфейса. |
Switch2(config-if)#bridge-group 2 | Ассоциировать интерфейс с bridge group 2 . |
Switch2(config-if)#exit | Выйти из режима интерфейса. |
Switch2(config)#interface eth4 | Перейти в режим интерфейса. |
Switch2(config-if)#bridge-group 2 | Ассоциировать интерфейс с bridge group 2 . |
Switch2(config-if)#exit | Выйти из режима интерфейса. |
Switch2(config)#interface eth5 | Перейти в режим интерфейса. |
Switch2(config-if)#bridge-group 2 | Ассоциировать интерфейс с bridge group 2 . |
Switch 4
Switch4#configure terminal | Перейти в режим конфигурации. |
Switch4(config)#bridge 4 protocol ieee | Добавить bridge (4) в таблицу spanning tree. |
Switch4(config)#interface eth2 | Перейти в режим интерфейса. |
Switch4(config-if)#bridge-group 4 | Ассоциировать интерфейс с bridge group 4 . |
Switch4(config-if)#exit | Выйти из режима интерфейса. |
Switch4(config)#interface eth3 | Перейти в режим интерфейса. |
Switch4(config-if)#bridge-group 4 | Ассоциировать интерфейс с bridge group 4 . |
Switch4(config-if)#exit | Выйти из режима интерфейса. |
Switch4(config)#interface eth4 | Перейти в режим интерфейса. |
Switch4(config-if)#bridge-group 4 | Ассоциировать интерфейс с bridge group 4 . |
Switch4(config-if)#exit | Выйти из режима интерфейса. |
Switch4(config)#interface eth5 | Перейти в режим интерфейса. |
Switch4(config-if)#bridge-group 4 | Ассоциировать интерфейс с bridge group 4 . |
Switch 3
Switch3#configure terminal | Перейти в режим конфигурации. |
Switch3(config)#bridge 3 protocol ieee | Добавить bridge (3) в таблицу spanning tree. |
Switch3(config)#interface eth2 | Перейти в режим инт ерфейса. |
Switch3(config-if)#bridge-group 3 | Ассоциировать интерфейс с bridge group 3 . |
Switch3(config-if)#exit | Выйти из режима интерфейса. |
Switch3(config)#interface eth3 | Перейти в режим интерфейса. |
Switch3(config-if)#bridge-group 3 | Ассоциировать интерфейс с bridge group 3 . |
Проверка
show spanning-tree, show spanning-tree interface \<if-name\>
Switch 1
#show spanning-tree
% 1: Bridge up - Spanning Tree Enabled - topology change detected
% 1: Root Path Cost 0 - Root Port 0 - Bridge Priority 32768
% 1: Forward Delay 15 - Hello Time 2 - Max Age 20 - Transmit Hold Count 6
% 1: Root Id 8000525400244323
% 1: Bridge Id 8000525400244323
% 1: last topology change Mon Mar 4 11:40:41 2022
% 1: 20 topology change(s) - last topology change Mon Mar 4 11:40:41 2022
% 1: portfast bpdu-filter disabled
% 1: portfast bpdu-guard disabled
% 1: portfast errdisable timeout disabled
% 1: portfast errdisable timeout interval 300 sec
% eth1: Port Number 3 - Ifindex 3 - Port Id 0x8003 - Role Designated - State Forwarding
% eth1: Designated Path Cost 0
% eth1: Configured Path Cost 20000 - Add type Explicit ref count 1
% eth1: Designated Port Id 0x8003 - Priority 128 -
% eth1: Root 8000525400244323
% eth1: Designated Bridge 8000525400244323
% eth1: Message Age 0 - Max Age 20
% eth1: Hello Time 2 - Forward Delay 15
% eth1: Forward Timer 0 - Msg Age Timer 0 - Hello Timer 0 - topo change timer 0
% eth1: forward-transitions 1
% eth1: Version Rapid Spanning Tree Protocol - Received RSTP - Send RSTP
% eth1: No portfast configured - Current portfast off
% eth1: bpdu-guard default - Current bpdu-guard off
% eth1: bpdu-filter default - Current bpdu-filter off
% eth1: no root guard configured - Current root guard off
% eth1: Configured Link Type point-to-point - Current point-to-point
% eth1: No auto-edge configured - Current port Auto Edge off
%
% eth2: Port Number 4 - Ifindex 4 - Port Id 0x8004 - Role Designated - State Forwarding
% eth2: Designated Path Cost 0
% eth2: Configured Path Cost 20000 - Add type Explicit ref count 1
% eth2: Designated Port Id 0x8004 - Priority 128 -
% eth2: Root 8000525400244323
% eth2: Designated Bridge 8000525400244323
% eth2: Message Age 0 - Max Age 20
% eth2: Hello Time 2 - Forward Delay 15
% eth2: Forward Timer 0 - Msg Age Timer 0 - Hello Timer 1 - topo change timer 0
% eth2: forward-transitions 1
% eth2: Version Rapid Spanning Tree Protocol - Received None - Send RSTP
% eth2: No portfast configured - Current portfast off
% eth2: bpdu-guard default - Current bpdu-guard off
% eth2: bpdu-filter default - Current bpdu-filter off
% eth2: no root guard configured - Current root guard off
% eth2: Configured Link Type point-to-point - Current point-to-point
% eth2: No auto-edge configured - Current port Auto Edge off
%
% eth3: Port Number 5 - Ifindex 5 - Port Id 0x8005 - Role Designated - State Forwarding
% eth3: Designated Path Cost 0
% eth3: Configured Path Cost 20000 - Add type Explicit ref count 1
% eth3: Designated Port Id 0x8005 - Priority 128 -
% eth3: Root 8000525400244323
% eth3: Designated Bridge 8000525400244323
% eth3: Message Age 0 - Max Age 20
% eth3: Hello Time 2 - Forward Delay 15
% eth3: Forward Timer 0 - Msg Age Timer 0 - Hello Timer 1 - topo change timer 0
% eth3: forward-transitions 1
% eth3: Version Rapid Spanning Tree Protocol - Received None - Send RSTP
% eth3: No portfast configured - Current portfast off
% eth3: bpdu-guard default - Current bpdu-guard off
% eth3: bpdu-filter default - Current bpdu-filter off
% eth3: no root guard configured - Current root guard off
% eth3: Configured Link Type point-to-point - Current point-to-point
% eth3: No auto-edge configured - Current port Auto Edge off
%
% eth4: Port Number 6 - Ifindex 6 - Port Id 0x8006 - Role Designated - State Forwarding
% eth4: Designated Path Cost 0
% eth4: Configured Path Cost 20000 - Add type Explicit ref count 1
% eth4: Designated Port Id 0x8006 - Priority 128 -
% eth4: Root 8000525400244323
% eth4: Designated Bridge 8000525400244323
% eth4: Message Age 0 - Max Age 20
% eth4: Hello Time 2 - Forward Delay 15
% eth4: Forward Timer 0 - Msg Age Timer 0 - Hello Timer 0 - topo change timer 0
% eth4: forward-transitions 1
% eth4: Version Rapid Spanning Tree Protocol - Received None - Send RSTP
% eth4: No portfast configured - Current portfast off
% eth4: bpdu-guard default - Current bpdu-guard off
% eth4: bpdu-filter default - Current bpdu-filter off
% eth4: no root guard configured - Current root guard off
% eth4: Configured Link Type point-to-point - Current point-to-point
% eth4: No auto-edge configured - Current port Auto Edge off
%
#
#show spanning-tree interface eth1
% 1: Bridge up - Spanning Tree Enabled - topology change detected
% 1: Root Path Cost 0 - Root Port 0 - Bridge Priority 32768
% 1: Forward Delay 15 - Hello Time 2 - Max Age 20 - Transmit Hold Count 6
% 1: Root Id 8000525400244323
% 1: Bridge Id 8000525400244323
% 1: last topology change Mon Mar 4 11:40:41 2022
% 1: 20 topology change(s) - last topology change Mon Mar 4 11:40:41 2022
% 1: portfast bpdu-filter disabled
% 1: portfast bpdu-guard disabled
% 1: portfast errdisable timeout disabled
% 1: portfast errdisable timeout interval 300 sec
% eth1: Port Number 3 - Ifindex 3 - Port Id 0x8003 - Role Designated - State Forwarding
% eth1: Designated Path Cost 0
% eth1: Configured Path Cost 20000 - Add type Explicit ref count 1
% eth1: Designated Port Id 0x8003 - Priority 128 -
% eth1: Root 8000525400244323
% eth1: Designated Bridge 8000525400244323
% eth1: Message Age 0 - Max Age 20
% eth1: Hello Time 2 - Forward Delay 15
% eth1: Forward Timer 0 - Msg Age Timer 0 - Hello Timer 1 - topo change timer 0
% eth1: forward-transitions 1
% eth1: Version Rapid Spanning Tree Protocol - Received RSTP - Send RSTP
% eth1: No portfast configured - Current portfast off
% eth1: bpdu-guard default - Current bpdu-guard off
% eth1: bpdu-filter default - Current bpdu-filter off
% eth1: no root guard configured - Current root guard off
% eth1: Configured Link Type point-to-point - Current point-to-point
% eth1: No auto-edge configured - Current port Auto Edge off #