啥是VRRP啊---------一脸懵圈----不着急,看了就懂了--------------VRRP配置实验

一、VRRP简介

虚拟路由器冗余协议(VRRP)是一种选择协议,它可以把一个虚拟路由器的责任动态分配到局域网上的 VRRP 路由器中的一台。使用 VRRP 的好处是有更高的默认路径的可用性而无需在每个终端主机上配置动态路由或路由发现协议。

二、VRRP工作原理

1.VRRP只定义了一种报文——vrrp报文,这是一种组播报文,由主三层交换机定时发出来通告他的存在。使用这些报文可以检测虚拟三层交换机各种参数,还可以用于主三层交换机的选举。

2.VRRP中定义了三种状态模型,初始状态Initialize,活动状态Master和备份状态Backup,其中只有活动状态的交换机可以为到虚拟IP地址的的转发请求提供服务。

3.VRRP报文是封装在IP报文上的,支持各种上层协议,同时VRRP还支持将真实接口IP地址设置为虚拟IP地址。

三、VRRP如何配置

在这里,使用华为的eNSP软件模拟这个实验。下面是实验的拓扑图:

各设备配置信息如下:

<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys	
[Huawei]sysname sw3
[sw3]v b 10 20                      ####划分VLAN 10 20    
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw3]int e0/0/1                                  
[sw3-Ethernet0/0/1]p l a
[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]int e0/0/2
[sw3-Ethernet0/0/2]p l a
[sw3-Ethernet0/0/2]p d v 20
[sw3-Ethernet0/0/2]un sh
Info: Interface Ethernet0/0/2 is not shutdown.
[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
[sw3-GigabitEthernet0/0/1]un sh
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[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
[sw3-GigabitEthernet0/0/2]un sh
Info: Interface GigabitEthernet0/0/2 is not shutdown.
[sw3-GigabitEthernet0/0/2]q
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname sw1
[sw1]v b 10 20 100                                  ######划分vlan 10 20 100
Info: This operation may take a few seconds. Please wait for a moment...done.
[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]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]int vlanif10
[sw1-Vlanif10]ip add 192.168.10.10 24
[sw1-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1       ####配置虚拟IP地址####
[sw1-Vlanif10]vrrp vrid 1 priority 120                     ####配置优先级120####
[sw1-Vlanif10]vrrp vrid 1 track interface g0/0/1    ####配置监听端口,当此处down 优先级减10
[sw1-Vlanif10]vrrp vrid 1 track interface g0/0/2    ####配置监听端口,当此处down 优先级减10
[sw1-Vlanif10]int vlanif20
[sw1-Vlanif20]ip add 192.168.20.10 24
[sw1-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1     ####配置虚拟IP地址####
[sw1-Vlanif20]vrrp vrid 2 priority 115                 ####配置优先级115####
[sw1-Vlanif20]int vlanif100
[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          #####配置默认路由#####
<sw1>sys
Enter system view, return user view with Ctrl+Z.
[sw1]int g0/0/1
[sw1-GigabitEthernet0/0/1]shutdown 
[sw1-GigabitEthernet0/0/1]
Jun 30 2020 10:44:53-08:00 sw1 %%01PHY/1/PHY(l)[0]:    GigabitEthernet0/0/1: cha
nge status to down
Jun 30 2020 10:44:53-08:00 sw1 %%01IFNET/4/IF_STATE(l)[1]:Interface Vlanif100 ha
s turned into DOWN state.
Jun 30 2020 10:44:53-08:00 sw1 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
 on the interface Vlanif100 has entered the DOWN state.
Jun 30 2020 10:44:53-08:00 sw1 %%01RM/4/IPV4_DEFT_RT_CHG(l)[3]:IPV4 default Rout
e is changed. (ChangeType=Delete,InstanceId=0,Protocol=Static,ExitIf=Unknown,Nex
thop=11.0.0.1,Neighbour=0.0.0.0,Preference=60,Label=NULL,Metric=0)
Jun 30 2020 10:44:53-08:00 sw1 %%01VRRP/4/STATEWARNINGEXTEND(l)[4]:Virtual Route
r state MASTER changed to BACKUP, because of priority calculation. (Interface=Vl
anif10, VrId=1, InetType=IPv4)

[sw1-GigabitEthernet0/0/1]un sh
[sw1-GigabitEthernet0/0/1]
Jun 30 2020 10:49:13-08:00 sw1 %%01PHY/1/PHY(l)[5]:    GigabitEthernet0/0/1: cha
nge status to up
Jun 30 2020 10:49:13-08:00 sw1 %%01IFNET/4/IF_STATE(l)[6]:Interface Vlanif100 ha
s turned into UP state.
Jun 30 2020 10:49:13-08:00 sw1 %%01IFNET/4/LINK_STATE(l)[7]:The line protocol IP
 on the interface Vlanif100 has entered the UP state.
Jun 30 2020 10:49:13-08:00 sw1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 21, the 
change loop count is 0, and the maximum number of records is 4095.
Jun 30 2020 10:49:19-08:00 sw1 %%01VRRP/4/STATEWARNINGEXTEND(l)[8]:Virtual Route
r state BACKUP changed to MASTER, because of priority calculation. (Interface=Vl
anif10, VrId=1, InetType=IPv4)
<Huawei>
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname sw2
[sw2]v b 10 20 100
Info: This operation may take a few seconds. Please wait for a moment...done.
[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]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]int vlanif10
[sw2-Vlanif10]ip add 192.168.10.20 24
[sw2-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1   ###配置虚拟IP地址###
[sw2-Vlanif10]vrrp vrid 1 priority 115              ###配置优先级为115###
[sw2-Vlanif10]int vlanif20
[sw2-Vlanif20]ip add 192.168.20.20 24
[sw2-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1     ###配置虚拟IP地址###
[sw2-Vlanif20]vrrp vrid 2 priority 120                ###配置优先级为115###
[sw2-Vlanif20]vrrp vrid 2 track interface g0/0/1
[sw2-Vlanif20]vrrp vrid 2 track interface g0/0/2
[sw2-Vlanif20]int vlanif100
[sw2-Vlanif100]ip add 12.0.0.2 30
[sw2-Vlanif100]q
[sw2]ip route-static 0.0.0.0 0.0.0.0 12.0.0.1       ###配置默认路由###
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R1
[R1]int loo 0
[R1-LoopBack0]ip add 1.1.1.1 24
[R1-LoopBack0]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]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]q
[R1]ip route-static 192.168.10.0 24 11.0.0.2
[R1]ip route-static 192.168.20.0 24 11.0.0.2 preference 70
[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

在LSW3的g0/0/1接口处进行抓包

源IP地址为192.168.10.10,目标IP地址为组播地址

Down掉一条路线进行实验。进入LSW1,intg0/0/1,将此接口Down掉,如图示

查看其优先级显示降为110,此时数据将从另一条线路走。

通过数据抓包LSW2的g0/0/1接口,如图示,开始抢占优先级。查看LSW2的优先级为115,优先于LSW1,所以数据从这里走。

实验案例配置完成 不足之处望赐教!

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值