华为网工实验(VRRP多网关负载分担,OSPF基础操作)
采用VRRP多网关负载分担实现流量的负载均衡
配置思路:首先配置各个接口ip,让设备间能够实现通信,采用OSPF协议实现通信,然后AR2 AR3创建两个备份组,主备不同的两个备份组
组网图
#先设备命名并配置IP,三台设备类似,AR3要把g0/0/2也要加入到OSPF
sysname AR2
#
interface GigabitEthernet0/0/0
ip address 10.10.12.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.1.1.2 255.255.255.0
#AR2配置OSPF协议,并把两个接口添加到区域,AR3与AR2做类似操作
ospf 1
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 10.10.12.0 0.0.0.255
#
三台配置完成后此时可以验证OSPF的配置
#查看邻居状态
[AR2]dis ospf peer
OSPF Process 1 with Router ID 10.1.1.2
Neighbors
Area(邻居的区域) 0.0.0.0 interface(与邻居相连的接口) 10.1.1.2(GigabitEthernet0/0/1)'s neighbors
Router ID(邻居的Router ID): 10.1.1.3 Address(邻居接口地址): 10.1.1.3
State: Full(表示邻居状态建立完成) Mode:Nbr is Master(邻居是Master) Priority(邻居优先级): 1
DR(指定路由器): 10.1.1.2 BDR(备份指定路由器): 10.1.1.3 MTU(邻居接口的MTU值): 0
Dead timer due in 33 sec (Dean定时器在33秒后到期)
Retrans timer interval: 5 (传达LSA的时间间隔,以秒为单位)
Neighbor is up for 00:01:57 (邻居建立了多久)
Authentication Sequence: [ 0 ]
Neighbors
Area 0.0.0.0 interface 10.10.12.2(GigabitEthernet0/0/0)'s neighbors
Router ID: 10.10.12.1 Address: 10.10.12.1
State: Full Mode:Nbr is Master Priority: 1
DR: 10.10.12.2 BDR: 10.10.12.1 MTU: 0
Dead timer due in 39 sec
Retrans timer interval: 5
Neighbor is up for 00:01:43
Authentication Sequence: [ 0 ]
三台设备 OSPF配置完成后,然后开始配置备份组
备份组1:AR2-Master AR3-Backup
备份组2:AR1-Master AR2-Backup
#备份组1配置
# AR2:
interface GigabitEthernet0/0/1
vrrp vrid 1 virtual-ip 10.1.1.250 (备份组1的虚拟IP)
vrrp vrid 1 priority 120 (设置优先级,默认为100,高的为Master)
vrrp vrid 1 preempt-mode timer delay 30 (配置抢占时间为30s,默认为0,也就是立即抢占,Backup建议为0)
# AR3:
interface GigabitEthernet0/0/0
ip address 10.1.1.3 255.255.255.0
vrrp vrid 1 virtual-ip 10.1.1.250
#
#备份组2:
# AR3
interface GigabitEthernet0/0/0
vrrp vrid 2 virtual-ip 10.1.1.249
vrrp vrid 2 priority 120
vrrp vrid 2 preempt-mode timer delay 30
# AR2
interface GigabitEthernet0/0/1
vrrp vrid 2 virtual-ip 10.1.1.249
验证:
[AR2]DIS vrrp brief
Total:2 Master:1 Backup:1 Non-active:0
VRID State Interface Type Virtual IP
----------------------------------------------------------------
1 Master GE0/0/1 Normal 10.1.1.250
2 Backup GE0/0/1 Normal 10.1.1.249
设备PC配置