You need to load balance Microsoft Terminal Services or remoteapps. Both of them use the RDP protocol. One main issue when using RDP is to be able to stick a user to a server. The configuration below shows you how to build outage-free Terminal server infrastructure with ALOHA and HAProxy.
Diagram
The TSE infrastructure looks like the image below:
Basically, we have a couple of ALOHA load balancers in active/passive mode. The ALOHAs share a VIP, 10.0.0.18, on which clients will get connected. In order to ensure stickiness, the ALOHAs will use the RDP cookie and store it in a table where it is associated with the server serving the request. Finally, this table is shared between both ALOHAs in order to ensure safe failover.
Configuration
Find below the configuration for such infrastructure:
peers aloha
peer aloha1 10.0.0.16:1024
peer aloha2 10.0.0.17:1024
# RDP / TSE configuration
frontend ft_rdp
mode tcp
bind 10.0.0.18:3389 name rdp
timeout client 1h
option tcpka
option tcplog
log global
# wait up to 5s for an RDP cookie in the request
tcp-request inspect-delay 5s
tcp-request content accept if RDP_COOKIE
default_backend bk_rdp
backend bk_rdp
mode tcp
balance rdp-cookie
persist rdp-cookie
# Options
timeout server 1h
timeout connect 4s
option redispatch
option tcpka
option tcplog
log global
# sticky persistence
stick-table type string len 32 size 10k expire 1d peers aloha
stick on rdp_cookie(mstshash)
# Server farm
server tse1 10.0.0.23:3389 weight 10 check inter 2s rise 2 fall 3
server tse2 10.0.0.24:3389 weight 10 check inter 2s rise 2 fall 3
server tse3 10.0.0.25:3389 weight 10 check inter 2s rise 2 fall 3
server tse4 10.0.0.26:3389 weight 10 check inter 2s rise 2 fall 3
Now, the users can point their RDP client to the VIP and get load-balanced. In case of a client-side network outage or ALOHA failover, users will keep on being redirected to the same server. The users won’t suffer any application outages.
Links
Subscribe to our blog. Get the latest release updates, tutorials, and deep-dives from HAProxy experts.