wy168 发表于 2022-10-26 17:23:12

VRRP:虚拟路由器冗余协议


    <h1 style="text-align: left; margin-bottom: 10px;">VRRP:Virtual Router Redundancy Protocol,虚拟路由器冗余协议</h1>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><strong style="color: blue;">·</strong>将多个物理网关加入到备份组中,形成一台虚拟网关,承担物理网关功能</p>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><strong style="color: blue;">·</strong>只要备份组中仍有一台物理网关正常工作,虚拟网关就仍然正常工作</p>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><strong style="color: blue;">·</strong>两个版本:VRRPv2基于IPv4,VRRPv3基于IPv6</p>
    <div style="text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/658d5633d7ef47cdafc6b51ec50d576c~noop.image?_iz=58558&amp;from=article.pc_detail&amp;x-expires=1664558636&amp;x-signature=8vhf11rrwYxgdcjcYoYmYZNROG4%3D" style="width: 100%; margin-bottom: 20px;"></div>
    <h1 style="text-align: left; margin-bottom: 10px;">VRRP备份组:VRRP Group</h1>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><strong style="color: blue;">·</strong>将局域网内的一组网关设备划分在一起,称为一个备份组</p>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><strong style="color: blue;">·</strong>由<span style="color: green;">一个主(Master)</span>和<span style="color: green;">多个备(Backup)</span>组成,功能上相当于一台虚拟网关</p>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><strong style="color: blue;">·</strong>虚拟网关具有一个虚拟IP地址,作为终端的网关IP地址</p>
    <h1 style="text-align: left; margin-bottom: 10px;">VRRP选举规则:根据优先级,选举出Master,承担网关功能</h1>
    <div style="text-align: left; margin-bottom: 10px;">
      <div style="text-align: left; margin-bottom: 10px;">
            <div style="text-align: left; margin-bottom: 10px;">
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><strong style="color: blue;">角色</strong></p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><strong style="color: blue;">备注</strong></p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;">Master</span></p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;">负责应答对虚拟IP地址的<span style="color: green;">ARP请求</span>,转发发往虚拟网关的数据包</p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;">Backup</span></p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;">负责在Master故障后,<span style="color: green;">接替</span>Master的工作</p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;">优先级</span></p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;">0~255,默认100,<span style="color: green;">越大越优先</span></p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;">255:保留给<span style="color: green;">IP地址拥有者</span>使用</p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;">0:用于触发Backup立即称为Master(如:主动退出VRRP组)</p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;">如果优先级一致,<span style="color: green;">IP地址越大</span>越优先</p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;">抢占规则</span></p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;">默认开启抢占</p>
            </div>
      </div>
    </div>
    <h1 style="text-align: left; margin-bottom: 10px;">VRRP工作流程:</h1>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;">VRRP组选举出主用路由器(master)</span></p>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;">①对比优先级</span></p>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;">优先级最高的成为主用路由器。</span></p>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;">②对比接口IP地址</span></p>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;">如果优先级相同,接口IP地址最高的成为主用路由器</span></p>
    <div style="text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/7c55b1e30b8d41688467ad65aef90b8b~noop.image?_iz=58558&amp;from=article.pc_detail&amp;x-expires=1664558636&amp;x-signature=1q7U73Y96zUUTZ3gXgZX8%2FZMtRU%3D" style="width: 100%; margin-bottom: 20px;"></div>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;">主用路由器发送ARP通告和VRRP通告</span></p>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;">① 用ARP消息通告虚拟IP地址和MAC地址</span></p>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;">② 用VRRP消息通告VRRP头部\组号\优先级等</span></p>
    <div style="text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/4e69b3d14d964c8a87493c560f63bf07~noop.image?_iz=58558&amp;from=article.pc_detail&amp;x-expires=1664558636&amp;x-signature=M2ZsE3Agk4Yw3ByjRMXD9GPRv8Q%3D" style="width: 100%; margin-bottom: 20px;"></div>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;">VRRP主用路由器负责转发往返于内外部网络的流量</span></p>
    <div style="text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/d20195e75aec48e3bce819b733a13bbd~noop.image?_iz=58558&amp;from=article.pc_detail&amp;x-expires=1664558636&amp;x-signature=l1AVRUnmR0IhliHMYvGymVeZ3lY%3D" style="width: 100%; margin-bottom: 20px;"></div>
    <h1 style="text-align: left; margin-bottom: 10px;">VRRP定时器</h1>
    <div style="text-align: left; margin-bottom: 10px;">
      <div style="text-align: left; margin-bottom: 10px;">
            <div style="text-align: left; margin-bottom: 10px;">
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><strong style="color: blue;">定时器</strong></p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><strong style="color: blue;">备注</strong></p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;">通告间隔定时器</span></p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;">默认1秒</span></p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;">Master会定时发送VRRP通告报文, 通知自己工作正常</p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;">如果Backup在等待了<span style="color: green;">3个间隔时间</span>后,依然没有收到通告报文,则认</p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;">为自己是Master,并对外发送VRRP通告报文,重新进行Master的选</p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;">举</p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;">抢占延迟定时器</span></p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;">默认0秒</span></p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;">为了避免频繁进行<span style="color: green;">主备转换</span>,让Backup有足够的时间搜集必要的信息(如路由信息)</p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;">Backup接收到优先级较低的VRRP通告报文后,不会立即抢占成为</p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;">Master,而是等待一定时间后, 才会对外发送VRRP通告报文取代原</p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;">来的Master</p>
            </div>
      </div>
    </div>
    <h1 style="text-align: left; margin-bottom: 10px;">VRRP报文格式:IP协议号112,组播地址224.0.0.18</h1>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;">协议号</span></p>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><strong style="color: blue;"><span style="color: green;"><span style="color: green;">TCP 6</span></span></strong></p>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><strong style="color: blue;"><span style="color: green;"><span style="color: green;">UDP 17</span></span></strong></p>
    <div style="text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/d6087439a40f4f218349674307fc47a9~noop.image?_iz=58558&amp;from=article.pc_detail&amp;x-expires=1664558636&amp;x-signature=Zxi2ctzPMC6OP%2Bt8tYPlX7brs0Y%3D" style="width: 100%; margin-bottom: 20px;"></div>
    <h1 style="text-align: left; margin-bottom: 10px;">VRRP状态机制</h1>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;"> Initialize</span></p>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;"> Master down (3个间隔时间+VRRP抢占延迟</span></p>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;"> 时间),或者收到VRRP协议报文,且报文携带</span></p>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;"> 的PRI小于本地PRI,且抢占模式为True</span></p>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;">Master &lt;--------------------------------------------</p>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"> ----------------------------------------------------&gt;Backup</p>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;"> 收到VRRP协议报文,且报文携带的PRI大于本地</span></p>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;"> PRI,或者报文携带的PRI等于本地PRI,且报文携</span></p>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;"> 带接口IP大于本地接口IP</span></p>VRRP设计方案注意事项:Master应该和STP的根桥保持一致,否则导致次优路径<h1 style="text-align: left; margin-bottom: 10px;">VRRP应用:</h1>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><strong style="color: blue;"><span style="color: green;">主备备份</span></strong></p>
    <div style="text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/f6cbc6fbda5347738b52a3abff417091~noop.image?_iz=58558&amp;from=article.pc_detail&amp;x-expires=1664558636&amp;x-signature=HxmeYMgayq7qRgzCa1yqrc8%2FALY%3D" style="width: 100%; margin-bottom: 20px;"></div>
    <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><strong style="color: blue;"><span style="color: green;">负载分担</span></strong></p>
    <div style="text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/9a55e59769ef4f5c95cf3f65339dd048~noop.image?_iz=58558&amp;from=article.pc_detail&amp;x-expires=1664558636&amp;x-signature=3WgD9Jyh74wAwdb4SREiWqRrmP8%3D" style="width: 100%; margin-bottom: 20px;"></div>
    <h1 style="text-align: left; margin-bottom: 10px;">VRRP跟踪:当Master上行链路故障时,自动修改优先级,重新选举Master</h1>
    <h1 style="text-align: left; margin-bottom: 10px;">VRRP配置</h1>
    <div style="text-align: left; margin-bottom: 10px;">
      <div style="text-align: left; margin-bottom: 10px;">
            <div style="text-align: left; margin-bottom: 10px;">
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><strong style="color: blue;">命令</strong></p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><strong style="color: blue;">备注</strong></p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;">vrrp vrid</span> 10 <span style="color: green;">virtual-ip</span> 10.1.1.254</p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;">创建备份组和虚拟IP</p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;">vrrp vrid</span> 10 <span style="color: green;">priority</span> 150</p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;">配置优先级</p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;">vrrp vrid </span>10 <span style="color: green;">authentication-mode</span> simple/md5 huawei</p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;">配置认证</p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;">vrrp vrid </span>10 <span style="color: green;">timer advertise</span> 1</p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;">配置通告延迟</p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;">vrrp vrid </span>10 <span style="color: green;">preempt-mode disable</span></p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;">关闭抢占模式</p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;">vrrp vrid </span>10 <span style="color: green;">preempt-mode timer delay</span> 3</p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;">配置抢占延迟(默认0s)</p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;">vrrp vrid</span> 10<span style="color: green;"> track interface</span> G0/0/1<span style="color: green;"> reduced</span> 100 <span style="color: green;">vrrp vrid</span> 10 <span style="color: green;">track interface </span>vlanif10</p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;">配置接口跟踪(默认减10)</p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;"><span style="color: green;">display vrrp brief/interface</span></p>
                <p style="font-size: 18px; line-height: 40px; text-align: left; margin-bottom: 30px;">验证VRRP</p>
            </div>
      </div>
    </div>


页: [1]
查看完整版本: VRRP:虚拟路由器冗余协议