VRRP(Virtual Router Redundancy Protocol,虚拟路由冗余协议)是一种容错协议,通过物理设备和逻辑设备的分离,很好的实现了路由线路的备份功能! VRRP将局域网的一组路由器构成了一个备份组,相当于一台虚拟路由器, 局域网内的主机将自己的缺省路由下一跳设置为该虚拟路由器的IP地址. 网络中的主机通过这个虚拟路由器与其他网络进行通信.
本实验拓补图如下
:
本实验利用路由器实现vlan10, 20间的通信, 并且路由器R9,R12 相互备份. 图中SW1 SW2 实现链路聚合. 同时在SW1,SW2,SW3 上启用gvrp协议 实现vlan间的同步
SW1 配置如下:
[sw1]gvrp
Please wait........................................... Done.
[sw1]int e1/0/11
[sw1-Ethernet1/0/11]port link-type trunk ----------设置e1/0/11为 trunk
[sw1-Ethernet1/0/11]port trunk permit vlan all ---------- 允许所有vlan通过
Please wait........................................... Done.
[sw1]int e1/0/16
[sw1-Ethernet1/0/11]port link-type trunk
[sw1-Ethernet1/0/11]port trunk permit vlan all
Please wait........................................... Done.
[sw1]int e1/0/11
[sw1-Ethernet1/0/11]port link-type trunk
[sw1-Ethernet1/0/11]port trunk permit vlan all
Please wait........................................... Done.
[sw1-Ethernet1/0/11]gvrp
GVRP is enabled on port Ethernet1/0/11.
[sw1]link-aggregation group 1 mode manual ----------添加聚合组 1
[sw1]int e1/0/13
[sw1-Ethernet1/0/13]port link-type trunk
[sw1-Ethernet1/0/13]port trunk permit vlan all
Please wait........................................... Done.
[sw1-Ethernet1/0/13]gvrp
GVRP is enabled on port Ethernet1/0/13 ----------添加到聚合组 1
[sw1-Ethernet1/0/13]port link-aggregation group 1
[sw1]int e1/0/15
[sw1-Ethernet1/0/15]port link-type trunk
[sw1-Ethernet1/0/15]port trunk permit vlan all
Please wait........................................... Done.
[sw1-Ethernet1/0/15]gvrp
GVRP is enabled on port Ethernet1/0/15.
[sw1-Ethernet1/0/15]port link-aggregation group 1 ----------添加到聚合组 1
SW2 配置如下:
[sw2]gvrp
Please wait........................................... Done.
[sw2]link-aggregation group 1 mode manual
[sw2]int e1/0/13
[sw2-Ethernet1/0/13]port link-type trunk
[sw2-Ethernet1/0/13]port trunk permit vlan all
Please wait........................................... Done.
[sw2-Ethernet1/0/13]gvrp
GVRP is enabled on port Ethernet1/0/13.
[sw2-Ethernet1/0/13]port link-aggregation group 1
[sw2]int e1/0/15
[sw2-Ethernet1/0/15]port link-type trunk
[sw2-Ethernet1/0/15]port trunk permit vlan all
[sw2-Ethernet1/0/15]gvrp
GVRP is enabled on port Ethernet1/0/15.
Please wait........................................... Done.
[sw2-Ethernet1/0/15]port link-aggregation group 1
[sw2]vlan 10
[sw2-vlan10]port e1/0/4
[sw2]vlan 20
[sw2-vlan20]port e1/0/6
SW3 配置如下:
[sw3]gvrp
Please wait........................................... Done.
[sw3]int e1/0/11
[sw3-Ethernet1/0/11]port link-type trunk
[sw3-Ethernet1/0/11]port trunk permit vlan all
[sw3-Ethernet1/0/11]gvrp
GVRP is enabled on port Ethernet1/0/11.
Please wait........................................... Done.
[sw3]vlan 10
[sw3-vlan10]port e1/0/4
[sw3]vlan 20
[sw3-vlan20]port e1/0/6
R9 配置如下:
[R9]int e0.10
[R9-Ethernet0.10]vlan-type dot1q vid 10
R9-Ethernet0.10]ip add 192.168.10.1 24
%01:02:54: Line protocol ip on the interface Ethernet0.10 is UP
[R9-Ethernet0.10]vrrp vrid 10 virtual-ip 192.168.10.254 ---------设置虚拟IP
[R9-Ethernet0.20]vrrp vrip 10 priority 120 配置优先级 缺省100
[R9]int e0.20
[R9-Ethernet0.20]vlan-type dot1q vid 20
[R9-Ethernet0.20]ip add 192.168.20.1 24
%01:02:54: Line protocol ip on the interface Ethernet0.20 is UP
[R9-Ethernet0.20]vrrp vrid 20 virtual-ip 192.168.20.254
R9 VRRP配置结果如图:
R12 配置如下:
[R12]int e0.10
[R12-Ethernet0.10]vlan-type dot1q vid 10
[R12-Ethernet0.10]ip add 192.168.10.2 24
%01:02:54: Line protocol ip on the interface Ethernet0.10 is UP
[R12-Ethernet0.10]vrrp vrid 10 virtual-ip 192.168.10.254
[R12]int e0.20
[R12-Ethernet0.20]vlan-type dot1q vid 20
[R12-Ethernet0.20]ip add 192.168.20.2 24
%01:02:54: Line protocol ip on the interface Ethernet0.20 is UP
[R12-Ethernet0.20]vrrp vrid 20 virtual-ip 192.168.20.254
[R12-Ethernet0.20]vrrp vrip 20 priority 120
R12 VRRP 配置结果如图:
PC0 配置IP 192.168.10.100 网关 192.168.10.254
PC1 配置IP 192.168.20.100 网关 192.168.20.254
测试实验,PC0 ping PC1 同时拔出R12的连接线 查看R9 的VRRP 状态 结果如图
两个备份组 全变成Master
连接R12 的连接线 查看R9的VRRP 结果如图:
可以看出 R12 又获得了Ethernet0.20 的Master权限 成为了vlan 20 的主路由器
转载于:https://blog.51cto.com/zyfhlegend/658951