天天看點

生成樹(MSTP)試驗生成樹(MSTP)試驗

生成樹(MSTP)試驗

拓撲圖

  • 實驗拓撲圖
    生成樹(MSTP)試驗生成樹(MSTP)試驗

實驗目标

  • 按圖示要求配置端口
  • 實作PC1,PC2,PC3,PC4和PC5互通

配置操作

  • 交換機sw1的配置
    [sw1]vlan batch 10 20 30 40
    Info: This operation may take a few seconds. Please wait for a moment...done.
    [sw1]int e0/0/1
    [sw1-Ethernet0/0/1]p l t               ### port link-type trunk簡寫
    [sw1-Ethernet0/0/1]p t a v a           ### port trunk all-pass vlan all
    [sw1-Ethernet0/0/1]int e0/0/2
    [sw1-Ethernet0/0/2]p l t
    [sw1-Ethernet0/0/2]p t a v a
    [sw1-Ethernet0/0/2]int e0/0/3
    [sw1-Ethernet0/0/3]p l t
    [sw1-Ethernet0/0/3]p t a v a
    [sw1-Ethernet0/0/3]int e0/0/4
    [sw1-Ethernet0/0/4]p l t
    [sw1-Ethernet0/0/4]p t a v a
    [sw1-Ethernet0/0/4]q
    [sw1]stp mode mstp
    [sw1]stp region-configuration
    [sw1-mst-region]region-name nrh
    [sw1-mst-region]revision-level 1
    [sw1-mst-region]instance 1 vlan 10 30        ### 将vlan10 和 30 加入insatnce 1
    [sw1-mst-region]instance 2 vlan 20 40        ### 将vlan20 和 49 加入instance 2
    [sw1-mst-region]active region-configuration
    Info: This operation may take a few seconds. Please wait for a moment...done.
    [sw1-mst-region]check region-configuration    ### 檢查配置
    Admin configuration
     Format selector    :0             
     Region name        :nrh             
     Revision level     :1
    
     Instance   VLANs Mapped
        0       1 to 9, 11 to 19, 21 to 29, 31 to 39, 41 to 4094
        1       10, 30
        2       20, 40
    [sw1-mst-region]q
    [sw1]stp instance 1 root primary      ### 将sw1設為insatnce 1的主根網橋
    [sw1]stp instance 2 root secondary    ### 将sw2設為insatnce 1的備份網橋
    [sw1]stp enable
    [sw1]dis stp b                        ### display stp brief 檢查配置結果
    MSTID  Port                        Role  STP State     Protection
     0    Ethernet0/0/1               DESI  FORWARDING      NONE
     0    Ethernet0/0/2               DESI  FORWARDING      NONE
     0    Ethernet0/0/3               DESI  FORWARDING      NONE
     0    Ethernet0/0/4               ROOT  FORWARDING      NONE
     1    Ethernet0/0/1               DESI  FORWARDING      NONE
     1    Ethernet0/0/2               DESI  FORWARDING      NONE
     1    Ethernet0/0/3               DESI  FORWARDING      NONE
     1    Ethernet0/0/4               DESI  FORWARDING      NONE
     2    Ethernet0/0/1               DESI  FORWARDING      NONE
     2    Ethernet0/0/2               DESI  FORWARDING      NONE
     2    Ethernet0/0/3               ROOT  FORWARDING      NONE
     2    Ethernet0/0/4               ALTE  DISCARDING      NONE
    [sw1]q
    <sw1>save                           ### 儲存配置
    The current configuration will be written to the device.
    Are you sure to continue?[Y/N]y
    Info: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]:
    Now saving the current configuration to the slot 0.
    Save the configuration successfully.           
  • 交換機sw2的配置
    [sw2]vlan batch 10 20 30 40
    Info: This operation may take a few seconds. Please wait for a moment...done.
    [sw2]int e0/0/1
    [sw2-Ethernet0/0/1]p l t
    [sw2-Ethernet0/0/1]p t a v a
    [sw2-Ethernet0/0/1]int e0/0/2
    [sw2-Ethernet0/0/2]p l t
    [sw2-Ethernet0/0/2]p t a v a
    [sw2-Ethernet0/0/2]int e0/0/3
    [sw2-Ethernet0/0/3]p l t
    [sw2-Ethernet0/0/3]p t a v a
    [sw2-Ethernet0/0/3]int e0/0/4
    [sw2-Ethernet0/0/4]p l t
    [sw2-Ethernet0/0/4]p t a v a
    [sw2-Ethernet0/0/4]q
    [sw2]stp mode mstp
    [sw2]stp region-configuration 
    [sw2-mst-region]region-name nrh
    [sw2-mst-region]revision-level 1
    [sw2-mst-region]instance 1 vlan 10 30
    [sw2-mst-region]instance 2 vlan 20 40
    [sw2-mst-region]active region-configuration 
    Info: This operation may take a few seconds. Please wait for a moment...done.
    [sw2-mst-region]check region-configuration 
    Admin configuration
     Format selector    :0             
     Region name        :nrh             
     Revision level     :1
    
     Instance   VLANs Mapped
        0       1 to 9, 11 to 19, 21 to 29, 31 to 39, 41 to 4094
        1       10, 30
        2       20, 40
    [sw2-mst-region]q
    [sw2]stp instance 1 root secondary 
    [sw2]stp instance 2 root primary 
    [sw2]stp enable
    [sw2]dis stp brief
    MSTID  Port                        Role  STP State     Protection
     0    Ethernet0/0/1               DESI  FORWARDING      NONE
     0    Ethernet0/0/2               DESI  FORWARDING      NONE
     0    Ethernet0/0/3               ALTE  DISCARDING      NONE
     0    Ethernet0/0/4               ROOT  FORWARDING      NONE
     1    Ethernet0/0/1               DESI  FORWARDING      NONE
     1    Ethernet0/0/2               DESI  FORWARDING      NONE
     1    Ethernet0/0/3               ROOT  FORWARDING      NONE
     1    Ethernet0/0/4               ALTE  DISCARDING      NONE
     2    Ethernet0/0/1               DESI  FORWARDING      NONE
     2    Ethernet0/0/2               DESI  FORWARDING      NONE
     2    Ethernet0/0/3               DESI  FORWARDING      NONE
     2    Ethernet0/0/4               DESI  FORWARDING      NONE
    [sw2]q
    <sw2>save
    The current configuration will be written to the device.
    Are you sure to continue?[Y/N]y
    Info: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]:
    Now saving the current configuration to the slot 0.
    Save the configuration successfully.           
  • 交換機sw3的配置
    [sw3]vlan batch 10 20 30 40
    Info: This operation may take a few seconds. Please wait for a moment...done.
    [sw3]int e0/0/3
    [sw3-Ethernet0/0/3]p l a              ### port link-type access 簡寫
    [sw3-Ethernet0/0/3]p d v 10           ### port default vlan 10
    [sw3-Ethernet0/0/3]int e0/0/4
    [sw3-Ethernet0/0/4]p l a
    [sw3-Ethernet0/0/4]p d v 20
    [sw3-Ethernet0/0/4]int e0/0/1
    [sw3-Ethernet0/0/1]p l t
    [sw3-Ethernet0/0/1]p t a v a
    [sw3-Ethernet0/0/1]int e0/0/2
    [sw3-Ethernet0/0/2]p l t
    [sw3-Ethernet0/0/2]p t a v a
    [sw3-Ethernet0/0/2]q
    [sw3]stp mode mstp
    [sw3]stp region-configuration
    [sw3-mst-region]region-name nrh
    [sw3-mst-region]revision-level 1
    [sw3-mst-region]instance 1 vlan 10 30
    [sw3-mst-region]instance 2 vlan 20 40
    [sw3-mst-region]active region-configuration
    Info: This operation may take a few seconds. Please wait for a moment...done.
    [sw3-mst-region]check region-configuration 
    Admin configuration
     Format selector    :0             
     Region name        :nrh             
     Revision level     :1
    
     Instance   VLANs Mapped
        0       1 to 9, 11 to 19, 21 to 29, 31 to 39, 41 to 4094
        1       10, 30
        2       20, 40
    [sw3-mst-region]q
    [sw3]stp enable 
    [sw3]dis stp brief
    MSTID  Port                        Role  STP State     Protection
     0    Ethernet0/0/1               ROOT  FORWARDING      NONE
     0    Ethernet0/0/2               ALTE  DISCARDING      NONE
     0    Ethernet0/0/3               DESI  FORWARDING      NONE
     0    Ethernet0/0/4               DESI  FORWARDING      NONE
     1    Ethernet0/0/1               ROOT  FORWARDING      NONE
     1    Ethernet0/0/2               ALTE  DISCARDING      NONE
     1    Ethernet0/0/3               DESI  FORWARDING      NONE
     2    Ethernet0/0/1               ALTE  DISCARDING      NONE
     2    Ethernet0/0/2               ROOT  FORWARDING      NONE
     2    Ethernet0/0/4               DESI  FORWARDING      NONE
    [sw3]q
    <sw3>save
    The current configuration will be written to the device.
    Are you sure to continue?[Y/N]y
    Info: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]:
    Now saving the current configuration to the slot 0.
    Save the configuration successfully.           
  • 交換機sw4的配置
    [sw4]vlan batch 10 20 30 40
    Info: This operation may take a few seconds. Please wait for a moment...done.
    [sw4]int e0/0/3
    [sw4-Ethernet0/0/3]p l a
    [sw4-Ethernet0/0/3]p d v 30
    [sw4-Ethernet0/0/3]int e0/0/4
    [sw4-Ethernet0/0/4]p l a
    [sw4-Ethernet0/0/4]p d v 40
    [sw4-Ethernet0/0/4]int e0/0/1
    [sw4-Ethernet0/0/1]p l t
    [sw4-Ethernet0/0/1]p t a v a
    [sw4-Ethernet0/0/1]int e0/0/2
    [sw4-Ethernet0/0/2]p l t
    [sw4-Ethernet0/0/2]p t a v a
    [sw4-Ethernet0/0/2]q
    [sw4]stp mode mstp
    [sw4]stp region-configuration
    [sw4-mst-region]region-name nrh
    [sw4-mst-region]revision-level 1
    [sw4-mst-region]instance 1 vlan 10 30
    [sw4-mst-region]instance 2 vlan 20 40
    [sw4-mst-region]active region-configuration
    Info: This operation may take a few seconds. Please wait for a moment...done.
    [sw4-mst-region]q
    [sw4]stp enable
    [sw4]dis stp brief
    MSTID  Port                        Role  STP State     Protection
     0    Ethernet0/0/1               ROOT  FORWARDING      NONE
     0    Ethernet0/0/2               ALTE  DISCARDING      NONE
     0    Ethernet0/0/3               DESI  FORWARDING      NONE
     0    Ethernet0/0/4               DESI  FORWARDING      NONE
     1    Ethernet0/0/1               ROOT  FORWARDING      NONE
     1    Ethernet0/0/2               ALTE  DISCARDING      NONE
     1    Ethernet0/0/3               DESI  FORWARDING      NONE
     2    Ethernet0/0/1               ALTE  DISCARDING      NONE
     2    Ethernet0/0/2               ROOT  FORWARDING      NONE
     2    Ethernet0/0/4               DESI  FORWARDING      NONE
    [sw4]q
    <sw4>save
    The current configuration will be written to the device.
    Are you sure to continue?[Y/N]y
    Info: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]:
    Now saving the current configuration to the slot 0.
    Save the configuration successfully.           
  • 三層交換機sw5的配置
    [sw5]vlan batch 10 20 30 40 100
    Info: This operation may take a few seconds. Please wait for a moment...done.
    [sw5]int g0/0/1
    [sw5-GigabitEthernet0/0/1]p l t
    [sw5-GigabitEthernet0/0/1]p t a v a
    [sw5-GigabitEthernet0/0/1]int g0/0/2
    [sw5-GigabitEthernet0/0/2]p l t
    [sw5-GigabitEthernet0/0/2]p t a v a
    [sw5-GigabitEthernet0/0/2]int g0/0/3
    [sw5-GigabitEthernet0/0/3]p l a
    [sw5-GigabitEthernet0/0/3]p d v 100
    [sw5-GigabitEthernet0/0/3]q
    [sw5]int vlanif 10                        ### 為每個虛接口配置各主機的網關ip位址
    [sw5-Vlanif10]ip address 192.168.10.1 24
    [sw5-Vlanif10]int vlanif 20
    [sw5-Vlanif20]ip address 192.168.20.1 24
    [sw5-Vlanif20]int vlanif 30
    [sw5-Vlanif30]ip address 192.168.30.1 24
    [sw5-Vlanif30]int vlanif 40
    [sw5-Vlanif40]ip address 192.168.40.1 24
    [sw5-Vlanif40]int vlanif 100
    [sw5-Vlanif100]ip address 10.0.0.1 24
    [sw5-Vlanif100]q
    [sw5]stp mode mstp
    [sw5]stp region-configuration
    [sw5-mst-region]region-name nrh
    [sw5-mst-region]revision-level 1
    [sw5-mst-region]instance 1 vlan 10 30
    [sw5-mst-region]instance 2 vlan 20 40
    [sw5-mst-region]active region-configuration
    Info: This operation may take a few seconds. Please wait for a moment...done.
    [sw5-mst-region]q
    [sw5]stp enable
    [sw5]dis stp b    
    [sw5]dis stp brief 
    MSTID  Port                        Role  STP State     Protection
     0    GigabitEthernet0/0/1        DESI  FORWARDING      NONE
     0    GigabitEthernet0/0/2        DESI  FORWARDING      NONE
     0    GigabitEthernet0/0/3        DESI  DISCARDING      NONE
     1    GigabitEthernet0/0/1        ROOT  FORWARDING      NONE
     1    GigabitEthernet0/0/2        DESI  DISCARDING      NONE
     2    GigabitEthernet0/0/1        DESI  DISCARDING      NONE
     2    GigabitEthernet0/0/2        ROOT  FORWARDING      NONE
    [sw5]ip route-s   
    [sw5]ip route-static 12.0.0.0 24 10.0.0.10   ### 配置通往PC5的靜态路由
    [sw5]q
    <sw5>save
    The current configuration will be written to the device.
    Are you sure to continue?[Y/N]y
    Info: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]:
    Now saving the current configuration to the slot 0.
    Save the configuration successfully.           
  • 路由器R1的配置
    [r1]int g0/0/0
    [r1-GigabitEthernet0/0/0]ip add 10.0.0.10 24
    [r1-GigabitEthernet0/0/0]int g0/0/1
    [r1-GigabitEthernet0/0/1]ip add 12.0.0.1 24
    [r1-GigabitEthernet0/0/1]q
    [r1]ip route-static 192.168.10.0 24 10.0.0.1      ### 配置PC5通往其他主機的靜态路由
    [r1]ip route-static 192.168.20.0 24 10.0.0.1
    [r1]ip route-static 192.168.30.0 24 10.0.0.1
    [r1]ip route-static 192.168.40.0 24 10.0.0.1
    [r1]q
    <r1>save
    The current configuration will be written to the device. 
    Are you sure to continue? (y/n)[n]:y
    It will take several minutes to save configuration file, please wait.......
    Configuration file had been saved successfully
    Note: The configuration file will take effect after being activated           

結果圖

  • 通信互通
    生成樹(MSTP)試驗生成樹(MSTP)試驗
生成樹(MSTP)試驗生成樹(MSTP)試驗
生成樹(MSTP)試驗生成樹(MSTP)試驗
生成樹(MSTP)試驗生成樹(MSTP)試驗

配置成功互通

  • 抓包檢視是否按設定線路傳輸(以PC1-->SW3-->SW1-->SW5為例檢視)
    生成樹(MSTP)試驗生成樹(MSTP)試驗
    • 抓包sw3的Ethernet 0/0/1口
    生成樹(MSTP)試驗生成樹(MSTP)試驗
    • 抓包sw5的GigabitEthernet 0/0/1口
    • 抓包sw3的Ethernet 0/0/2口

繼續閱讀