Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Load Balance Terminal Servers: A Step-by-Step Guide

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Load balancing terminal servers (often called RDS or Remote Desktop Services farms) distributes incoming remote desktop connections across multiple servers. This improves performance, provides high availability, and makes maintenance easier—you can take one server offline without dropping users. Before you begin, you need a working Active Directory domain, at least two Windows Server machines with the Remote Desktop Services role installed, and administrative access to DNS and your network firewall.

What You'll Need

  • Two or more Windows Servers (2016/2019/2022) with RDS role installed
  • Active Directory domain (all servers domain-joined)
  • DNS server access (to create an A record)
  • A load balancer—either a hardware appliance (F5, Citrix NetScaler) or software (Windows NLB, HAProxy, nginx)
  • Valid RDS CALs (Client Access Licenses) for your users
  • Administrator credentials on all servers

Step-by-Step

  1. Install the RDS role on each server. Open Server Manager, click Add roles and features, select Remote Desktop Services, then Remote Desktop Session Host. Repeat on every server that will host sessions. Do not install the Connection Broker on the same servers if you plan to use an external load balancer—keep the broker separate for simplicity.
  2. Join all servers to the same Active Directory domain. Use Server Manager > Local Server > Workgroup, click Change, and enter your domain name. Reboot each server after joining.
  3. Set up the RD Connection Broker. On one dedicated server (or a VM), install the Remote Desktop Connection Broker role. Open Server Manager, add the role, and then use the RD Connection Manager to add your session hosts to the farm. This broker will manage session redirection and user reconnection.
  4. Configure the session host farm. In the RD Connection Manager, right-click RD Session Host Servers and choose Add Server. Add all your terminal servers. The broker will now track which server each user is on and route them back to the same session if they disconnect.
  5. Create a DNS A record for the farm. In DNS Manager, create a new host record (A) named rds (or similar) pointing to the load balancer's virtual IP (VIP). Users will connect to this name, e.g., rds.contoso.com.
  6. Configure your load balancer. If using a hardware LB, create a virtual server with the VIP and port 3389 (RDP). Add each session host as a real server. Set the load balancing method to Least Connections or Source IP Affinity (to keep users on the same server). For Windows NLB, install the NLB feature on each session host, create a cluster with the same VIP, and use unicast mode. For HAProxy, add a backend with balance leastconn and server entries for each host.
  7. Enable session persistence (sticky sessions). In your load balancer, enable cookie-based persistence or source IP affinity. This ensures that if a user reconnects, they go back to the same server where their session exists. Without this, they might get a new session on a different server.
  8. Test the load balancing. From a client machine, open Remote Desktop and connect to the farm name (e.g., rds.contoso.com). Log in with a test user. Check which server the session landed on (use query session on each server). Disconnect and reconnect—you should return to the same session.
  9. Configure health checks. Set up the load balancer to ping the RDS port (3389) or a custom script on each server. If a server goes down, the LB should automatically stop sending traffic to it. For Windows NLB, enable Health Check in the cluster properties.
  10. Install and configure RD Licensing. Add the RD Licensing role on a separate server, activate it, and install your CALs. Then, in Server Manager > Remote Desktop Services > RD Licensing Manager, add the license server and set each session host to use it (via Group Policy or local policy: Computer Configuration > Administrative Templates > Windows Components > Remote Desktop Services > RD Licensing > Use the specified RD license servers).
  11. Set the load balancer as the gateway (optional). If you want users to connect through RD Gateway, install the RD Gateway role on a separate server and configure the load balancer to forward HTTPS (443) traffic to it. Then set the gateway as the external entry point.
  12. Monitor and adjust. Use Performance Monitor on each session host to track CPU, memory, and session count. Adjust the LB algorithm or add more servers if one is consistently overloaded.

Common Mistakes

  • Not enabling session persistence. Users get disconnected and then land on a different server, losing their session state.
  • Forgetting to add all session hosts to the Connection Broker. The broker won't balance sessions correctly if servers are missing.
  • Using round-robin DNS instead of a real load balancer. DNS round-robin doesn't check server health; if one server is down, users still get its IP and fail to connect.
  • Ignoring licensing. Without proper RDS CALs, users get temporary licenses that expire, causing connection issues.
  • Placing the load balancer on a single point of failure. If your LB is a single server, it becomes a bottleneck. Use a redundant pair if possible.

Tips

  • Use Least Connections for even distribution when sessions vary in length.
  • Set a session timeout (e.g., 4 hours) to free up resources and avoid idle sessions.
  • Regularly update your session hosts with Windows updates to prevent security vulnerabilities.
  • Use a dedicated VLAN for RDS traffic to improve security and performance.
  • Test failover by manually stopping the RDS service on one server and confirming users are redirected to others.
  • If using Windows NLB, ensure all servers are on the same subnet and have static IPs.

Troubleshooting

  • Users cannot connect to the farm name. Check DNS resolution (nslookup), verify the VIP is reachable (ping), and ensure the load balancer is listening on port 3389.
  • Users get a new session every time. Session persistence is not working. Check your LB's persistence settings and ensure the Connection Broker is properly configured.
  • One server is overloaded. Review your LB algorithm and session distribution. If using source IP affinity, many users behind the same NAT will stick to one server—consider using cookie-based persistence instead.
  • License errors on connection. Verify the RD Licensing server is activated and that all session hosts are configured to use it. Check the event logs for licensing errors.
  • Health checks failing. Ensure the LB can reach the RDS port on each server. If using a custom script, test it manually. Also check Windows Firewall on the session hosts to allow traffic from the LB.
  • Users get disconnected after a few minutes. This could be due to idle timeouts or network issues. Check the RDS session time limits in Group Policy and the LB's idle timeout settings.

Frequently Asked Questions

  • Do I need a load balancer if I have the RD Connection Broker? The Connection Broker handles session redirection, but it doesn't distribute initial connections. A load balancer distributes the initial connection to a specific session host; the broker then ensures reconnection to the same session. Both are needed for full load balancing.
  • Can I use Windows NLB for RDS? Yes, Windows NLB works, but it has limitations: it doesn't support cookie-based persistence, and it can be tricky with multiple subnets. Hardware or software LBs like HAProxy are often more flexible.
  • What is the best load balancing algorithm for RDS? Least Connections is generally best because it distributes based on active sessions. Source IP affinity is also common, but it can cause uneven distribution if many users share the same public IP.
  • How many session hosts do I need? It depends on your user count and resource usage. A general rule is to plan for about 50-100 light users per server, but monitor performance to find the right number for your environment.
  • Can I load balance RD Gateway as well? Yes, you can load balance RD Gateway connections by putting multiple gateway servers behind a load balancer that forwards HTTPS (443) traffic. You'll need to enable session persistence for gateway connections.
  • What happens if a session host fails? Users on that server will lose their sessions. The load balancer will detect the failure and stop sending new connections there. Users can reconnect and get a new session on another server, but they will not be automatically reconnected to their previous session unless you have a high-availability solution like RDS Shadowing (which is not standard).