华为:VRRP

什么是VRRP?

虚拟路由冗余协议(Virtual Router Redundancy Protocol,简称VRRP)是由IETF提出的解决局域网中配置静态网关出现单点失效现象的路由协议,1998年已推出正式的RFC2338协议标准。VRRP广泛应用在边缘网络中,它的设计目标是支持特定情况下IP数据流量失败转移不会引起混乱,允许主机使用单路由器,以及及时在实际第一跳路由器使用失败的情形下仍能够维护路由器间的连通性。

在这里插入图片描述
VRRP 的工作过程:
运行VRRP的多个路由器之间通过VRRP报文的交互,从而选择出优先级越高的路由器,作为Master路由器,由此转发数据包。Master路由器,仅仅只有一个,其他路由器称之为backup路由器。
1,VRRP 是值越大,优先级越高。
2,浮动路由的默认值为60,值越小越优先,跟VRRP相反。

下面我们来搭建vrrp的实验,涉及到浮动路由,拓扑如下:

一:sw3配置:

  • sw3配置:这里二层交换的配置比较简单,将各个接口配置类型并划分vlan,允许对应vlan通过
    system-view
    [Huawei]sysname sw3
    [sw3]vlan bat 10 20 //创建vlan 10 ,vlan 20
    [sw3]int e0/0/1
    [sw3-Ethernet0/0/1]p l a //封装接口类型access,并划分vlan 10
    [sw3-Ethernet0/0/1]p d v 10
    [sw3-Ethernet0/0/1]un sh
    Info: Interface Ethernet0/0/1 is not shutdown.
    [sw3-Ethernet0/0/1]dis this //查看当前配置
    在这里插入图片描述
    [sw3-Ethernet0/0/1]int e0/0/2
    [sw3-Ethernet0/0/2]p l a
    [sw3-Ethernet0/0/2]p d v 20 //封装接口类型access,并划分vlan 20
    [sw3-Ethernet0/0/2]un sh
    [sw3-Ethernet0/0/2]dis this //查看当前配置
    在这里插入图片描述
    [sw3-Ethernet0/0/2]int g0/0/1
    [sw3-GigabitEthernet0/0/1]p l t
    [sw3-GigabitEthernet0/0/1]p t a v 10 20 //封装接口类型trunk,并划分vlan 10 20
    [sw3-GigabitEthernet0/0/1]un sh
    Info: Interface GigabitEthernet0/0/1 is not shutdown.
    [sw3-GigabitEthernet0/0/1]dis this //查看当前配置
    在这里插入图片描述
    [sw3-GigabitEthernet0/0/1]int g0/0/2
    [sw3-GigabitEthernet0/0/2]p l t
    [sw3-GigabitEthernet0/0/2]p t a v 10 20 //封装接口类型trunk,并划分vlan 10 20
    [sw3-GigabitEthernet0/0/2]un sh
    Info: Interface GigabitEthernet0/0/2 is not shutdown.
    [sw3-GigabitEthernet0/0/2]dis this
    在这里插入图片描述

二:Rsw1配置

  • sw1配置:将物理接口配置类型并划分vlan,允许对应vlan通过并配置vrrd
    system-view
    [Huawei]sysname sw1
    [sw1]vlan bat 10 20 100
    [sw1]int g0/0/2
    [sw1-GigabitEthernet0/0/2]p l t
    [sw1-GigabitEthernet0/0/2]p t a v 10 20
    [sw1-GigabitEthernet0/0/2]un sh
    Info: Interface GigabitEthernet0/0/2 is not shutdown.
    [sw1-GigabitEthernet0/0/2]dis this
    在这里插入图片描述
    [sw1-GigabitEthernet0/0/2]int g0/0/1
    [sw1-GigabitEthernet0/0/1]p l a
    [sw1-GigabitEthernet0/0/1]p d v 100
    [sw1-GigabitEthernet0/0/1]un sh
    Info: Interface GigabitEthernet0/0/1 is not shutdown.
    [sw1-GigabitEthernet0/0/1]dis this
    在这里插入图片描述
    [sw1-GigabitEthernet0/0/1]q
    [sw1]int vlanif 10
    [sw1-Vlanif10]ip add 192.168.10.10 24
    [sw1-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1 //配置vrrd地址
    [sw1-Vlanif10]vrrp vrid 1 priority 120 //设置优先级(数值越大越优先)
    [sw1-Vlanif10]vrrp vrid 1 track interface g0/0/1 //配置监听接口
    [sw1-Vlanif10]vrrp vrid 1 track interface g0/0/2 //配置监听接口
    [sw1-Vlanif10]q
    [sw1-Vlanif10]dis this
    在这里插入图片描述
    [sw1]int vlanif 20
    [sw1-Vlanif20]ip add 192.168.20.20 24
    [sw1-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1 //配置vrrd地址
    [sw1-Vlanif20]vrrp vrid 2 priority 115 //设置优先级(数值越大越优先)
    [sw1-Vlanif20]q
    [sw1-Vlanif20]dis this
    在这里插入图片描述
    [sw1]int vlanif 100
    [sw1-Vlanif100]ip add 11.0.0.2 30
    [sw1-Vlanif100]q
    在这里插入图片描述
    [sw1]ip route-static 0.0.0.0 0.0.0.0 11.0.0.1
    配置默认路由

三:Rsw2配置

  • sw2配置:将物理接口配置类型并划分vlan,允许对应vlan通过并配置vrrd
    system-view
    [Huawei]sysname sw2
    [sw2]vlan bat 10 20 100
    [sw2]int g0/0/2
    [sw2-GigabitEthernet0/0/2]p l t
    [sw2-GigabitEthernet0/0/2]p t a v 10 20
    [sw2-GigabitEthernet0/0/2]un sh
    Info: Interface GigabitEthernet0/0/2 is not shutdown.
    [sw2-GigabitEthernet0/0/2]dis this
    在这里插入图片描述
    [sw2-GigabitEthernet0/0/2]int g0/0/1
    [sw2-GigabitEthernet0/0/1]p l a
    [sw2-GigabitEthernet0/0/1]p d v 100
    [sw2-GigabitEthernet0/0/1]un sh
    Info: Interface GigabitEthernet0/0/1 is not shutdown.
    [sw2-GigabitEthernet0/0/1]dis this
    在这里插入图片描述
    [sw2]int vlanif 10
    [sw2-Vlanif10]ip add 192.168.10.20 24
    [sw2-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1 //配置vrrd地址
    [sw2-Vlanif10]vrrp vrid 1 priority 115 //设置优先级(数值越大越优先)
    [sw2-Vlanif10]dis this
    在这里插入图片描述
    [sw2]int vlanif 20
    [sw2-Vlanif20]ip add 192.168.20.20 24
    [sw2-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1 //配置vrrd地址
    [sw2-Vlanif20]vrrp vrid 2 priority 120 //设置优先级(数值越大越优先)
    [sw2-Vlanif20]vrrp vrid 2 track interface g0/0/1 //配置监听接口
    [sw2-Vlanif20]vrrp vrid 2 track interface g0/0/2 //配置监听接口
    [sw2-Vlanif20]dis this
    在这里插入图片描述
    [sw2]int vlanif 100
    [sw2-Vlanif100]ip add 12.0.0.2 30
    [sw2-Vlanif100]dis this
    在这里插入图片描述
    [sw2]ip route-static 0.0.0.0 0.0.0.0 12.0.0.1

三:R1配置

  • R1配置:这里需要配置回程的静态浮动路由并对其配置相应的优先级
    system-view
    [Huawei]sysname R1
    [R1]int g0/0/1
    [R1-GigabitEthernet0/0/1]ip add 12.0.0.1 30
    [R1-GigabitEthernet0/0/1]un sh
    Info: Interface GigabitEthernet0/0/1 is not shutdown.
    [R1-GigabitEthernet0/0/1]dis this
    在这里插入图片描述
    [R1-GigabitEthernet0/0/1]int g0/0/0
    [R1-GigabitEthernet0/0/0]ip add 11.0.0.1 30
    [R1-GigabitEthernet0/0/0]un sh
    Info: Interface GigabitEthernet0/0/0 is not shutdown.
    [R1-GigabitEthernet0/0/0]dis this
    在这里插入图片描述
    [R1]int LoopBack 0 //设置回环地址
    [R1-LoopBack0]ip add 1.1.1.1 32
    [R1-LoopBack0]dis this
    在这里插入图片描述
    [R1]ip route-static 192.168.10.0 24 11.0.0.2 //配置浮动路由,主优先级默认60(越小越优先)
    [R1]ip route-static 192.168.10.0 24 12.0.0.2 preference 70 (备浮动路由)
    [R1]ip route-static 192.168.20.0 24 12.0.0.2 //配置浮动路由,主优先级默认60(越小越优先)
    [R1]ip route-static 192.168.20.0 24 11.0.0.2 preference 70(备浮动路由)
    [R1]dis this //查看当前配置
    在这里插入图片描述
    在这里插入图片描述
    ping加抓包验证:在这里插入图片描述在这里插入图片描述
    在这里插入图片描述在这里插入图片描述
发布了56 篇原创文章 · 获赞 6 · 访问量 1878

猜你喜欢

转载自blog.csdn.net/weixin_45691464/article/details/103595035
今日推荐