Saturday, February 22, 2020

GLBP (Gateway Load Balancing Protocol)

GLBP stands for Gateway Load Balancing Protocol and just like HSRP / VRRP it is used to create a virtual gateway that you can use for hosts. If you have no idea what a virtual gateway is then read my Introduction to Gateway Redundancy first. Also I would recommend to look at the HSRP and VRRP lessons before you continue with GLBP.
One of the key differences of GLBP is that it can do load balancing without the group configuration that HSRP/VRRP use (what’s in a name right?).
Let’s take a closer look:
glbp avg avf
All devices running GLBP elect an AVG (Active Virtual Gateway). There will be only one AVG for a single group running GLBP but other devices can take over this rule if the AVG fails. The role of the AVG is to assign a virtual MAC address to all other devices running GLBP. All devices will become an AVF (Active Virtual Forwarder) including the AVG. Whenever a computer sends an ARP Request the AVG will respond with one of the virtual MAC addresses of the available AVFs. Because of this mechanism all devices running GLBP will be used to forward IP packets.
There are multiple methods for load balancing:
  • Round-robin: the AVG will hand out the virtual MAC address of AVF1, then AVF2, AVF3 and gets back to AVF1 etc.
  • Host-dependent: A host will be able to use the same virtual MAC address of an AVF as long as it is reachable.
  • Weighted: If you want some AVFs to forward more traffic than others you can assign them a different weight.
Let’s take a look at a configuration example so you can see how this works.

Configuration

I will use the following topology to configure GLBP:
Glbp Lab Topology
SW1 and SW2 are multilayer switches, their GigabitEthernet 0/1 interfaces are switchports and in VLAN 1. Their interfaces that connect to R3 are routed ports. We configure SW1 and SW2 so they create a virtual gateway for the hosts in the 192.168.1.0 /24 subnet. Let’s enable GLBP:
SW1(config)#interface Vlan1           
SW1(config-if)#glbp 1 ip 192.168.1.254
SW1(config-if)#glbp 1 priority 150
SW2(config)#interface Vlan1
SW2(config-if)#glbp 1 ip 192.168.1.254
I’ll enable GLBP on SW1 and Sw2 using the same group number (1). I changed the priority on SW1 because I want it to be the AVG. Let’s see if this works:
SW1#show glbp brief 
Interface   Grp  Fwd Pri State    Address         Active router   Standby router
Vl1         1    -   150 Active   192.168.1.254   local           192.168.1.2
Vl1         1    1   -   Active   0007.b400.0101  local           -
Vl1         1    2   -   Listen   0007.b400.0102  192.168.1.2     -
SW2#show glbp brief
Interface   Grp  Fwd Pri State    Address         Active router   Standby router
Vl1         1    -   100 Standby  192.168.1.254   192.168.1.1     local
Vl1         1    1   -   Listen   0007.b400.0101  192.168.1.1     -
Vl1         1    2   -   Active   0007.b400.0102  local           -
Use the show glbp brief command to verify your configuration. There are a couple of things we can see here:
• SW1 has become the AVG for group 1. SW2 (192.168.1.2) is standby for the AVG role and will take over in case SW1 fails and group1 has two AVFs:
  • 1: SW1: Virtual MAC address 0007.b400.0101.
  • 2: SW2: Virtual MAC address 0007.b400.0102.
The virtual MAC address that GLBP uses is 0007.b400.XXYY (where X = GLBP group number and Y = AVF number). Let’s take a look at our host, I configured it to use the 192.168.1.254 address for the default gateway.
Let’s see if we can ping this IP address:
H1#ping 192.168.1.254
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.254, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/202/1003 ms
Let’s check the ARP table so we can see which virtual MAC address our host uses for the gateway:
H1#show arp 192.168.1.254
Protocol  Address          Age (min)  Hardware Addr   Type   Interface
Internet  192.168.1.254           0   0007.b400.0101  ARPA   GigabitEthernet0/1
You can see H1 uses the virtual MAC address of SW1 (0007.b400.0101). A second host would use the next virtual MAC address (0007.b400.0102) for the same IP address (192.168.1.254). This is how GLBP load balances traffic from hosts. Optionally, we can configure things like preemption and authentication just like HSRP or VRRP :
SW1 & SW2
(config)#interface Vlan1
(config-if)#glbp 1 authentication md5 key-string NWL
The configuration is similar to HSRP/VRRP but now you use the glbp command.
Interface tracking works differently for GLBP compared to HSRP or VRRP. HSRP/VRRP use a single threshold to determine which router is active/master. If you priority decreases and becomes lower than another device you’ll lose the active/master state and someone else takes over. GLBP works differently and has a weighting mechanism. Weighting will be used to determine if a device can be AVF or not.
To demonstrate this, we use the second link between SW2 and R3. Here’s what I want to do:
  • When one of the links fails it there is no problem so SW2 can remain as an AVF.
  • When both links fails we have a problem and SW2 shouldn’t be an AVF anymore.
  • I only want SW2 to become an AVF again once both links are operational again.
This is something we can do with GLBP, let me show you how:
SW2#show glbp | include Weighting
  Weighting 100 (default 100)
This is the default weighting of SW2 (100).
SW2(config)#track 2 interface GigabitEthernet 0/2 line-protocol
SW2(config)#track 3 interface GigabitEthernet 0/3 line-protocol
First I will configure object tracking for interface GigabitEthernet 0/2 and 0/3.
SW2(config)#interface Vlan1
SW2(config-if)#glbp 1 weighting track 2 decrement 20
SW2(config-if)#glbp 1 weighting track 3 decrement 20
Here’s how I configure tracking for GLBP. Whenever interface gGigabitEthernet 0/2 or GigabitEthernet 0/3 goes down it should decrement the weight by 20. Let’s configure the weighting:
SW2(config-if)#glbp 1 weighting 100 lower 70 upper 90
This is how we configure weighting; this is what it will do:
• The default weighting has a value of 100.
• Once we fall below a weighting value of 70 SW2 will no longer be an AVF.
• Once the weighting gets above 90 we will become an AVF once again.
Let’s see it in action! Here are the values I just configured:
SW2#show glbp | include Weighting
  Weighting 100 (configured 100), thresholds: lower 70, upper 90
Let’s shut the GigabitEthernet 0/2 interface:
SW2(config)#interface GigabitEthernet 0/2
SW2(config-if)#shutdown
And check the new weighting value:
SW2#show glbp | include Weighting
  Weighting 80 (configured 100), thresholds: lower 70, upper 90
Our weighting is now down to 80 but still nothing has changed, we need to get below 70 before anything happens. Let’s shut the GigabitEthernet 0/3 interface:
SW2(config)#interface GigabitEthernet 0/3
SW2(config-if)#shutdown
This will decrement our weighting once more with 20 which should get our weighting to a value of 60. A few seconds later, you’ll see this on the console:
SW2#
%GLBP-6-FWDSTATECHANGE: Vlan1 Grp 1 Fwd 1 state Active -> Listen
SW2#show glbp | include Weighting
  Weighting 60, low (configured 100), thresholds: lower 70, upper 90
Our weighting is now 60 which lower than the “lower” value that we configured at 70. SW2 is no longer an AVF. Let’s restore the GigabitEthernet 0/2 interface:
SW2(config)#interface GigabitEthernet 0/2
SW2(config-if)#no shutdown
This increases the weighting:
SW2#show glbp | include Weighting
  Weighting 80, low (configured 100), thresholds: lower 70, upper 90
Nothing will change at this moment. Our weighting is 80 but we need to climb above the “upper” value of 90. Let’s enable the GigabitEthernet 0/3 interface:
SW2(config)#interface GigabitEthernet 0/3
SW2(config-if)#no shutdown
SW2#show glbp | include Weighting
  Weighting 100, low (configured 100), thresholds: lower 70, upper 90
Now our weighting is back to 100 and we exceeded the upper value of 90. We are back in the game!
SW2#
%GLBP-6-FWDSTATECHANGE: Vlan1 Grp 1 Fwd 1 state Listen -> Active
You can see on the console that SW2 is once again an AVF.
hostname H1
!
no ip routing
!
interface GigabitEthernet0/1
 ip address 192.168.1.100 255.255.255.0
!
ip default-gateway 192.168.1.254
!
end
hostname R3
!
interface GigabitEthernet0/1
 ip address 192.168.13.3 255.255.255.0
!
interface GigabitEthernet0/2
 ip address 192.168.23.3 255.255.255.0
!
interface GigabitEthernet0/3
 ip address 192.168.32.3 255.255.255.0
!
end
hostname SW1
!
interface GigabitEthernet0/1
!
interface GigabitEthernet0/2
 no switchport
 ip address 192.168.13.1 255.255.255.0
!
interface Vlan1
 ip address 192.168.1.1 255.255.255.0
 glbp 1 ip 192.168.1.254
 glbp 1 priority 150
 glbp 1 preempt
 glbp 1 authentication md5 key-string NWL
!         
end
hostname SW2
!
track 2 interface GigabitEthernet0/2 line-protocol
!
track 3 interface GigabitEthernet0/3 line-protocol
!
interface GigabitEthernet0/1
 media-type rj45
 negotiation auto
!
interface GigabitEthernet0/2
 no switchport
 ip address 192.168.23.2 255.255.255.0
!
interface GigabitEthernet0/3
 no switchport
 ip address 192.168.32.2 255.255.255.0
!
interface Vlan1
 ip address 192.168.1.2 255.255.255.0
 glbp 1 ip 192.168.1.254
 glbp 1 preempt
 glbp 1 weighting 100 lower 70 upper 90
 glbp 1 authentication md5 key-string NWL
 glbp 1 weighting track 2 decrement 20
 glbp 1 weighting track 3 decrement 20
!
end

That’s all we have on GLBP for now. I hope this lesson has been useful.

No comments:

Post a Comment