侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

VRRP链路跟踪

2023-03-26 星期日 / 0 评论 / 0 点赞 / 74 阅读 / 7150 字

VRRP链路跟踪使用场景我们主路由器可能网关接口故障-1,这个时候备用网关启动。故障-2如果是主路由器连接外网的接口故障,网关没有问题就无法检测到这个故障vrrp无法正常的切换,我们的pc无法访问网络

.

VRRP链路跟踪

使用场景
我们主路由器可能网关接口故障-1,这个时候备用网关启动。
故障-2如果是主路由器连接外网的接口故障,网关没有问题就无法检测到这个故障vrrp无法正常的切换,我们的pc无法访问网络,这个时候我们主路由器是知道我们的这个接口出现问题的,所有要在主路由上设定VRRP链路跟踪
命令:int g0/0/0
vrrp vrid track int g0/0/1 reduced 110 //接口断开后 优先级降低110

int G0/0/0

ip ad 192.168.1.251 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.1.254
vrrp vrid 1 priority 200
vrrp vrid 1 track int Gi0/0/1 reduced 110

    配置思路:

1.终端电脑
PC1 PC2的ip地址和网关
2.网络设备
交换机(建vlan,定义接口,加入vlan)
路由器
-(设置接口ip,
-设置vrrp协议,把R1优先级设置为200,
-R1设置vrrp链路跟踪
-设置静态路由,实现全网互通)
3.验证与测试
-两台pc是否可以互通
-断开主路由g0/0/1后,R1R2的主/备关系变化
-R1的优先级变化情况
是否与我们的设想的相同

3 案例3:VRRP 链路跟踪
3.1 问题
配置接口IP地址
配置 VRRP 主备网关
配置 VRRP 链路跟踪
断开 R1 Gi0/0/1 查看 VRRP 状态
打开 R1 Gi0/0/1 查看 VRRP 状态
3.2 方案
搭建实验环境,如图-3所示。

图-3

3.3 步骤
实现此案例需要按照如下步骤进行。

配置终端设备 PC1

     PC-1 IP 地址:           192.168.1.1          255.255.255.0          192.168.1.254    // 后期通过 VRRP 形成的 虚拟网关IP     PC-2 IP 地址:           192.168.2.1          255.255.255.0          192.168.2.254    // R3的网关接口IP地址

配置 SW1

<Huawei>system-view // 进入系统视图
[Huawei]sysname SW1 // 修改设备名称为 SW1
[SW1]interface GigabitEthernet 0/0/1 // SW1 与 R1 的互联接口
[SW1-GigabitEthernet0/0/1]port link-type access // 配置链路类型为 access
[SW1-GigabitEthernet0/0/1]quit
[SW1]interface gi0/0/2 // SW1 与 R2 的互联接口
[SW1-GigabitEthernet0/0/2]port link-type access // 配置链路类型为 access
[SW1-GigabitEthernet0/0/2]quit
[SW1]interface gi0/0/3 // SW1 与 PC1 的互联接口
[SW1-GigabitEthernet0/0/3]port link-type access // 配置链路类型为 access
[SW1-GigabitEthernet0/0/3]quit
配置R1

<Huawei>system-view
[Huawei]sysname R1
[R1]interface GigabitEthernet 0/0/0 // R1与SW1 的互联接口
[R1-GigabitEthernet0/0/0]ip address 192.168.1.251 24
[R1-GigabitEthernet0/0/0]quit
[R1]interface GigabitEthernet 0/0/1 // R1与R3 的互联接口
[R1-GigabitEthernet0/0/1]ip address 192.168.13.1 24
[R1-GigabitEthernet0/0/1]quit
[R1]ip route-static 192.168.2.0 24 192.168.13.3 // 添加去往 PC2 的路由
配置R2

<Huawei>system-view
[Huawei]sysname R2
[R2]interface GigabitEthernet 0/0/0 // R2与SW1 的互联接口
[R2-GigabitEthernet0/0/0]ip address 192.168.1.252 24
[R2-GigabitEthernet0/0/0]quit
配置R3

<Huawei>system-view
[Huawei]sysname R3
[R3]interface GigabitEthernet 0/0/0 // R3与PC2 的互联接口
[R3-GigabitEthernet0/0/0]ip address 192.168.2.254 24
[R3-GigabitEthernet0/0/0]quit
[R3]interface GigabitEthernet 0/0/1 // R3与R1 的互联接口
[R3-GigabitEthernet0/0/1]ip address 192.168.13.3 24
[R3-GigabitEthernet0/0/1]quit
[R3]ip route-static 192.168.1.0 24 192.168.13.1 // 添加去往 PC1 的路由
配置 R1 的 VRRP

[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]vrrp vrid 1 virtual-ip 192.168.1.254 // 设置虚拟网关
[R1-GigabitEthernet0/0/0]vrrp vrid 1 priority 200 // 设置 VRRP 优先级为 200
配置 R2 的 VRRP

[R2]interface GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0]vrrp vrid 1 virtual-ip 192.168.1.254 // 设置虚拟网关
配置 R1 的 VRRP 链路跟踪

[R1]interface GigabitEthernet 0/0/0 // PC1 的网关接口
[R1-GigabitEthernet0/0/0] vrrp vrid 1 track interface gi0/0/1 reduced 110
// 接口Gi0/0/1 断开后,vrrp 优先级降低 110,变成90
测试 VRRP 链路跟踪,Gi0/0/1 断开之前

[R1]display vrrp brief // 查看 R1 在 VRRP 中的状态,是主(Master)网关
Total:1 Master:1 Backup:0 Non-active:0
VRID State Interface Type Virtual IP

1 Master GE0/0/0 Normal 192.168.1.254
[R2]display vrrp brief // 查看 R2 在 VRRP 中的状态,是备份(Backup)网关
Total:1 Master:0 Backup:1 Non-active:0
VRID State Interface Type Virtual IP

1 Backup GE0/0/0 Normal 192.168.1.254
测试 VRRP 链路跟踪,Gi0/0/1 断开之后

[R1]interface GigabitEthernet 0/0/1
[R1-GigabitEthernet0/0/1] shutdown // 关闭 VRRP 协议跟踪的端口 Gi0/0/1
[R2]display vrrp brief // 查看 R2 在 VRRP 中的状态,是主(Master)网关
Total:1 Master:1 Backup:0 Non-active:0
VRID State Interface Type Virtual IP

1 Master GE0/0/0 Normal 192.168.1.254
[R1]display vrrp brief // 查看 R1 在 VRRP 中的状态,是备份(Backup)网关
Total:1 Master:0 Backup:1 Non-active:0
VRID State Interface Type Virtual IP

1 Backup GE0/0/0 Normal 192.168.1.254
[R1]display vrrp
GigabitEthernet0/0/0 | Virtual Router 1
State : Backup // R1 的 VRRP 状态为“备份”
Virtual IP : 192.168.1.254 // 虚拟网关IP地址
Master IP : 192.168.1.252 // 当前主网关设备的接口IP地址
PriorityRun : 90 // 当前本设备运行的 VRRP 优先级为 90
PriorityConfig : 200 // 当前本设备配置的 VRRP 优先级为 200
MasterPriority : 100 // 当前主网关的 VRRP 优先级为 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
Track IF : GigabitEthernet0/0/1 Priority reduced : 110 // VRRP 链路跟踪配置
IF state : DOWN // 被跟踪的接口处于 DOWN 的状态
Create time : 2020-02-12 18:24:59 UTC-08:00
Last change time : 2020-02-12 18:25:46 UTC-08:00

.

广告 广告

评论区