STP

Catalyst2台とHP2530を1台を使ってSTPを再現します。

## 環境
* Cisco WS-C3560CG-8PC-S 12.2(55)EX3
* HP2530 YB.16.10.0011

## i/fの情報
役割(Role)の意味
* Root：ルートポート
* Desg：指定ポート
* Altn：非指定ポート

状態(Sts)の意味
* FWD：フォワーディング
* LIS：リスニング
* LRN：ラーニング
* BLK：ブロッキング

# 構成イメージ図
<img width="700" alt="stpイメージ図.jpg" src="https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2929519/d58401b3-1d0e-ee79-a9e4-1af6f787943e.jpeg">

# HP2530設定
ブリッジプライオリティを12288(4096×3)に変更。
3台の内、最もプライオリティの値を大きくすることで、このスイッチのポート3をブロッキングになるように設定。
```
HP2530(config)# spanning-tree vlan 50 priority 3
```
```php:HP2530(config)# show running-config 
 Running configuration:

 ; J9779A Configuration Editor; Created on release #YB.16.10.0011
 ; Ver #14:41.44.00.04.19.02.13.98.82.34.61.18.28.c3.84.9c.63.ff.37.27:35
 hostname "HP2530"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 vlan 1
    name "DEFAULT_VLAN"
    no untagged 1-2
    untagged 3-28
 -- MORE --, next page: Space, next line: Enter, quit: Control-C  ip address dhcp-bootp
    exit
 vlan 15
    name "Radius"
    untagged 2
    no ip address
    exit
 vlan 40
    name "hoge"
    untagged 1
    ip address 192.0.2.1 255.255.255.0
    exit
 vlan 50
    name "STP_test"
    tagged 3-4
    no ip address
    exit
 spanning-tree
 spanning-tree mode rapid-pvst
 spanning-tree vlan 50 priority 3
 no tftp server
 loop-protect 3-4 receiver-action no-disable
 loop-protect transmit-interval 10 disable-timer 60
 -- MORE --, next page: Space, next line: Enter, quit: Control-Cno dhcp config-file-update
 no dhcp image-file-update
 no dhcp tr69-acs-url
```

```php:HP2530(config)# show spanning-tree vlan 50
  Spanning Tree Information
 
   STP Enabled              [No] : Yes
   Mode                          : RPVST               
   Extended System ID            : Enabled             
   Ignore PVID Inconsistency     : Disabled            
   Switch MAC Address            : 1402ec-1de4a0
 
 
   VLAN ID                       : 50   
   RPVST Enabled                 : Enabled             
 
 
   Root MAC Address              : 34a84e-da1680       
   Root Priority                 : 0                   
   Root Path Cost                : 200,000             
   Root Port                     : 4                   
   Operational Hello Time (secs) : 2                   
   Topology Change Count         : 16                  
   Time Since Last Change        : 2 mins              
 
 
 -- MORE --, next page: Space, next line: Enter, quit: Control-C  Root Inconsistent Ports       :                                         
   Loop Inconsistent Ports       :                                         
   PVID Inconsistent Ports       :                                          
                                                              Designated    
   Port  Type       Cost      Priority  Role       State      Bridge        
   ----- ---------- --------- --------- ---------- ---------- ---------------
   3     10/100TX   200000    128       Alternate  Blocking   34a84e-6e7800  
   4     10/100TX   200000    128       Root       Forwarding 34a84e-da1680
```

# Catalyst1設定
ルートブリッジになるように設定
```
Switch123(config)#spanning-tree vlan 50 priority 0
```

```php:Switch123#show spanning-tree vlan 50
 
 VLAN0050
   Spanning tree enabled protocol ieee
   Root ID    Priority    50
              Address     34a8.4eda.1680
              This bridge is the root
              Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
 
   Bridge ID  Priority    50     (priority 0 sys-id-ext 50)
              Address     34a8.4eda.1680
              Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
              Aging Time  15  sec
 
 Interface           Role Sts Cost      Prio.Nbr Type
 ------------------- ---- --- --------- -------- --------------------------------
 Gi0/4               Desg FWD 4         128.4    P2p 
 Gi0/6               Desg FWD 19        128.6    P2p 
```

# Catalyst2設定
プライオリティが4096になるように設定(正確には4096+VLAN番号50=4146になる)
```
Switch456(config)#spanning-tree vlan 50 priority 4096
```

```php:Switch456#show spanning-tree vlan 50
 
 VLAN0050
   Spanning tree enabled protocol ieee
   Root ID    Priority    50
              Address     1402.ec1d.e4a0
              Cost        19
              Port        3 (GigabitEthernet0/3)
              Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
 
   Bridge ID  Priority    4146   (priority 4096 sys-id-ext 50)
              Address     34a8.4e6e.7800
              Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
              Aging Time  300 sec
 
 Interface           Role Sts Cost      Prio.Nbr Type
 ------------------- ---- --- --------- -------- --------------------------------
 Gi0/2               Desg FWD 4         128.2    P2p 
 Gi0/3               Root FWD 19        128.3    P2p
```