Network Load Balancer SSH with Proxy V2 and Client IP Preserving


In extend to following question,

I have configured a network load balancer disabling client IP preservation and enabling proxy V2. Idea is to only allow requests from Load balancer to EC2 instance behind. All the configurations are in a private network and security groups have attached to EC2 instance to allow traffic only from load balancer for SSH and HTTP.

I could find a way to get the client ip address in http using the configurations in nginx.*** Is there a way to get the original client ip address in SSH request and log it to a file?***

1 Answer

The reason that you can do that in Nginx is because Nginx has support for Proxy Protocol v2. You'll need to find a SSH server/daemon that provides support and performs the logging you require.

Why disable Client IP Preservation and then use Protocol Proxy v2? It seems like extra work when NLB will preserve the client IP for you.

profile pictureAWS
answered 2 years ago
  • Disabling client IP preservation to make the request looks like coming from NLB. So I can add NLB private ip to security group to only allow traffic from it.

  • But if your targets are in a private subnet then they can only receive traffic from the NLB or other sources in that VPC (or on your network). Seems like an easier path to go.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions