华为路由器配置命令详解及实例_华为路由器配置VRRP主备备份详解

一、组网需求:

如图所示,HostA通过Switch双归属到RouterA和RouterB。用户希望实现:

  • 正常情况下,主机以RouterA为默认网关接入Internet,当RouterA故障时,RouterB接替作为网关继续进行工作,实现网关的冗余备份。
  • RouterA故障恢复后,可以重新成为网关。
a326285e3a20d9994b607b22570f2e15.png

配置VRRP主备备份组网图

二、配置思路:

采用VRRP主备备份实现网关冗余备份,配置思路如下:

  1. 配置各设备接口IP地址及路由协议,使各设备间网络层连通。
  2. 在RouterA和RouterB上配置VRRP备份组。其中,RouterA上配置较高优先级和20秒抢占延时,作为Master设备承担流量转发;RouterB上配置较低优先级,作为备用路由器,实现网关冗余备份。
三、操作步骤
  1. 配置设备间的网络互连

# 配置设备各接口的IP地址,以RouterA为例。RouterB和RouterC的配置与RouterA类似,详见配置文件。

system-view [Huawei] sysname RouterA [RouterA] interface gigabitethernet 2/0/0 [RouterA-GigabitEthernet2/0/0] ip address 10.1.1.1 24 [RouterA-GigabitEthernet2/0/0] quit [RouterA] interface gigabitethernet 1/0/0 [RouterA-GigabitEthernet1/0/0] ip address 192.168.1.1 24 [RouterA-GigabitEthernet1/0/0] quit

# 配置RouterA、RouterB和RouterC间采用OSPF协议进行互连。以RouterA为例,RouterB和RouterC的配置与RouterA类似,详见配置文件。

[RouterA] ospf 1 [RouterA-ospf-1] area 0 [RouterA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255 [RouterA-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255 [RouterA-ospf-1-area-0.0.0.0] quit [RouterA-ospf-1] quit
  1. 配置VRRP备份组

# 在RouterA上创建VRRP备份组1,配置RouterA在该备份组中的优先级为120,并配置抢占时间为20秒。

[RouterA] interface gigabitethernet 2/0/0 [RouterA-GigabitEthernet2/0/0] vrrp vrid 1 virtual-ip 10.1.1.111 [RouterA-GigabitEthernet2/0/0] vrrp vrid 1 priority 120 [RouterA-GigabitEthernet2/0/0] vrrp vrid 1 preempt-mode timer delay 20 [RouterA-GigabitEthernet2/0/0] quit

# 在RouterB上创建VRRP备份组1,其在该备份组中的优先级为缺省值100。

[RouterB] interface gigabitethernet 2/0/0 [RouterB-GigabitEthernet2/0/0] vrrp vrid 1 virtual-ip 10.1.1.111 [RouterB-GigabitEthernet2/0/0] quit
  1. 验证配置结果

# 完成上述配置以后,在RouterA和RouterB上分别执行display vrrp命令,可以看到RouterA在备份组中的状态为Master,RouterB在备份组中的状态为Backup。

[RouterA] display vrrp GigabitEthernet2/0/0 | Virtual Router 1 State : Master Virtual IP : 10.1.1.111 Master IP : 10.1.1.1 PriorityRun : 120 PriorityConfig : 120 MasterPriority : 120 Preempt : YES Delay Time : 20 s TimerRun : 1 s TimerConfig : 1 s Auth type : NONE Virtual MAC : 0000-5e00-0101 Check TTL : YES Config type : normal-vrrp Backup-forward : disabled Create time : 2012-05-11 11:39:18 Last change time : 2012-05-26 11:38:58 [RouterB] display vrrp GigabitEthernet2/0/0 | Virtual Router 1 State : Backup Virtual IP : 10.1.1.111 Master IP : 10.1.1.1 PriorityRun : 100 PriorityConfig : 100 MasterPriority : 120 Preempt : YES Delay Time : 0 s TimerRun : 1 s TimerConfig : 1 s Auth type : NONE Virtual MAC : 0000-5e00-0101 Check TTL : YES Config type : normal-vrrp Backup-forward : disabled Create time : 2012-05-11 11:39:18 Last change time : 2012-05-26 11:38:58

# 在RouterA的接口GE2/0/0上执行shutdown命令,模拟RouterA出现故障。

[RouterA] interface gigabitethernet 2/0/0 [RouterA-GigabitEthernet2/0/0] shutdown [RouterA-GigabitEthernet2/0/0] quit

# 在RouterB上执行display vrrp命令查看VRRP状态信息,可以看到RouterB的状态是Master。

[RouterB] display vrrp GigabitEthernet2/0/0 | Virtual Router 1 State : Master Virtual IP : 10.1.1.111 Master IP : 10.1.1.2 PriorityRun : 100 PriorityConfig : 100 MasterPriority : 100 Preempt : YES Delay Time : 0 s TimerRun : 1 s TimerConfig : 1 s Auth type : NONE Virtual MAC : 0000-5e00-0101 Check TTL : YES Config type : normal-vrrp Backup-forward : disabled Create time : 2012-05-11 11:39:18 Last change time : 2012-05-26 11:38:58

# 在RouterA的接口GE2/0/0上执行undo shutdown命令,等待20秒后,在RouterA上执行display vrrp命令查看VRRP状态信息,可以看到RouterA的状态恢复成Master。

[RouterA] interface gigabitethernet 2/0/0 [RouterA-GigabitEthernet2/0/0] undo shutdown [RouterA-GigabitEthernet2/0/0] quit [RouterA] display vrrp GigabitEthernet2/0/0 | Virtual Router 1 State : Master Virtual IP : 10.1.1.111 Master IP : 10.1.1.1 PriorityRun : 120 PriorityConfig : 120 MasterPriority : 120 Preempt : YES Delay Time : 20 s TimerRun : 1 s TimerConfig : 1 s Auth type : NONE Virtual MAC : 0000-5e00-0101 Check TTL : YES Config type : normal-vrrp Backup-forward : disabled Create time : 2012-05-11 11:39:18 Last change time : 2012-05-26 11:38:58
  • 3
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值