1.拓扑结构
2.配置IP在R1,sw1,sw2之间并启动 rip协议
3.SW1和SW2之间使用Eth-Trunk进行链路封装
[SW1]interface Eth-Trunk 0
[SW1-Eth-Trunk0]q
[SW1]interface Ethernet0/0/4
[SW1-Ethernet0/0/4]eth-trunk 0
[SW1-Ethernet0/0/4]interface Ethernet0/0/5
[SW1-Ethernet0/0/4]eth-trunk 0
[SW1-Ethernet0/0/4]q
[SW1]interface Eth-Trunk 0
[SW1-Eth-Trunk0]port link-type trunk
[SW1-Eth-Trunk0]port trunk allow-pass vlan all
![](https://i-blog.csdnimg.cn/blog_migrate/ee1734dd782a5042c8929f3285099fa5.png)
4.将交换机之间的链路化为trunk接口
[SW1]interface Ethernet0/0/4
[SW1-Ethernet0/0/3]port link-type trunk
[SW1-Ethernet0/0/3]port trunk allow-pass vlan all
[SW1-Ethernet0/0/3]interface Ethernet0/0/6
[SW1-Ethernet0/0/6]port link-type trunk
[SW1-Ethernet0/0/6]port trunk allow-pass vlan all
5.启用STP并定义主根与副根
[SW1]vlan 2
[SW1-vlan2]q
[SW1]stp enable
[SW1]stp mode mstp
[SW1]stp region-configuration
[SW1-mst-region]region-name hcip
[SW1-mst-region]instance 3 vlan 3
[SW1-mst-region]instance 2 vlan 2
[SW1-mst-region]active region-configuration
[SW1]stp instance 3 root primary
[SW1]stp instance 2 root secondary
[SW2]stp instance 3 root secondary
[SW2]stp instance 2 root primary
6.配置VRRP网关冗余 并启用DHCP
[SW1]interface vlan 3
[SW1-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.100
[SW1-Vlanif1]vrrp vrid 1 priority 101
[SW1-Vlanif1]vrrp vrid 1 track interface EigabitEthernet 0/0/1 reduced 10 10
[SW1-Vlanif1]q
[SW1]interface vlan 2
[SW1-Vlanif2]vrrp vrid 1 virtual-ip 172.16.2.100
[SW1-Vlanif2]q
[SW2]interface vlan 2
[SW2-Vlanif2]vrrp vrid 1 virtual-ip 172.16.2.100
[SW2-Vlanif2]vrrp vrid 1 priority 101
[SW2-Vlanif2]vrrp vrid 1 track interface GigabitEthernet 0/0/1
[SW2-Vlanif2]q
[SW2]interface vlan 3
[SW2-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.100
7.配置NAT访问ISP
[R1]ip route-static 0.0.0.0 0.0.0.0 GigabitEthernet 0/0/1 12.1.1.2
[R1]acl 2000
[R1-acl-basic-2000]rule 0 permit source 172.16.0.0 0.0.255.255
[R1-acl-basic-2000]q
[R1]interface GigabitEthernet 0/0/1
[R1-GigabitEthernet0/0/1]nat outbound 2000
8.测试