Firewall Ports + HaProxy

firewallhaproxy

Using HaProxy as a SSH load balancer, We have HaProxy running in IP1:2222 and redirecting to IP1:2223-2233 and IP2:2223-2233.

In this case, do I need to open Firewall Ports from

  • Source IP:2222,2223-2233 to IP1:2223-2233 and IP2:2223-2233
    or
  • Source IP:2222 to IP1:2222 and IP1:2222 to IP1:2223-2233 and IP2:2223-2233?

When I trace the route I don't see the request forwarding from LB to actual targets in the sftp/ssh -vvv logs.

Best Answer

I assume haproxy IP is IP. In that case on your firewall you need to allow any port with source as IP to destination IP1:2223-2233 or destination IP2:2223-2233 Similarly allow traffic to haproxy destination IP:2222 from any port in your required source subnet In short source ports will be random >1024 picked by os based on availability. Source port won't be the same 2222