1、交换机

1)开启stp

stp enable

2)选择模式

stp mode mstp

3)将交换机之间的接口设置未trunk

int eth-trunk 1

port link-type trunk

port trunk allow-pass vlan all

int gigabitethernet0/0/1

eth-trunk 1

int gigabitethernet 0/0/2

eth-trunk 1

4)创建多vlan 

vlan batch 10 20 30 40 50

5)创建stp region-configuration

stp region-configuration //创建region-configuration

region-name gd //创建域名

revision-level 1 //配置等级

instance 1 vlan 10 //将实例1与vlan 10关联

instance 2 vlan 20 //将实例2与vlan 20关联

active region-configuration//激活

6)配置实例主从

stp instance 1 root primary//配置此交换机为instance1的主

stp instance 2 root secondary//配置此交换机为instance1的从

7)配置vlanif

int vlanif 10

ip address 10.1.1.1 24

int vlanif 20

ip address 20.1.1.1 24

int vlanif 30

ip address 30.1.1.1 24

int vlanif 40

ip address 40.1.1.1 24

8)配置vrrp(虚拟路由冗余协议)

interface Vlanif10

ip address 10.1.10.1 255.255.255.0

vrrp vrid 1 virtual-ip 10.1.10.254 //配置虚拟冗余协

vrrp vrid 1 priority 120 //默认优先级为100

vrrp vrid 1 preempt-mode timer delay 30 //切换延时为30秒

vrrp vrid 1 track interface GigabitEthernet0/0/3 reduced 30 //跟踪接口,发现问题接口优先级减去30

2、路由器配置

1)接口配置

int gigabitethernet0/0/1

ip address 30.1.1.2 24

2)配置ospf

ospf 100 router-id 1.1.1.1

default-route-advertise always type 1//为ospf添加一条默认路由

area 0

network 30.1.1.0 0.0.0.255

3)配置外部接口

int g0/0/0

ip address 100.1.1.2 24


acl number 2001

rule 5 permit source any


int g0/0/0

nat outbound 2001


ip route-static 0.0.0.0 0 100.1.1.1