STP生成树综合配置
1.创建vlan10 20 30 40 pc相连端口设置access 加入vlan10 20 不参与生成树选举 禁用stp生成树
把3 ,4端口加入trunk 同意通过所有vlan
SW1 stp enable
sw1 stp mode mstp
- sw2和1相同设置
2.sw3创建vlan10 20 30 40 把三个端口全部设置trunk 同意通过所有的vlan e0/0/3设置禁用stp
3.r1 进入g0/0/0.1 0.2 0.3 0.4
dot1q termination vid 10 //子接口加入vlan编号
ip address 192.168.10.1 24 //设置ip地址
arp broadcast enable //打开ARP广播
打开g0/0/1设置ip
r2设定接口ip 设定为默认路由0.0.0.0 0.0.0.0 100.1.1.1
4.交换机设置mstp模式
5.配置生成树区域,设置区域名称,允许vlan10 20 通过
[sw1]stp enable
[sw1]stp mode mstp
[sw1]stp region-configuration
[sw1-mst-region]region-name test
[sw1-mst-region]instance 1 vlan 10 20
[sw1-mst-region]instance 2 vlan 30 40
[sw1-mst-region]active region-configuration //激活stp区域
6.指定每个区域根网桥 instance 1 :sw1 instance 2 :sw2
[sw1]stp instance 1 priority 4096
[sw1]stp instance 2 priority 8192
[sw2]stp instance 1 priority 8192
[sw2]stp instance 2 priority 4096
display stp brief
[S1]vlan batch 10 20 30 40 /创建vlan
Info: This operation may take a few seconds. Please wait for a moment...done.
[S1]int e0/0/1 /与PC接口设置acc模式并且禁用stp 因为这里不需要参与
[S1-Ethernet0/0/1]port link-type acces
[S1-Ethernet0/0/1]port default vlan 10
[S1-Ethernet0/0/1]stp disable
[S1-Ethernet0/0/1]int e0/0/2
[S1-Ethernet0/0/2]port link-type acces
[S1-Ethernet0/0/2]port default vlan 20
[S1-Ethernet0/0/2]stp disable
[S1-Ethernet0/0/2]q
[S1]port-group 1 /创建组 1
[S1-port-group-1]group-member e0/0/3 e0/0/4 //组加入接口
[S1-port-group-1]port link-type trunk //交换机之间设置TRUNK模式
[S1-Ethernet0/0/3]port link-type trunk
[S1-Ethernet0/0/4]port link-type trunk
[S1-port-group-1]port trunk allow-pass vlan all //允许所有VLAN通过
[S1-Ethernet0/0/3]port trunk allow-pass vlan all
[S1-Ethernet0/0/4]port trunk allow-pass vlan all
[S1]stp enable /交换机开启stp功能
[S1]stp mode mstp /设置STP模式为MSTP 默认就是但是最好重新设置一下
[S1]stp region-configuration /设置STP区域
[S1-mst-region]region-name abc /设置区域名称ABC
[S1-mst-region]instance 1 vlan 10 20 /区域1 允许通过vlan 10 20
[S1-mst-region]instance 2 vlan 30 40 /区域2 允许通过vlan 30 40
[S1-mst-region]active region-configuration /启用激活区域设置
Info: This operation may take a few seconds. Please wait for a moment...done.
[S1-mst-region]q
[S1]stp instance 1 priority 4096 //设置stp区域1优先级4096
[S1]stp instance 2 priority 8192 //设置stp区域2优先级 8192
[S1]dis stp brief /显示STP表
[S2]vlan batch 10 20 30 40
Info: This operation may take a few seconds. Please wait for a moment...done.
[S2]int e0/0/1
[S2-Ethernet0/0/1]port link-type acces
[S2-Ethernet0/0/1]port default vlan 30
[S2-Ethernet0/0/1]stp disable
[S2-Ethernet0/0/1]int e0/0/2
[S2-Ethernet0/0/2]port link-type access
[S2-Ethernet0/0/2]port default vlan 40
[S2-Ethernet0/0/2]stp disable
[S2-Ethernet0/0/2]q
[S2]port-group 1
[S2-port-group-1]group-member e0/0/3 e0/0/4
[S2-port-group-1]port link-type trunk
[S2-Ethernet0/0/3]port link-type trunk
[S2-Ethernet0/0/4]port link-type trunk
[S2-port-group-1]port trunk allow-pass vlan all
[S2-Ethernet0/0/3]port trunk allow-pass vlan all
[S2-Ethernet0/0/4]port trunk allow-pass vlan all
[S2-port-group-1]q
[S2]stp enable
[S2]stp mode mstp
[S2]stp region-configuration
[S2-mst-region]region-name abc
[S2-mst-region]instance 1 vlan 10 20
[S2-mst-region]instance 2 vlan 30 40
[S2-mst-region]active region-configuration
Info: This operation may take a few seconds. Please wait for a moment...done.
[S2-mst-region]q
[S2]stp instance 1 priority 8192
[S2]stp instance 2 priority 4096
[S2]dis stp brief
[S3]vlan batch 10 20 30 40
Info: This operation may take a few seconds. Please wait for a moment...done.
[S3]port-group 1
[S3-port-group-1]group-member e0/0/1 e0/0/2
[S3-port-group-1]port link-type trunk
[S3-Ethernet0/0/1]port link-type trunk
[S3-Ethernet0/0/2]port link-type trunk
[S3-port-group-1]port trunk allow-pass vlan all
[S3-Ethernet0/0/1]port trunk allow-pass vlan all
[S3-Ethernet0/0/2]port trunk allow-pass vlan all
[S3-port-group-1]q
[S3]int e0/0/3
[S3-Ethernet0/0/3]port link-type trunk
[S3-Ethernet0/0/3]port trunk allow-pass vlan all
[S3-Ethernet0/0/3]stp disable
[S3]stp enable
[S3]stp mode mstp
[S3]stp region-configuration
[S3-mst-region]region-name abc
[S3-mst-region]instance 1 vlan 10 20
[S3-mst-region]instance 2 vlan 30 40
[S3-mst-region]active region-configuration
Info: This operation may take a few seconds. Please wait for a moment...done.
[S3]dis stp brief
[R1]int g0/0/0.1
[R1-GigabitEthernet0/0/0.1]dot1q termination vid 10
[R1-GigabitEthernet0/0/0.1]ip add 192.168.10.1 24
[R1-GigabitEthernet0/0/0.1]arp broadcast enable
[R1-GigabitEthernet0/0/0.1]int g0/0/0.2
[R1-GigabitEthernet0/0/0.2]dot1q termination vid 20
[R1-GigabitEthernet0/0/0.2]ip add 192.168.20.1 24
[R1-GigabitEthernet0/0/0.2]arp broadcast enable
[R1-GigabitEthernet0/0/0.2]int g0/0/0.3
[R1-GigabitEthernet0/0/0.3]dot1q termination vid 30
[R1-GigabitEthernet0/0/0.3]ip add 192.168.30.1 24
[R1-GigabitEthernet0/0/0.3]arp broadcast enable
[R1-GigabitEthernet0/0/0.3]int g0/0/0.4
[R1-GigabitEthernet0/0/0.4]dot1q termination vid 40
[R1-GigabitEthernet0/0/0.4]ip add 192.168.40.1 24
[R1-GigabitEthernet0/0/0.4]arp broadcast enable
[R1-GigabitEthernet0/0/0.4]q
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 100.1.1.1 24
[R1-GigabitEthernet0/0/1]q
来源:oschina
链接:https://my.oschina.net/u/4345458/blog/4315526