More info on this topic:
-
For Network Load Balancers, register your targets by instance ID to capture client IP addresses without additional web server configuration. For instructions, see Target group attributes instead of the following resolutions (refer the link)
-
For Network Load Balancers when you can register only IP addresses as targets, enable
proxy protocol version 2
on the load balancer. For instructions, see Enable proxy protocol instead of the following resolutions.
Reference: https://aws.amazon.com/premiumsupport/knowledge-center/elb-capture-client-ip-addresses/
Behaviour depends on the type of ELB - NLB preserves Source IP (except for IP Address targets), whereas servers behind CLB & ALB see load balancer IPs as Source IPs in client requests and rely on x-forwarded-for header to indicate true source.
this is where the confusing part is:
I am using NLB, and I am seeing a few IP addresses (all my client connection seems all come from these few IP address based on the TCP server log). but reality is I have thousands of client accessing, and they are definitely not from these few IP addresses.
when I by pass the NLB, I see the correct IP address for the Client
Relevant questions
My Network Load Balancer is not enforcing the target Security group
asked 3 years agoClient IP Preservation for Network Load Balancer endpoints for Global Accelerator
asked 7 months agoLoad Balancer [NLB] - Listeners - Inconsistent
asked 6 months agoUpdating the Elastic IP address of a Network Load Balancer
asked 2 years agoUnidirectional TCP keep-alive for Classic Load Balancer and Network Load Balancer
Accepted Answerasked 2 years agoNetwork Load Balancer not supporting Network Protocols
asked 7 months agoWhat is the main differences between an load balancer and a autoscaling group
asked a day agoCannot select a target group with alb target type when creating an application load balancer
Accepted Answerasked a month agoObtain client IP address through a network load balancer (TCP socket server, Python)
asked a month agoNetwork load balancer and privatelink for static ip
Accepted Answerasked 3 years ago
Yes,I've tested, it's working in my setup
thanks, but this is not relevant to me , I am using Network Loadbalancer
Thanks for the clarification, I modified the answer, the link I provided has information for NLB as well.
thank you.