What is Load Balancer ? Types of Load balancer, How to detect Load Balancer?

FreakyDodo
4 min readMay 27, 2021

--

Hey Hackers !!

Today we will discuss about load balancers ,types of load balancers and how to detect whether the site is using load balancers or not, how you can find real IP address behind Load Balancer .

What is Load balancer ?

A Load balancer is a method used by organization to distribute load upon other servers.This way , applications (Web applications) work effectively and maintain the uptime , increasing their reliability .Load Balancers usually prevents the sites from getting under DDOS or DOS attacks .

Simply, A load balancer acts as the “traffic cop” sitting in front of your servers and routing client requests across all servers capable of fulfilling those requests in a manner that maximizes speed and capacity utilization and ensures that no one server is overworked, which could degrade performance. If a single server goes down, the load balancer redirects traffic to the remaining online servers. When a new server is added to the server group, the load balancer automatically starts to send requests to it.

Types of Load balancer

Load balancers are generally classified into two categories :

Layer 4 Load balancers , also known as DNS Load Balancers .

Layer 7 Load balancers , also known as Http Load Balancers.

layer 4 Load Balancers

A layer 4 load-balancer takes routing decision based on IPs and TCP or UDP ports.

It has a packet view of the traffic exchanged between the client and a server which means it takes decisions packet by packet.

The layer 4 connection is established between the client and the server.

It is really fast but can’t perform any action on the protocol above layer 4.

The fastest layer4 load-balancers uses an ASIC to take routing decision.

Layer 7 Load Balancers

A layer 7 load-balancer takes routing decision based on IPs, TCP or UDP ports or any information it can get from the application protocol (mainly HTTP).
The layer 7 load-balancer acts as a proxy, which means it maintains two TCP connections: one with the client and one with the server.

The packets are re-assembled then the load-balancer can take a routing decision based on information it can find in the application requests or responses.
Even if this kind of processing seems slow, it is not that much: less than the millisecond.

How to Detect Load Balancers ?

In this section , we will learn methods to detect both layer 4 and layer 7 Load Balancers .

Generally if a single host resolves to multiple IPs then it’s probably using a load balancers.

Using Load Balancer Detector

Load Balancer Detector (lbd) is a bash script in Linux , which could be used for detecting load balancers .

Lbd is capable of detecting both DNS as well as HTTP load balancers .

Load Balancer Detector is pre installed in Linux , to use lbd just type lbd in the terminal window .

To use Load Balancer Detector type following command :

lbd DOMAIN_NAME

Below is the output of lbd:

However the Output of lbd is not that accurate might give false positives , as tool says itself (on the top right of Output above ).

Detecting Real IP address behind Load balancer

A explained prior in order to handle heavy traffic website admins install load balancers , which some times hide the real ip of the webserver behind a virtual IP.

To detect the real IP address behind Load balancers , we will be using tool called “halberd”.

Halberd is a tool that is capable of detecting real IP behind the load Balancers.

Halberd does not come with linux you have to install it manually.

To download Halberd type the following command :

git clone https://github.com/jmbr/halberd

Once, you clone the repo , change the directory to that repo , and run the following commands :

chmod +x setup.pypython setup.py INSTALL

once you are done with installing Halberd , you can start using it .

To know the real IP address you just need to type the following command in terminal :

halberd DOMAIN_NAME

As you can see ,tool is able to find the IP address , below is another output of the tool

So now you know what is load balancers their types and how to detect them, I will recommend you to perform halberd and lbd tools on commercial sites.

Keep Coming for more !!!

Thank you .

--

--

FreakyDodo

Hey Hackers !! I am Harshit Dodia aka Freaky Dodo , I am a student of Information Technology and Ethical hacking.