VRRP知识点总结
VRRP 思维导图:
1.VRRP实验之一:三层交换机上配置
实验拓扑:
实验要求:
(1) 三台交换机上运行vlan 10 20
(2) 在LSW2 和 LSW3 交换机上面的三层接口配置VRRP
实验配置:
LSW1配置:
#
vlan batch 10 20
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 20
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 10
#
interface GigabitEthernet0/0/4
port link-type trunk
port trunk allow-pass vlan 2 to 4094
LSW2配置:
#
vlan batch 10 20
#
interface Vlanif10
ip address 192.168.10.252 255.255.255.0
vrrp vrid 10 virtual-ip 192.168.10.254
vrrp vrid 10 priority 120
#
interface Vlanif20
ip address 192.168.20.252 255.255.255.0
vrrp vrid 20 virtual-ip 192.168.20.254
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
LSW3配置:
#
vlan batch 10 20
#
interface Vlanif10
ip address 192.168.10.253 255.255.255.0
vrrp vrid 10 virtual-ip 192.168.10.254
#
interface Vlanif20
ip address 192.168.20.253 255.255.255.0
vrrp vrid 20 virtual-ip 192.168.20.254
vrrp vrid 20 priority 120
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
查看VRRP:
2.VRRP实验之一:监视上行链路
实验拓扑:
实验要求:在运行VRRP的接口上进行监视功能
实验配置:
AR1
[AR1-GigabitEthernet0/0/0]vrrp v 10 track interface g0/0/1 reduced/increased 50
#监视G0/0/1接口如果该接口的状态为Down,则减少/增加 50 的优先值,然后进行比较谁是Master
3.VRRP实验之一:路由器接口配置
实验拓扑图:
实验要求:
(1) 在接口G0/0/0上配置VRRP
(2) AR1的G0/0/0为Master
实验配置:
AR1
interface GigabitEthernet0/0/0
ip address 192.168.10.252 255.255.255.0
vrrp vrid 10 virtual-ip 192.168.10.254
vrrp vrid 10 priority 120
vrrp vrid 10 preempt-mode timer delay 60 #抢占的延迟时间设置为60s
AR2
interface GigabitEthernet0/0/0
ip address 192.168.10.253 255.255.255.0
vrrp vrid 10 virtual-ip 192.168.10.254
vrrp vrid 10 preempt-mode timer delay 60
查看VRRP:
4.VRRP实验之一:路由器子接口配置
实验拓扑图:
实验要求:
(1) 在三个交换机上面都设置VLAN 10 20
(2) 交换机LSW1 和 LSW2 两个交换机之间设置聚合链路Eth-Trunk 10
(3) 在路由器上面的G0/0/0接口处配置子接口的VRRP
(4) 路由器上面运行ospf,确保当G0/0/0接口出现问题的时候可以从G0/0/1接口过去到另外一个路由器上进行访问
实验配置:
交换机LSW3:
#
vlan bacth 10 20
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 10
#
interface GigabitEthernet0/0/4
port link-type access
port default vlan 20
交换机LSW1:
#
vlan batch 10 20
#
interface Eth-Trunk10 #创建聚合链路
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3
eth-trunk 10 #加入聚合链路中
#
interface GigabitEthernet0/0/4
eth-trunk 10
#
interface GigabitEthernet0/0/5
eth-trunk 10
交换机LSW2:
#
vlan batch 10 20
#
interface Eth-Trunk10 #创建聚合链路
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3
eth-trunk 10 #加入聚合链路中
#
interface GigabitEthernet0/0/4
eth-trunk 10
#
interface GigabitEthernet0/0/5
eth-trunk 10
#
interface GigabitEthernet0/0/0.10
dot1q termination vid 10 #该命令的作用是在此接口上终结tag是 VLAN 10 的报文(必敲)
dot1q vrrp vid 10 #该命令是以tag 10 来维护VRRP状态
ip address 192.168.10.252 255.255.255.0 #该子接口的IP
vrrp vrid 10 virtual-ip 192.168.10.254 #虚拟VRRP的IP
vrrp vrid 10 priority 120 #VRRP组的优先级,该优先级越大越优先
arp broadcast enable #开启ARP广播,使其获得终端的Mac和IP的对应关系
#
interface GigabitEthernet0/0/0.20
dot1q termination vid 20
dot1q vrrp vid 20
ip address 172.168.10.252 255.255.255.0
vrrp vrid 20 virtual-ip 172.168.10.254
arp broadcast enable
#
interface GigabitEthernet0/0/1
ip address 192.168.60.1 255.255.255.0
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 172.168.10.0 0.0.0.255 #把终端的网段net到ospf中,以便可以通过G0/0/1到另外一台路由器上面进行访问
network 192.168.10.0 0.0.0.255 #同上
network 192.168.60.0 0.0.0.255
路由器AR2:
#
interface GigabitEthernet0/0/0.10
dot1q termination vid 10 #该命令的作用是在此接口上终结tag是 VLAN 10 的报文(必敲)
dot1q vrrp vid 10 #该命令是以tag 10 来维护VRRP状态
ip address 192.168.10.253 255.255.255.0 #该子接口的IP
vrrp vrid 10 virtual-ip 192.168.10.254 #虚拟VRRP的IP
arp broadcast enable #开启ARP广播,使其获得终端的Mac和IP的对应关系
#
interface GigabitEthernet0/0/0.20
dot1q termination vid 20
dot1q vrrp vid 20
ip address 172.168.10.253 255.255.255.0
vrrp vrid 20 virtual-ip 172.168.10.254
vrrp vrid 20 priority 120 #VRRP组的优先级,该优先级越大越优先
arp broadcast enable
#
interface GigabitEthernet0/0/1
ip address 192.168.60.2 255.255.255.0
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 172.168.10.0 0.0.0.255 #把终端的网段net到ospf中,以便可以通过G0/0/1到另外一台路由器上面进行访问
network 192.168.10.0 0.0.0.255 #同上
network 192.168.60.0 0.0.0.255
查看两台路由器VRRP的状态:
AR1
AR2
根据优先级而相互成为Master和Backup
测试:
从两台路由器上能够访问到PC端