實驗3-1
學習目標
- 掌握啟用和禁用STP的方法
- 掌握修改交換機STP模式的方法
- 掌握修改橋優先級,控制根橋選舉的方法
- 掌握端口優先級,控制根端口和指定端口選舉的方法
- 掌握修改端口開銷,控制根端口和指定端口選舉的方法
- 掌握邊緣端口的配置方法
Notes
{width="4.166666666666667in" height="2.0563276465441818in"}
{width="4.166666666666667in" height="2.988134295713036in"}
拓撲圖
{width="4.166666666666667in" height="1.0602679352580928in"}
CLI
步驟一、配置STP並驗證
[s2]undo info-center enable //關閉提示
關閉無關端口(shutdown命令)
在S1和S2上啟用STP,並把S1配置為根橋
[s1]stp mode stp
[s1]stp root primary
[s2]stp mode stp
[s2]stp root secondary
執行display stp brief命令查看STP信息
<s1>display stp brief
執行display stp interface命令查看端口的STP狀態
<s1>display stp interface GigabiEthernet 0/0/10
步驟二、控制根橋選舉
執行display stp命令查看根橋信息
<s1>display stp
通過配置優先級,是s2為根橋,s1為備份根橋。把s1和s2的優先級分別設置為8192和4096
[s1]undo stp root
[s1]stp priority 8192
[s2]undo stp root
[s2]stp priority 4096
查看新的根橋信息
<s1>display stp
步驟三、控制跟端口選舉
修改s2的端口優先級,使s1的g0/0/10成為根端口
[s2]int g0/0/9
[s2-g0/0/9]stp port priority 32
[s2-g0/0/9]quit
[s2]int g0/0/10
[s2-g0/0/10]stp port priority 16
修改s1的g0/0/9端口開銷為200000,使s1的g0/0/10成為根端口
[s1]int g0/0/9
[s1-g0/0/9]stp cost 200000
實驗3-2
學習目標
掌握啟用和禁用RSTP的配置方法
掌握邊緣端口的配置方法
掌握RSTP BPDU保護功能的配置方法
掌握RSTP環路保護功能的配置方法
Notes
{width="4.166666666666667in" height="1.6479319772528433in"}
拓撲圖
{width="4.166666666666667in" height="1.1384339457567805in"}
CLI
步驟一、配置RSTP並驗證RSTP配置
[s1]stp mode rstp
[s2]stp mode rstp
[s1]display stp //查看RSTP簡要信息
步驟二、配置邊緣端口
[s1]int g0/0/1
[s1-g0/0/1]undo shutdown
[s1-g0/0/1]stp edged-port enable
[s2]int g0/0/1
[s2-g0/0/1]undo shutdown
[s2-g0/0/1]stp edged-port enable //s1和s2的g0/0/1端口和路由器連接配置為邊緣端口
步驟三、配置BPDU保護模式(防止偽造BPDU攻擊)
[s1]stp bpdu-protection
[s2]stp bpdu-protection
[s1]display stp brief //查看端口配置保護功能
步驟四、配置環路保護功能
如果由於鏈路擁塞或者單向鏈路故障導致交換機收不到來自上游設備的BPDU報文,交換機會重新選擇根端口。原先的根端口會變成指定端口,而原先的阻塞端口會遷移到轉發狀態,從而引起網絡環路。可以在交換機上配置環路保護功能,避免此種情況發生。
[s2]int g0/0/9
[s2-g0/0/9]stp loop-protection
[s2-g0/0/9]quit
[s2]int g0/0/10
[s2-g0/0/10]stp loop-protection //s2的g0/0/9和g0/0/10分別為Root Port和Alternate Port
[s2]display stp brief //查看配置
s1是根橋,s1上的所有端口都是指定端口,無需配置環路保護