配置思路:
channel->VLAN->Trunk->STP->SVI->Vrrp->DHCP
1、 配置sw1、sw2的channel
Sw1:
[sw1]interface Eth-Trunk 0
[sw1-Eth-Trunk0]trunkport GigabitEthernet 0/0/1
[sw1-Eth-Trunk0]trunkport GigabitEthernet 0/0/2
Sw2:
[sw2]interface Eth-Trunk 0
[sw2-Eth-Trunk0]trunkport GigabitEthernet 0/0/1
[sw2-Eth-Trunk0]trunkport GigabitEthernet 0/0/2
2、 配置sw1、sw2、sw3、sw4的VLAN,并划入接口
Sw1:
[sw1]vlan 2
[sw1]interface Eth-Trunk 0
[sw1-Eth-Trunk0]port link-type trunk
[sw1-Eth-Trunk0]port trunk allow-pass vlan 2
[sw1]interface g0/0/3
[sw1-GigabitEthernet0/0/3]port hybrid tagged vlan 2
[sw1]interface GigabitEthernet 0/0/4
[sw1-GigabitEthernet0/0/4]port hybrid tagged vlan 2
Sw2:
[sw2]vlan 2
[sw2]interface Eth-Trunk 0
[sw2-Eth-Trunk0]port link-type trunk
[sw2-Eth-Trunk0]port trunk allow-pass vlan 2
[sw2]interface GigabitEthernet 0/0/3
[sw2-GigabitEthernet0/0/3]port hybrid tagged vlan 2
[sw2]interface GigabitEthernet 0/0/4
[sw2-GigabitEthernet0/0/4]port hybrid tagged vlan 2
Sw3:
[sw3]vlan 2
[sw3]interface GigabitEthernet 0/0/3
[sw3-GigabitEthernet0/0/3]port hybrid tagged vlan 2
[sw3]interface GigabitEthernet 0/0/4
[sw3-GigabitEthernet0/0/4]port hybrid tagged vlan 2
[sw3]interface GigabitEthernet 0/0/2
[sw3-GigabitEthernet0/0/2]port link-type access
[sw3-GigabitEthernet0/0/2]port default vlan 2
Sw4:
[sw4]vlan 2
[sw4]interface GigabitEthernet 0/0/3
[sw4-GigabitEthernet0/0/3]port hybrid tagged vlan 2
[sw4]interface GigabitEthernet 0/0/4
[sw4-GigabitEthernet0/0/4]port hybrid tagged vlan 2
[sw4]interface GigabitEthernet 0/0/2
[sw4-GigabitEthernet0/0/2]port link-type access
[sw4-GigabitEthernet0/0/2]port default vlan 2
3、 配置生成树协议
Sw1:
[sw1]stp enable
[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
[sw1]stp instance 1 root primary //主根
[sw1]stp instance 2 root secondary //备份
Sw2:
[sw2]stp enable
[sw2]stp region-configuration
[sw2-mst-region]region-name a
[sw2-mst-region]instance 1 vlan 1
[sw2-mst-region]instance 2 vlan 2
[sw2-mst-region]active region-configuration
[sw2]stp instance 2 root primary //主根
[sw2]stp instance 1 root secondary //备份
Sw3:
[sw3]stp enable
[sw3]stp region-configuration
[sw3-mst-region]region-name a
[sw3-mst-region]instance 1 vlan 1
[sw3-mst-region]instance 2 vlan 2
[sw3-mst-region]active region-configuration
Sw4:
[sw4]stp enable
[sw4]stp region-configuration
[sw4-mst-region]region-name a
[sw4-mst-region]instance 1 vlan 1
[sw4-mst-region]instance 2 vlan 2
[sw4-mst-region]active region-configuration
4、 配置svi
Sw1:
[sw1]int Vlan 1
[sw1-Vlanif1]ip address 172.16.10.1 24
[sw1]int Vlanif 2
[sw1-Vlanif2]ip address 172.16.20.1 24
Sw2:
[sw2]int Vlanif 1
[sw2-Vlanif1]ip address 172.16.10.2 24
[sw2]int Vlanif 2
[sw2-Vlanif2]ip address 172.16.20.2 24
5、 配置vrrp
Sw1:
[sw1]interface Vlanif 1
[sw1-Vlanif1]vrrp vrid 1 virtual-ip 172.16.10.254
[sw1-Vlanif1]vrrp vrid 1 priority 101
[sw1-Vlanif1]vrrp vrid 1 track interface GigabitEthernet 0/0/5
[sw1]int Vlanif 2
[sw1-Vlanif2]vrrp vrid 2 virtual-ip 172.16.20.254
[sw1-Vlanif2]vrrp vrid 2 track interface GigabitEthernet 0/0/5
Sw2:
[sw2]interface Vlanif 1
[sw2-Vlanif1]vrrp vrid 1 virtual-ip 172.16.10.254
[sw2-Vlanif1]vrrp vrid 1 track interface GigabitEthernet 0/0/5
[sw2]interface Vlanif 2
[sw2-Vlanif2]vrrp vrid 2 virtual-ip 172.16.20.254
[sw2-Vlanif2]vrrp vrid 2 priority 101
[sw2-Vlanif2]vrrp vrid 2 track interface GigabitEthernet 0/0/5
6、 配置DHCP
Sw1:
[sw1]dhcp enable
[sw1]ip pool v1
[sw1-ip-pool-v1]network 172.16.10.0 mask 24
[sw1-ip-pool-v1]gateway-list 172.16.10.254
[sw1-ip-pool-v1]dns-list 114.114.114.144
[sw1]ip pool v2
[sw1-ip-pool-v2]network 172.16.20.0 mask 24
[sw1-ip-pool-v2]gateway-list 172.16.20.254
[sw1-ip-pool-v2]dns-list 114.114.114.114
在接口上启用DHCP功能:
[sw1]int Vlanif 1
[sw1-Vlanif1]dhcp select global
[sw1]int Vlanif 2
[sw1-Vlanif1]dhcp select global
Sw2:
[sw2]dhcp enable
[sw2]ip pool v1
[sw2-ip-pool-v1]network 172.16.10.0 mask 24
[sw2-ip-pool-v1]gateway-list 172.16.10.254
[sw2-ip-pool-v1]dns-list 114.114.114.144
[sw2]ip pool v2
[sw2-ip-pool-v2]network 172.16.20.0 mask 24
[sw2-ip-pool-v2]gateway-list 172.16.20.254
[sw2-ip-pool-v2]dns-list 114.114.114.114
在接口上启用DHCP功能:
[sw2]int Vlanif 1
[sw2-Vlanif1]dhcp select global
[sw2]int Vlanif 2
[sw2-Vlanif1]dhcp select global
7、 核心层配置
Sw1:
[sw1]vlan 99
[sw1]int Vlanif 99
[sw1-Vlanif99]ip address 12.1.1.1 24
[sw1]int g0/0/5
[sw1-GigabitEthernet0/0/5]port link-type access
[sw1-GigabitEthernet0/0/5]port default vlan 99
[sw1]ip route-static 0.0.0.0 0 12.1.1.2
Sw2:
[sw2]vlan 99
[sw2]int Vlanif 99
[sw2-Vlanif99]ip address 12.1.2.1 24
[sw2]int g0/0/5
[sw2-GigabitEthernet0/0/5]port link-type access
[sw2-GigabitEthernet0/0/5]port default vlan 99
[sw2]ip route-static 0.0.0.0 0 12.1.2.2
R1:
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ip address 12.1.1.2 24
[r1-GigabitEthernet0/0/0]int g0/0/1
[r1-GigabitEthernet0/0/1]ip address 12.1.2.2 24
[r1]ip route-static 172.16.10.0 24 12.1.1.1
[r1]ip route-static 172.16.20.0 24 12.1.1.1
[r1]ip route-static 172.16.10.0 24 12.1.2.1
[r1]ip route-static 172.16.20.0 24 12.1.2.1
来源:oschina
链接:https://my.oschina.net/u/4408675/blog/4357923