Classic Load Balancer: Obtaining Client IP's with TCP Protocol

Get Client IP's from Classic Load Balancer in AWS

Prev Question Next Question

Question

A Classic load balancer has been setup in AWS where the backend instances listen on the TCP protocol.

There is a requirement to get the client IP's which hit the load balancer.

Which of the following can be used to fulfil this requirement.

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer - A.

The AWS documentation mentions the following.

The Proxy Protocol header helps you identify the IP address of a client when you have a load balancer that uses TCP for back-end connections.

Because load balancers intercept traffic between clients and your instances, the access logs from your instance contain the IP address of the load balancer instead of the originating client.

You can parse the first line of the request to retrieve your client's IP address and the port number.

For more information on Proxy protocol please visit the below URL:

http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/enable-proxy-protocol.html

When a Classic Load Balancer is used, it acts as an intermediary between clients and backend instances. All incoming traffic is directed to the load balancer, which then distributes it across the registered backend instances. As a result, the IP addresses of the clients are lost, and the backend instances only see the IP address of the load balancer as the source IP.

To get the client IP addresses, the Proxy Protocol Header can be used. The Proxy Protocol Header is a way to send the client's IP address information to the backend instances. The load balancer adds a special header to the request that contains the client's IP address and forwards it to the backend instances. The backend instances can then extract the IP address from the header and use it as the source IP.

To use the Proxy Protocol Header, the backend instances must be configured to accept and process the header. Most commonly, the Proxy Protocol Header is used with applications that listen on TCP or SSL protocols.

Sticky sessions, connection draining, and cross-zone load balancing are not related to getting client IP addresses.

Sticky sessions can be used to ensure that a client's requests are always directed to the same backend instance. This is useful when the client's session data is stored on a specific backend instance, and the client needs to access that data during subsequent requests.

Connection draining is a feature that allows existing connections to a backend instance to be completed before the instance is taken out of service. This ensures that ongoing transactions are not disrupted.

Cross-zone load balancing is a feature that allows a load balancer to distribute traffic across all backend instances in all availability zones. This can improve application availability and reduce latency by allowing traffic to be directed to the closest available backend instance.