SW1
[SW2]vlan 98
[SW2-vlan98]q
[SW2]interface Vlanif 98
[SW2-Vlanif98]ip address 192.168.2.2 24
[SW2-Vlanif98]q
[SW2]interface Ethernet0/0/1
[SW2-Ethernet0/0/1]port link-type access
[SW2-Ethernet0/0/1]port default vlan 98
SW2
[SW2]vlan 98
[SW2-vlan98]q
[SW2]interface Vlanif 98
[SW2-Vlanif98]ip address 192.168.2.2 24
[SW2-Vlanif98]q
[SW2]interface Ethernet0/0/1
[SW2-Ethernet0/0/1]port link-type access
[SW2-Ethernet0/0/1]port default vlan 98
SW1和SW2通讯问题 用RIP协议
[R1]rip 1
[R1-rip-1]version 2
[R1-rip-1]network 192.168.1.0
[R1-rip-1]network 192.168.2.0
[SW1]rip 1
[SW1-rip-1]version 2
[SW1-rip-1]network 192.168.1.0
[SW2]rip 1
[SW2-rip-1]version 2
[SW2-rip-1]network 192.168.2.0
以太网中继技术
[SW1]interface Eth-Trunk 0
[SW1-Eth-Trunk0]q
[SW1]interface Ethernet0/0/2
[SW1-Ethernet0/0/2]eth-trunk 0
[SW1-Ethernet0/0/2]interface Ethernet0/0/3
[SW1-Ethernet0/0/3]eth-trunk 0
[SW1-Ethernet0/0/3]q
[SW1]interface Eth-Trunk 0
[SW1-Eth-Trunk0]port link-type trunk
[SW1-Eth-Trunk0]port trunk allow-pass vlan all
SW2同样的配置
将PC2和PC4分别划入SW3和SW4中的vlan2中
[SW3]vlan 2
[SW3-vlan2]q
[SW3]interface Ethernet0/0/4
[SW3-Ethernet0/0/4]port link-type access
[SW3-Ethernet0/0/4]port default vlan 2
[SW4]vlan 2
[SW4]interface Ethernet0/0/4
[SW4-Ethernet0/0/4]port link-type access
[SW4-Ethernet0/0/4]port default vlan 2
将剩余8个接口都划入到trunk中
[SW1]interface Ethernet0/0/4
[SW1-Ethernet0/0/4]port link-type trunk
[SW1-Ethernet0/0/4]port trunk allow-pass vlan all
[SW1-Ethernet0/0/4]interface Ethernet0/0/5
[SW1-Ethernet0/0/5]port link-type trunk
[SW1-Ethernet0/0/5]port trunk allow-pass vlan all
在四台Switch上启用STP协议
[SW1]vlan 2
[SW1-vlan2]q
[SW1]stp enable
[SW1]stp mode mstp
[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
其余四台switch同样的配置
定义主根和副根
[SW1]stp instance 1 root primary
[SW1]stp instance 2 root secondary
[SW2]stp instance 1 root secondary
[SW2]stp instance 2 root primary
进入VRRP网段沉余阶段
[SW1]interface Vlanif 1
[SW1-Vlanif1]ip address 172.16.1.1 24
[SW2]interface Vlanif 2
[SW2-Vlanif2]ip address 172.16.1.2 24
[SW1]interface Vlanif 1
[SW1-Vlanif1]ip address 172.16.1.1 24
[SW1-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.250
[SW1-Vlanif1]vrrp vrid 1 priority 120
[SW1-Vlanif1]vrrp vrid 1 track interface Vlanif 99 reduced 30
[SW2]interface Vlanif 1
[SW2-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.250
配置DHCP
[SW1]ip pool xixi
[SW1-ip-pool-xixi]network 172.16.1.0 mask 24
[SW1-ip-pool-xixi]gateway-list 172.16.1.250
[SW1-ip-pool-xixi]dns-list 8.8.8.8
[SW1-ip-pool-xixi]q
[SW1]dhcp enable
[SW1]interface Vlanif 1
[SW1-Vlanif1]dhcp select global
[SW2]ip pool xixi
[SW2-ip-pool-xixi]network 172.16.1.0 mask 24
[SW2-ip-pool-xixi]gateway-list 172.16.1.250
[SW2-ip-pool-xixi]dns-list 8.8.8.8
[SW2-ip-pool-xixi]q
[SW2]dhcp enable
[SW2]interface Vlanif 1
[SW2-Vlanif1]dhcp select global
解决用户核心通讯
[SW1]rip 1
[SW1-rip-1]version 2
[SW1-rip-1]network 172.16.0.0
[SW2]rip 1
[SW2-rip-1]version 2
[SW2-rip-1]network 172.16.0.0