(1)配置eth-trunk
sw1:
[sw1]int e
[sw1]int Eth-Trunk 0
[sw1-Eth-Trunk0]q
[sw1]interface GigabitEthernet 0/0/4
[sw1-GigabitEthernet0/0/4]eth-trunk 0
[sw1-GigabitEthernet0/0/4]int g0/0/5
[sw1-GigabitEthernet0/0/5]eth-trunk 0
sw2同理
(2)配置trunk干道
sw1:
[sw1]port-group group-member g0/0/2 to g0/0/3 Eth-Trunk 0
[sw1-port-group]port link-type trunk
[sw1-port-group]port trunk allow-pass vlan 2 to 3
(3)vlan的创建和划分
(4)配置stp
[sw1]stp mode mstp
[sw1]stp enable
[sw1]stp re
[sw1]stp region-configuration
[sw1-mst-region]region-name a //创建组名
[sw1-mst-region]instance 1 vlan 1
[sw1-mst-region]instance 2 vlan 2
[sw1-mst-region]active region-configuration //激活配置
将组1的主根放在sw1 组2的主根放在sw2
[sw1]stp instance 1 root primary //设置为主根
[sw1]stp instance 2 root secondary //设置为副根
sw2与其相反即可
(5)配置svi
[sw1]interface vlan 1
[sw1-Vlanif1]ip address 172.16.1.1 25
[sw1]int vlan 2
[sw1-Vlanif2]ip address 172.16.1.129 25
sw2:
[sw2]int vlan 1
[sw2-Vlanif1]ip address 172.16.1.2 25
[sw2-Vlanif1]int vlan 2
[sw2-Vlanif2]ip address 172.16.1.130 25
配置冗余:
[sw1]int vlan 1
[sw1-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.126 //配置虚拟IP
[sw1-Vlanif1]vrrp vrid 1 priority 120 //提高优先级 做根
[sw1-Vlanif1]vrrp vrid 1 track interface g0/0/1 reduced 30 // 配置上行链路 当0/0/1阻塞时下调优先级
[sw1-Vlanif2]vrrp vrid 1 virtual-ip 172.16.1.254
(6)配置dhcp
[sw1]dhcp en
[sw1]dhcp enable
[sw1]ip pool v1
[sw1-ip-pool-v1]network 172.16.1.0 mask 25
[sw1-ip-pool-v1]gateway-list 172.16.1.126
[sw1-ip-pool-v1]dns-list 114.114.114.114 8.8.8.8
[sw1]ip pool v2
[sw1-ip-pool-v2]network 172.16.1.128 mask 25
[sw1-ip-pool-v2]gate
[sw1-ip-pool-v2]gateway-list 172.16.1.1
Error:The network section should be within the subnet of the pool.
[sw1-ip-pool-v2]
[sw1-ip-pool-v2]gateway-list 172.16.1.254
[sw1-ip-pool-v2]dns-list 114.114.114.114 8.8.8.8
//开启协议
[sw1]interface vlan 1
[sw1-Vlanif1]dhcp select global
[sw1-Vlanif1]int vlan 2
[sw1-Vlanif2]dhcp select global
实验结束