综合练习二
题目:
·范图:
- ·实现各网段的主机之间互通
- ·且走最优路径
配置思路:
实现此案例按照如下配置:
1)配置PC的IP地址和网关
2) 配置SW4/5的vlan为10/20/30/40/100/200,交换机之间的链路为Trunk,与PC间为Access
3)配置RSW1/2/3的vlan为10/20/30/40/100/200,交换机之间的链路为Trunk,与PC间为Access
·rsw1:
[rsw1]interface GigabitEthernet 0/0/1 [rsw1-GigabitEthernet0/0/1]port link-type access [rsw1-GigabitEthernet0/0/1]port default vlan 10 [rsw1-GigabitEthernet0/0/1]q 连接交换机的端口模式设置: [rsw1]port-group group-member g 0/0/12 g 0/0/21 [rsw1-port-group]port link-type trunk [rsw1-GigabitEthernet0/0/12]port link-type trunk [rsw1-GigabitEthernet0/0/21]port link-type trunk [rsw1-port-group]q [rsw1]port-group group-member g 0/0/12 g 0/0/21 [rsw1-port-group]port link-type trunk [rsw1-GigabitEthernet0/0/12]port link-type trunk [rsw1-GigabitEthernet0/0/21]port link-type trunk [rsw1-port-group]port trunk allow-pass vlan all [rsw1-GigabitEthernet0/0/12]port trunk allow-pass vlan all [rsw1-GigabitEthernet0/0/21]port trunk allow-pass vlan all [rsw1-port-group]q
- ·rsw2:
[rsw2]port-group group-member g 0/0/12 g 0/0/22 g 0/0/23 [rsw2-port-group]port link-type trunk [rsw2-GigabitEthernet0/0/12]port link-type trunk [rsw2-GigabitEthernet0/0/22]port link-type trunk [rsw2-GigabitEthernet0/0/23]port link-type trunk [rsw2-port-group]port trunk allow-pass vlan all [rsw2-GigabitEthernet0/0/12]port trunk allow-pass vlan all [rsw2-GigabitEthernet0/0/22]port trunk allow-pass vlan all [rsw2-GigabitEthernet0/0/23]port trunk allow-pass vlan all [rsw2-port-group]q
·rsw3:
[rsw3]int g 0/0/5 [rsw3-GigabitEthernet0/0/5]port link-type access [rsw3-GigabitEthernet0/0/5]port default vlan 40 [rsw3-GigabitEthernet0/0/5]q [rsw3]port-group group-member g 0/0/23 g 0/0/1 [rsw3-port-group]port link-type trunk [rsw3-GigabitEthernet0/0/23]port link-type trunk [rsw3-GigabitEthernet0/0/1]port link-type trunk [rsw3-port-group]port trunk allow-pass vlan all [rsw3-GigabitEthernet0/0/23]port trunk allow-pass vlan all [rsw3-GigabitEthernet0/0/1]port trunk allow-pass vlan all [rsw3-port-group]q
5)配置RSW1/2/3的vlanif接口IP地址及静态路由
- ·rsw1:
[rsw1]int vlanif 10 [rsw1-Vlanif10]ip address 192.168.10.254 24 //设置网关ip [rsw1-Vlanif10]int vlanif 100 [rsw1-Vlanif100]ip address 192.168.12.1 24
·rsw2:
[rsw2]int vlanif 100 [rsw2-Vlanif100]ip address 192.168.12.2 24 [rsw2-Vlanif100]int vlanif 200 [rsw2-Vlanif200]ip address 192.168.23.1 24 [rsw2-Vlanif200]int vlanif 20 [rsw2-Vlanif20]ip address 192.168.20.254 24 [rsw2-Vlanif20]q [rsw2]ip route-static 192.168.10.0 24 192.168.12.1 [rsw2]ip route-static 192.168.30.0 24 192.168.23.2 [rsw2]ip route-static 192.168.40.0 24 192.168.23.2
·rsw3:
[rsw3]int vlanif 30 [rsw3-Vlanif30]ip address 192.168.30.254 24 [rsw3-Vlanif30]int vlanif 40 [rsw3-Vlanif40]ip address 192.168.40.254 24 [rsw3-Vlanif40]int vlanif 200 [rsw3-Vlanif200]ip add 192.168.23.2 24 [rsw3-Vlanif200]q
6)配置 mstp 及对应的根交换机
- rsw1:
[rsw1]stp mode mstp //设置模式为mstp [rsw1]stp region-configuration //进入设置域 [rsw1-mst-region]region-name zh //设置域名 [rsw1-mst-region]instance 10 vlan 10 //设置实例,并加入对应vlan [rsw1-mst-region]instance 20 vlan 20 [rsw1-mst-region]instance 30 vlan 30 [rsw1-mst-region]instance 40 vlan 40 [rsw1-mst-region]active region-configuration //激活实例名 [rsw1]stp instance 10 priority 0 //设置实例10 的优先级,为根交换机
rsw2:
[rsw2]stp mode mstp [rsw2]stp region-configuration [rsw2-mst-region]region-name zh [rsw2-mst-region]instance 10 vlan 10 [rsw2-mst-region]instance 20 vlan 20 [rsw2-mst-region]instance 30 vlan 30 [rsw2-mst-region]instance 40 vlan 40 [rsw2-mst-region]active region-configuration [rsw2]stp instance 20 priority 0
rsw3:
[rsw3]stp mode mstp [rsw3]stp region-configuration [rsw3-mst-region]region-name zh [rsw3-mst-region]instance 10 vlan 10 [rsw3-mst-region]instance 20 vlan 20 [rsw3-mst-region]instance 30 vlan 30 [rsw3-mst-region]instance 40 vlan 40 [rsw3-mst-region]active region-configuration [rsw3]stp instance 30 priority 0 [rsw3]stp instance 40 priority 0
7)测试不同网段的PC连通性
8)查看命令
[rsw1]display current-configuration //查看设备所有配置 [rsw1]display stp //查看stp所有配置 [rsw1]display stp brief //查看stp简要配置 [rsw1]dispaly stp instance 10 brief //查看实例10 的简要配置 [rsw1]dis mac-address //查看Mac地址 [rsw1]display this //查看当前有效配置 <rsw1>save rsw1.zip //保存当前配置为rsw1.zip文件 <rsw1>dir //查看当前的文件