{"id":936,"date":"2011-09-07T22:26:00","date_gmt":"2011-09-07T14:26:00","guid":{"rendered":"http:\/\/note.systw.net\/note\/?p=936"},"modified":"2023-11-07T22:30:06","modified_gmt":"2023-11-07T14:30:06","slug":"glbp","status":"publish","type":"post","link":"https:\/\/systw.net\/note\/archives\/936","title":{"rendered":"GLBP"},"content":{"rendered":"\n<p>GLBP(Gateway Load Balancing Protocol)<br>a Cisco-proprietary protocol<br>designed to overcome the limitations of existing redundant router protocols<br>Some of the concepts are the same as with HSRP\/VRRP<br>more dynamic and robust than HSRP\/VRRP<br>ps:<br>\u652f\u63f4\u81f3\u5c11Cisco IOS Software Release 12.2(14)S for routers\u4ee5\u4e0a<\/p>\n\n\n\n<p><br><strong>\u512a\u9ede<\/strong><br>1. allows for the automatic selection and simultaneous use of multiple available gateways as well as automatic failover between those gateways<br>2. none of the clients has to be pointed toward a specific gateway address;&nbsp;they can all have the same default gateway set to the virtual router IP address.<\/p>\n\n\n\n<p><strong>\u539f\u7406<\/strong><br>Single virtual IP address and multiple virtual MAC addresses<br>1. As a client sends an ARP request looking for the virtual router ip address,<br>2. GLBP sends back an ARP reply with the virtual MAC address of a selected router in the group.<br>3. The result is that all clients use the same gateway ip address but have differing MAC addresses for it.<\/p>\n\n\n\n<p>&#8230;..<\/p>\n\n\n\n<p><strong>GLBP group<\/strong><br>GLBP group numbers range from 0-1023.<\/p>\n\n\n\n<p><strong>GLBP AVG priority<\/strong><br>1. The router priority can be 1 to 255 (255 is the highest priority), defaulting to 100<br>2. One router is elected the AVG when this router has the highest priority value, or the highest IP address in the group if there is no highest priority<\/p>\n\n\n\n<p><strong>AVG(active virtual gateway)<\/strong><br>1. The AVG answers all ARP requests for the virtual router address<br>Which MAC address it returns depends on which load-balancing algorithm it is configured to use<br>2. The AVG also assigns the necessary virtual MAC addresses(Up to 4 virtual MAC-addr) to each of the routers(AVF) participating in the GLBP group.<br>ps:Other routers in the group serve as backup or secondary virtual forwarders, if the AVF fails.<br>3. The AVG also assigns secondary roles.<\/p>\n\n\n\n<p><strong>AVF(active virtual forwarder)<\/strong><br>1. forwarding traffic received on its virtual MAC address.<br>2. Each router participating in the GLBP group can become an AVF, if the AVG assigns it that role, along with a virtual MAC address<\/p>\n\n\n\n<p><strong>virtual MAC addresses<\/strong><br>the form is 0007.b4xx.xxyy.<br>The 16-bit xx.xx represents 6 zero bits + 10-bit GLBP group number<br>The 8-bit yy value is the virtual forwarder number<\/p>\n\n\n\n<p><strong>hello time<\/strong><br>By default, GLBP uses the periodic hello messages to detect AVF failures<br>if hellos from the AVF are not received by the AVG before its holdtime timer expires,&nbsp;the AVG assumes that the current AVF has failed. The AVG then assigns the AVF role to another router.<br>ps:<br>GLBP routers communicate&nbsp;using the multicast IP address 224.0.0.102&nbsp;and UDP port 3222.<\/p>\n\n\n\n<p><strong>AVF failed<\/strong><br>\u8a72AVF\u4e4bold virtual mac address\u6703\u88ab\u8907\u88fd\u5230\u53e6\u4e00\u53f0AVF<br>\u56e0\u6b64\u53e6\u4e00\u53f0AVF\u6b64\u6642\u5c31\u67092\u500bvirtual mac address,\u8b93\u4f7f\u7528\u8a72mac\u7684client\u4e0d\u6703\u88ab\u4e2d\u65b7<br>AVG\u6839\u64daredirect\u53catimeout timer\u6703\u6c7a\u5b9aold virtual mac address\u7684\u8655\u7406\u65b9\u5f0f<br><strong>redirect timer<\/strong>(default 10min)<br>used to determine when the AVG will stop using the old virtual MAC address in ARP replies.<br><strong>timeout timer<\/strong>(default 4 hours)<br>the old MAC address and the virtual forwarder using it are flushed from all the GLBP peers.<br>ps:<br>clients still using the old MAC address in their ARP caches must refresh the entry to obtain the new virtual MAC address.<\/p>\n\n\n\n<p>&#8230;..<\/p>\n\n\n\n<p>assign a virtual IP address<br><strong>Switch(config-if)# glbp &lt; group &gt; ip [ ip-address [secondary]]<\/strong><br>&lt; ip-address [secondary]&gt; : assign a virtual IP address in the AVG<br>1. the ip-address is not given in the command, it is learned from another router in the group<br>2. if this router is to be the AVG, you must explicitly configure the IP address;otherwise, no other router knows what the value should be<\/p>\n\n\n\n<p>ex:<br>\u8a2d\u5b9a3\u53f0L3devic\u505around robin\u7684load-balance,<br>\u7db2\u6bb5\u70ba192.168.1.0\/24,\u6307\u5b9agateway\u70ba192.168.1.1<br>L3devic_A\u505a\u70baAVG,L3devic_B\u505a\u70bastandby AVG<br>\u65b9\u5f0f\u5982\u4e0b<br>L3devic_A\u8a2d\u5b9a\u5982\u4e0b<br>\u5148\u4efb\u610f\u914d\u4e00ip,\u6307\u5b9apriority\u70ba200,\u4e26\u6307\u5b9a\u8a72\u7db2\u6bb5gateway\u70ba192.168.1.1<br>L3devic_A(config)# interface vlan 50<br>L3devic_A(config-if)# ip address 192.168.1.10 255.255.255.0<br>L3devic_A(config-if)# glbp 1 priority 200<br>L3devic_A(config-if)# glbp 1 preempt<br>L3devic_A(config-if)# glbp 1 ip 192.168.1.1<br>L3devic_B\u8a2d\u5b9a\u5982\u4e0b<br>\u5148\u4efb\u610f\u914d\u4e00ip,\u6307\u5b9apriority\u70ba150,\u4e26\u6307\u5b9a\u8a72\u7db2\u6bb5gateway\u70ba192.168.1.1<br>L3devic_B(config)# interface vlan 50<br>L3devic_B(config-if)# ip address 192.168.1.11 255.255.255.0<br>L3devic_B(config-if)# glbp 1 priority 150<br>L3devic_B(config-if)# glbp 1 preempt<br>L3devic_B(config-if)# glbp 1 ip 192.168.1.1<br>L3devic_C\u8a2d\u5b9a\u5982\u4e0b<br>\u5148\u4efb\u610f\u914d\u4e00ip,\u4e26\u6307\u5b9a\u8a72\u7db2\u6bb5gateway\u70ba192.168.1.1<br>L3devic_C(config)# interface vlan 50<br>L3devic_C(config-if)# ip address 192.168.1.12 255.255.255.0<br>L3devic_C(config-if)# glbp 1 ip 192.168.1.1<\/p>\n\n\n\n<p><br>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;.<\/p>\n\n\n\n<p>\u5176\u4ed6\u8a2d\u5b9a<\/p>\n\n\n\n<p><strong>GLBP Load Balancing algorithm<\/strong><br>The AVG establishes load balancing by handing out virtual router MAC addresses to clients in a deterministic fashion.<br>the AVG first must inform the AVFs in the group of the virtual MAC address that each should use.<br>Up to four virtual MAC addresses, assigned in sequential order, can be used in a group.<\/p>\n\n\n\n<p>load-balancing methods<br><strong>Round robin(default)<\/strong><br>Each new ARP request for the virtual router address receives the next available virtual MAC address in reply<br><strong>Weighted<\/strong><br>The GLBP group interface&#8217;s weighting value determines the proportion of traffic that should be sent to that AVF<br><strong>Host dependent<\/strong><br>Each client that generates an ARP request for the virtual router address always receives the same virtual MAC address in reply<\/p>\n\n\n\n<p>define the load-balancing method<br><strong>(config-if)# glbp &lt; group&gt; load-balancing [round-robin | weighted | host-dependent]<\/strong><\/p>\n\n\n\n<p>&#8230;<\/p>\n\n\n\n<p><strong>AVG preempt<\/strong><br>GLBP does allow a router to preempt and become the AVG if it has a higher priority than the current AVG.<br>ps:As with HSRP, another router cannot take over an active role until the current active router fails.<\/p>\n\n\n\n<p>to enable preempting and to set a time delay before preempting begins<br><strong>Switch(config-if)# glbp &lt; group&gt; preempt [delay minimum &lt; seconds&gt;]<\/strong><\/p>\n\n\n\n<p>To set the priority<br><strong>Switch(config-if)# glbp &lt; group&gt; priority &lt; 0-255&gt;<\/strong><br>priority=0\u6642\u4e0d\u52a0\u5165\u9078\u64c7<\/p>\n\n\n\n<p>&#8230;<\/p>\n\n\n\n<p><strong>AVG timers<\/strong><br>adjust the GLBP AVG timers<br><strong>Switch(config-if)# glbp &lt; group&gt; timers &lt;[msec] hellotime&gt; &lt; [msec] holdtime&gt;<\/strong><br>[mesc] \u4f7f\u7528milliseconds<br>&lt; hellotime &gt;<br>\u3000default 3 seconds,&nbsp;The hellotime can range from 1-60 sec or from 50-60,000 mesc<br>&lt; holdtime &gt;<br>\u3000default 10 seconds, up to 180sec or 180,000msec<br>The holdtime must be greater than the hellotime<br>ps:<br>the holdtime at least three times greater than the hellotime to give some tolerance to missed or delayed hellos from a functional peer<br>ps:<br>to configure the GLBP timers on each peer router, it is not necessary<br>The AVG will advertise the timer values it is using, and every other peer will learn those values if they have not already been explicitly set.<\/p>\n\n\n\n<p>adjust redirect and timeout timers<br><strong>Switch(config-if)# glbp &lt; group&gt; timers redirect &lt; redirect&gt; &lt; timeout&gt;<\/strong><br>&lt; redirect &gt;the timer defaults to 600 seconds (10 minutes) and can range from 0 to 3600 seconds (1 hour)<br>&lt; timeout &gt; the timer defaults to 14,400 seconds (4 hours) and can range from 700 to 64,800 seconds (18 hours).<\/p>\n\n\n\n<p>&#8230;<\/p>\n\n\n\n<p><strong>weighting function for decide AVF<\/strong><br>GLBP also can use a weighting function to determine which router becomes the AVF for a<br>virtual MAC address in a group<br>\u6b65\u9a5f\u5982\u4e0b<br>1. Each router begins with a maximum weight value.<br>2. As specific interfaces go down, the weight is decreased by a configured amount<br>3. GLBP uses thresholds to determine when a router can and cannot be the AVF<br>If the weight falls below the lower threshold, the router must give up its AVF role.<br>When the weight rises above the upper threshold, the router can resume its AVF role<\/p>\n\n\n\n<p>1.<br>define an interface as a tracked object<br><strong>(config)# track &lt; object-number&gt; interface &lt; interface &gt; &lt; line-protocol | ip routing&gt;<\/strong><br>&lt; object-number &gt;<br>\u3000an arbitrary index (1 to 500) that is used for weight adjustment.<br>&lt; line-protocol | ip routing &gt;<br>\u3000The condition that triggers an adjustment can be:<br>\u3000\u3000line-protocol (the interface line protocol is up)<br>\u3000\u3000ip routing. (IP routing is enabled, the interface has an IP address, and the interface is up.)<br>2.<br>define the weighting thresholds for the interface<br><strong>(config-if)# glbp &lt; group&gt; weighting &lt; maximum&gt; [lower &lt; lower&gt;] [upper &lt; upper&gt;]<\/strong><br>&lt; maximum&gt; the weight can range from 1 to 254 (default 100)<br>[upper &lt; upper&gt;]The thresholds(default maximum) define when the router can be the AVF<br>[lower &lt; lower&gt;] The thresholds(default 1) define when the router cannot be the AVF<br>3.<br>binding specified interface and tracked object<br><strong>(config-if)# glbp &lt; group&gt; weighting track &lt; object-number&gt;&nbsp; [decrement &lt; value&gt;]<\/strong><br>[decrement &lt; value&gt;] When the tracked object fails, the weighting is decremented by value&nbsp;(1-254, default 10)<\/p>\n\n\n\n<p><br>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;..<\/p>\n\n\n\n<p><br>display glbp status<br><strong># show glbp [brief]<\/strong><br>ps:<br>L3devic_A# show glbp brief\u70ba\u4f8b,\u8f38\u51fa\u756b\u9762\u5982\u4e0b<br>Interface Grp Fwd Pri State Address Active router Standby router<br><strong>Vl50 1 &#8211; 200 Active 192.168.1.1 local 192.168.1.11<\/strong><br>Vl50 1 1 7<strong>&nbsp;Active<\/strong>&nbsp;0007.b400.0101&nbsp;<strong>local<\/strong>&nbsp;&#8211;<br>Vl50 1 2 7 Listen 0007.b400.0102 192.168.1.11 &#8211;<br>Vl50 1 3 7 Listen 0007.b400.0103 192.168.1.12 &#8211;<br>ps:<br>L3devic_B# show glbp brief \u70ba\u4f8b,\u8f38\u51fa\u756b\u9762\u5982\u4e0b<br>Interface Grp Fwd Pri State Address Active router Standby router<br><strong>Vl50 1 &#8211; 150 Standby 192.168.1.1 192.168.1.10 local<\/strong><br>Vl50 1 1 7 Listen 0007.b400.0101 192.168.1.10 &#8211;<br>Vl50 1 2 7&nbsp;<strong>Active<\/strong>&nbsp;0007.b400.0102&nbsp;<strong>local<\/strong>&nbsp;&#8211;<br>Vl50 1 3 7 Listen 0007.b400.0103 192.168.1.12 &#8211;<br>ps:<br>L3devic_C# show glbp brief \u70ba\u4f8b,\u8f38\u51fa\u756b\u9762\u5982\u4e0b<br>Interface Grp Fwd Pri State Address Active router Standby router<br><strong>Vl50 1 &#8211; 100 Listen 192.168.1.1 192.168.1.10 192.168.1.11<\/strong><br>Vl50 1 1 7 Listen 0007.b400.0101 192.168.1.10 &#8211;<br>Vl50 1 2 7 Listen 0007.b400.0102 192.168.1.11 &#8211;<br>Vl50 1 3 7&nbsp;<strong>Active<\/strong>&nbsp;0007.b400.0103&nbsp;<strong>local<\/strong>&nbsp;&#8211;<br>ps:<br>L3deviceA# show glbp \u70ba\u4f8b,\u8f38\u51fa\u756b\u9762\u5982\u4e0b<br>Vlan50 &#8211; Group 1<br>\u3000<strong>State is Active<\/strong><br>\u3000\u30007 state changes, last state change 03:28:05<br><strong>\u3000Virtual IP address is 192.168.1.1<\/strong><br>\u3000Hello time 3 sec, hold time 10 sec<br>\u3000\u3000Next hello sent in 1.672 secs<br>\u3000Redirect time 600 sec, forwarder time-out 14400 sec<br>\u3000Preemption enabled, min delay 0 sec<br>\u3000Active is local<br>\u3000Standby is 192.168.1.11, priority 150 (expires in 9.632 sec)<br>\u3000Priority 200 (configured)<br>\u3000Weighting 100 (default 100), thresholds: lower 1, upper 100<br>\u3000Load balancing: round-robin<br><strong>\u3000There are 3 forwarders (1 active)<\/strong><br>\u3000<strong>Forwarder 1<\/strong><br>\u3000\u3000<strong>State is Active<\/strong><br>\u3000\u3000\u30003 state changes, last state change 03:27:37<br>\u3000\u3000MAC address is 0007.b400.0101 (default)<br>\u3000\u3000Owner ID is 00d0.0229.b80a<br>\u3000\u3000Redirection enabled<br>\u3000\u3000Preemption enabled, min delay 30 sec<br>\u3000\u3000<strong>Active is local<\/strong>, weighting 100<br><strong>\u3000Forwarder 2<\/strong><br>\u3000\u3000State is Listen<br>\u3000\u3000MAC address is 0007.b400.0102 (learnt)<br>\u3000\u3000Owner ID is 0007.b372.dc4a<br>\u3000\u3000Redirection enabled, 598.308 sec remaining (maximum 600 sec)<br>\u3000\u3000Time to live: 14398.308 sec (maximum 14400 sec)<br>\u3000\u3000Preemption enabled, min delay 30 sec<br>\u3000\u3000<strong>Active is 192.168.1.11 (primary)<\/strong>, weighting 100 (expires in 8.308 sec)<br><strong>\u3000Forwarder 3<\/strong><br>\u3000\u3000State is Listen<br>\u3000\u3000MAC address is 0007.b400.0103 (learnt)<br>\u3000\u3000Owner ID is 00d0.ff8a.2c0a<br>\u3000\u3000Redirection enabled, 599.892 sec remaining (maximum 600 sec)<br>\u3000\u3000Time to live: 14399.892 sec (maximum 14400 sec)<br>\u3000\u3000Preemption enabled, min delay 30 sec<br>\u3000\u3000<strong>Active is 192.168.1.12 (primary)<\/strong>, weighting 100 (expires in 9.892 sec)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>GLBP(Gateway Load Balancing Pr &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[33],"tags":[],"class_list":["post-936","post","type-post","status-publish","format-standard","hentry","category-cisco-layer3"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts\/936","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/comments?post=936"}],"version-history":[{"count":0,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts\/936\/revisions"}],"wp:attachment":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/media?parent=936"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/categories?post=936"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/tags?post=936"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}