拓扑图:
1.端口配置启用trunk
[sw1]int g0/0/1
[sw1-GigabitEthernet0/0/1]por l t
[sw1-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[sw1-GigabitEthernet0/0/1]int g0/0/2
[sw1-GigabitEthernet0/0/2]port link-type trunk
[sw1-GigabitEthernet0/0/2]port tr a vlan all [sw 2]vlan ba 12 13
[sw 2]int g0/0/1
[sw 2-GigabitEthernet0/0/1]port l t
[sw 2-GigabitEthernet0/0/1]port t a v a
[sw 2-GigabitEthernet0/0/1]int g0/0/2
[sw 2-GigabitEthernet0/0/2]port l t
[sw 2-GigabitEthernet0/0/2]port t a v a[sw 3]vlan ba 12 13
[sw 3]int g0/0/3
[sw 3-GigabitEthernet0/0/3]port l t
[sw 3-GigabitEthernet0/0/3]port t a v a
[sw 3-GigabitEthernet0/0/3]int g0/0/2
[sw 3-GigabitEthernet0/0/2]port l t
[sw 3-GigabitEthernet0/0/2]port t a v a2.接入层划分vlan
//R3 接口划分vlan
[sw 3-GigabitEthernet0/0/4]port l a
[sw 3-GigabitEthernet0/0/4]port d v 12
[sw 3-GigabitEthernet0/0/4]int g0/0/1
[sw 3-GigabitEthernet0/0/1]po l a
[sw 3-GigabitEthernet0/0/1]po d v 13//保证心跳线接口联通 (防止STP生成树 关闭接口)
[sw1]stp root primary
[sw 2]stp root secondary 3.配置接口 ip
[sw1]int vlan 12
[sw1-Vlanif12]ip add 12.0.0.1 24
[sw1-Vlanif12]int vlan 13
[sw1-Vlanif13]ip add 13.0.0.1 24[sw 2]int vlan 12
[sw 2-Vlanif12]ip add 12.0.0.2 24
[sw 2-Vlanif12]int vlan 13
[sw 2-Vlanif13]ip add 13.0.0.2 244.配置 VRRP
[sw1]int vlan 12
[sw1-Vlanif12]vrrp vrid 12 virtual-ip 12.0.0.12
[sw1-Vlanif12]vrrp vrid 12 priority 105 // //默认100 值大者为master,当主设备宕机优先级降10,因此设置成105
[sw1-Vlanif12]int vlan 13
[sw1-Vlanif13]vrrp vrid 13 virtual-ip 13.0.0.13[sw 2]int vlan 12
[sw 2-Vlanif12]vrrp vrid 12 virtual-ip 12.0.0.12
[sw 2-Vlanif12]int vlan 13
[sw 2-Vlanif13]vrrp vrid 13 virtual-ip 13.0.0.13
[sw 2-Vlanif13]vrrp vrid 13 priority 105dis vrrp bref //查看vrrp状态