Citrix ADC

Load balance the Microsoft Exchange server

This document provides the recommended configuration examples for load balancing of the Microsoft Exchange server using the Citrix ADC appliance.

Citrix ADM StyleBooks simplifies Citrix ADC load balancing configurations for Exchange. For more information, see Microsoft Exchange StyleBook.

Note:

Load balancing of Microsoft Exchange is not possible using a single load balancing virtual server. Instead, follow the recommended configurations provided in this document.

Differences in Microsoft Exchange 2016 and newer versions

  • You need not configure static Remote Procedure Call (RPC) ports on Exchange 2016 because RPC ports are not used.

  • All sections named “for versions of Exchange below 2016” are not necessary with Exchange 2016.

  • If you have configured any of the non-2016 versions already and you migrate to 2016, you do not have to remove them. Because even if they exist there are no issues.

Points to note

  • For Remote Procedure Calls (RPC) with the Exchange server below 2016, the Exchange CAS servers must be configured for Static port assignments. For more information, see Exchange 2010 Client Access Server: Configure Static RPC Ports Microsoft documentation.

  • This configuration assumes using the Citrix ADC appliance for SSL Offload. For more information, see How to Configure SSL Offloading in Exchange 2010 or Configuring SSL offloading in Exchange 2013.

  • If you do not want to use the SSL Offload feature of the Citrix ADC appliance, change the service group CAS_servicegroup_http and monitors to type SSL and its bindings to port 443.

  • Surge Protection is not compatible with Microsoft Exchange. Do not enable it on any service or service group related to Microsoft Exchange. Enabling Surge Protection causes connectivity and reliability issues.

  • Replace the following Variables with the proper information:

    • {HTTP Public IP}—IP Address for public Exchange HTTP endpoint
    • {RPC Public IP}—IP Address for public Exchange RPC endpoint (can be the same as HTTP Public IP)
    • {Timeout}—Desired timeout (in seconds). Recommended to be as long as standard work shift time (that is, 8 hours)
    • {PersTimeout}—Desired timeout (in minutes). Must correspond to the preceding Timeout setting.
    • {AB Port}—RPC Address Book TCP Port (usually 59601)
    • {CA Port}—RPC Client Access TCP Port (usually 59600)
    • {CertKey}—SSL Certificate Key
    • {CAS-1 Server}—IP Address of CAS Server
    • {CAS-2 Server}—IP Address of CAS Server

Service Groups:

add serviceGroup CAS_servicegroup_http HTTP -maxClient 0 -maxReq 0 -cip DISABLED -usip NO -SP OFF -useproxyport YES -cltTimeout {Timeout} -svrTimeout {Timeout} -CKA NO -TCPB NO -CMP YES
add serviceGroup CAS_servicegroup_rpc_epm TCP -maxClient 0 -maxReq 0 -cip DISABLED -usip NO -SP OFF -useproxyport YES -cltTimeout {Timeout} -svrTimeout {Timeout} -CKA NO -TCPB NO -CMP NO
bind serviceGroup CAS_servicegroup_http {CAS-1 Server} 80 -CustomServerID "\"None\""
bind serviceGroup CAS_servicegroup_http {CAS-2 Server} 80 -CustomServerID "\"None\""
bind serviceGroup CAS_servicegroup_rpc_epm {CAS-1 Server} 135 -CustomServerID "\"None\""
bind serviceGroup CAS_servicegroup_rpc_epm {CAS-2 Server} 135 -CustomServerID "\"None\""

Monitors:

add lb monitor CAS_monitor_rpc_epm TCP -LRTM ENABLED -destPort 135
set lb monitor http-ecv HTTP-ECV -recv 403 -LRTM DISABLED
bind serviceGroup CAS_servicegroup_http -monitorName http-ecv
bind serviceGroup CAS_servicegroup_rpc_epm -monitorName CAS_monitor_rpc_epm

Load balancing virtual servers:

add lb vserver CAS_vserver_owa SSL 0.0.0.0 0 -persistenceType COOKIEINSERT -timeout {PersTimeout} -lbMethod LEASTCONNECTION -cltTimeout {Timeout}
add lb vserver CAS_vserver_as SSL 0.0.0.0 0 -persistenceType RULE -timeout {PersTimeout} -lbMethod LEASTCONNECTION -rule "HTTP.REQ.HEADER(\"Authorization\")" -cltTimeout {Timeout}
add lb vserver CAS_vserver_oa SSL 0.0.0.0 0 -timeout {PersTimeout} -lbMethod LEASTCONNECTION -cltTimeout {Timeout}
add lb vserver CAS_vserver_ews SSL 0.0.0.0 0 -timeout {PersTimeout} -lbMethod LEASTCONNECTION -cltTimeout {Timeout}
add lb vserver CAS_vserver_ad SSL 0.0.0.0 0 -timeout {PersTimeout} -lbMethod LEASTCONNECTION -cltTimeout {Timeout}
set ssl vserver CAS_vserver_owa -sslRedirect ENABLED
bind ssl vserver CAS_vserver_owa -certkeyName {CertKey}
bind ssl vserver CAS_vserver_as -certkeyName {CertKey}
bind ssl vserver CAS_vserver_oa -certkeyName {CertKey}
bind ssl vserver CAS_vserver_ews -certkeyName {CertKey}
bind ssl vserver CAS_vserver_ad -certkeyName {CertKey}
bind lb vserver CAS_vserver_owa CAS_servicegroup_http
bind lb vserver CAS_vserver_as CAS_servicegroup_http
bind lb vserver CAS_vserver_oa CAS_servicegroup_http
bind lb vserver CAS_vserver_ews CAS_servicegroup_http
bind lb vserver CAS_vserver_ad CAS_servicegroup_http
add lb vserver CAS_vserver_rpc_epm TCP {RPC Public IP} 135 -timeout {PersTimeout} -cltTimeout {Timeout} -comment "vserver for RPC End Point Mapper"
bind lb vserver CAS_vserver_rpc_epm CAS_servicegroup_rpc_epm

Persistency group:

add lb group CAS_persistency_group_sourceip
bind lb group CAS_persistency_group_sourceip CAS_vserver_oa
bind lb group CAS_persistency_group_sourceip CAS_vserver_ews
bind lb group CAS_persistency_group_sourceip CAS_vserver_ad
bind lb group CAS_persistency_group_sourceip CAS_vserver_rpc_epm
set lb group CAS_persistency_group_sourceip -persistenceType SOURCEIP -timeout {PersTimeout}

Content Switching for HTTP services:

add cs vserver CAS_vserver_cs SSL {Public IP} 443 -cltTimeout {Timeout} -caseSensitive OFF -comment "Exchange CS VServer"
bind ssl vserver CAS_vserver_cs -certkeyName {CertKey}
add cs action CAS_action_cs_owa -targetLBVserver CAS_vserver_owa
add cs action CAS_action_cs_as -targetLBVserver CAS_vserver_as
add cs action CAS_action_cs_oa -targetLBVserver CAS_vserver_oa
add cs action CAS_action_cs_ews -targetLBVserver CAS_vserver_ews
add cs action CAS_action_cs_autodiscover -targetLBVserver CAS_vserver_ad
add cs policy CAS_policy_cs_owa -rule "HTTP.REQ.URL.SET_TEXT_MODE(IGNORECASE).STARTSWITH(\"/owa\")" -action CAS_action_cs_owa
add cs policy CAS_policy_cs_as -rule "HTTP.REQ.URL.SET_TEXT_MODE(IGNORECASE).STARTSWITH(\"/Microsoft-Server-ActiveSync\")" -action CAS_action_cs_as
add cs policy CAS_policy_cs_autodiscover -rule "HTTP.REQ.URL.SET_TEXT_MODE(IGNORECASE).STARTSWITH(\"/Autodiscover\")" -action CAS_action_cs_autodiscover
add cs policy CAS_policy_cs_oa -rule "HTTP.REQ.URL.SET_TEXT_MODE(IGNORECASE).STARTSWITH(\"/rpc\")" -action CAS_action_cs_oa
add cs policy CAS_policy_cs_ews -rule "HTTP.REQ.URL.SET_TEXT_MODE(IGNORECASE).STARTSWITH(\"/EWS\")" -action CAS_action_cs_ews

bind cs vserver CAS_vserver_cs -policyName CAS_policy_cs_oa -priority 90
bind cs vserver CAS_vserver_cs -policyName CAS_policy_cs_owa -priority 100
bind cs vserver CAS_vserver_cs -policyName CAS_policy_cs_as -priority 110
bind cs vserver CAS_vserver_cs -policyName CAS_policy_cs_autodiscover -priority 120
bind cs vserver CAS_vserver_cs -policyName CAS_policy_cs_ews -priority 130
bind cs vserver CAS_vserver_cs -lbvserver CAS_vserver_owa

Additional service groups:

add serviceGroup CAS_servicegroup_rpc_ca TCP -maxClient 0 -maxReq 0 -cip DISABLED -usip NO -SP OFF -useproxyport YES -cltTimeout {Timeout} -svrTimeout {Timeout} -CKA NO -TCPB NO -CMP NO
add serviceGroup CAS_servicegroup_rpc_ab TCP -maxClient 0 -maxReq 0 -cip DISABLED -usip NO -SP OFF -useproxyport YES -cltTimeout {Timeout} -svrTimeout {Timeout} -CKA NO -TCPB NO -CMP NO
bind serviceGroup CAS_servicegroup_rpc_ca {CAS-1 Server} {CA Port} -CustomServerID "\"None\""
bind serviceGroup CAS_servicegroup_rpc_ca {CAS-2 Server} {CA Port} -CustomServerID "\"None\""
bind serviceGroup CAS_servicegroup_rpc_ab {CAS-1 Server} {AB Port} -CustomServerID "\"None\""
bind serviceGroup CAS_servicegroup_rpc_ab {CAS-2 Server} {AB Port} -CustomServerID "\"None\""

Additional monitors:

add lb monitor CAS_monitor_rpc_ca TCP -LRTM ENABLED -destPort {CA Port}
add lb monitor CAS_monitor_rpc_ab TCP -LRTM ENABLED -destPort {AB Port}
bind serviceGroup CAS_servicegroup_rpc_ca -monitorName CAS_monitor_rpc_ca
bind serviceGroup CAS_servicegroup_rpc_ab -monitorName CAS_monitor_rpc_ab

Additional load balancing virtual servers:

add lb vserver CAS_vserver_rpc_ab TCP {RPC Public IP} {AB Port} -timeout {PersTimeout} -cltTimeout {Timeout} -comment "vserver for  RPC Address Book"
add lb vserver CAS_vserver_rpc_ca TCP {RPC Public IP} {CA Port} -timeout {PersTimeout} -cltTimeout {Timeout} -comment "vserver for  RPC Client Access"
bind lb vserver CAS_vserver_rpc_ab CAS_servicegroup_rpc_ab
bind lb vserver CAS_vserver_rpc_ca CAS_servicegroup_rpc_ca

Additional persistency group:

bind lb group CAS_persistency_group_sourceip CAS_vserver_rpc_ab
bind lb group CAS_persistency_group_sourceip CAS_vserver_rpc_ca

Additional load balancing virtual server:

add lb vserver CAS_vserver_mapi SSL 0.0.0.0 0 -timeout {PersTimeout} -lbMethod LEASTCONNECTION -cltTimeout {Timeout}
bind ssl vserver CAS_vserver_mapi -certkeyName {CertKey}
bind lb vserver CAS_vserver_mapi CAS_servicegroup_http

Additional persistency group:

bind lb group CAS_persistency_group_sourceip CAS_vserver_mapi

Content switching for HTTP services:

add cs action CAS_action_cs_mapi -targetLBVserver CAS_vserver_mapi
add cs policy CAS_policy_cs_mapi -rule "HTTP.REQ.URL.SET_TEXT_MODE(IGNORECASE).STARTSWITH(\"/mapi\")" -action CAS_action_cs_mapi
bind cs vserver CAS_vserver_cs -policyName CAS_policy_cs_mapi -priority 140

Optional configurations

HTTPS redirect for Outlook Web App (OWA):

add lb vserver CAS_vserver_owa_http_redirect HTTP {HTTP Public IP} 80 -persistenceType COOKIEINSERT -timeout {PersTimeout} -lbMethod ROUNDROBIN -redirectURL "https://mail.example.com/owa" -cltTimeout {Timeout}

NOTE: Replace with proper HTTPS Redirect URL.

Policy for /owa rewrite:

add rewrite action owa_rewrite replace http.REQ.URL "\"/owa\""
add rewrite policy owa_rewrite_policy "http.req.url.eq(\"/\")" owa_rewrite
bind lb vserver CAS_vserver_owa -policyName owa_rewrite_policy -priority 100 -gotoPriorityExpression END -type REQUEST
add responder action action_responder_owa redirect "\"https://www.example.com/owa\""
add responder policy policy_responder_owa HTTP.REQ.IS_VALID action_responder_owa
set responder param -undefAction NOOP
bind lb vserver CAS_vserver_owa -policyName policy_responder_owa -priority 100 -gotoPriorityExpression END -type REQUEST

NOTE: Replace with proper HTTPS Redirect URL.

Support for SMTP:

For the following configuration, USIP must be enabled so that the CAS servers can see the sending SMTP server’s IP address for validation. This configuration also requires that the default gateway of the CAS server is configured to point at the ADC appliance’s SNIP address.

add lb vserver CAS_vserver_smtp TCP {HTTP Public IP} 25 -persistenceType SOURCEIP -timeout 60 -lbMethod LEASTCONNECTION -cltTimeout 30
add serviceGroup CAS_servicegroup_smtp TCP -maxClient 0 -maxReq 0 -cip DISABLED -usip YES -SP OFF -useproxyport YES -cltTimeout 30 -svrTimeout 30 -CKA NO -TCPB NO -CMP NO
bind serviceGroup CAS_servicegroup_smtp {CAS-1 Server} 25 -CustomServerID "\"None\"" bind serviceGroup CAS_servicegroup_smtp {CAS-2 Server} 25 -CustomServerID "\"None\""
bind lb vserver CAS_vserver_smtp CAS_servicegroup_smtp

Support for Post Office Protocol version 3 (POP3):

add lb vserver CAS_vserver_pop3 TCP {HTTP Public IP} 110 -persistenceType SOURCEIP -timeout {PersTimeout} -lbMethod LEASTCONNECTION -cltTimeout {Timeout}
add serviceGroup CAS_servicegroup_pop3 TCP -maxClient 0 -maxReq 0 -cip DISABLED -usip NO -SP OFF -useproxyport YES -cltTimeout {Timeout} -svrTimeout {Timeout} -CKA NO -TCPB NO -CMP NO
bind serviceGroup CAS_servicegroup_pop3 {CAS-1 Server} 110 -CustomServerID "\"None\"" bind serviceGroup CAS_servicegroup_pop3 {CAS-2 Server} 110 -CustomServerID "\"None\""
bind lb vserver CAS_vserver_pop3 CAS_servicegroup_pop3

Note:

You can perform the preceding configuration for SSL-encrypted POP3 by changing the port to 995 and the virtual server/service types to SSL. Also bind a suitable SSL certificate.

Support for IMAP:

add lb vserver CAS_vserver_imap TCP {HTTP Public IP} 143 -persistenceType SOURCEIP -timeout {PersTimeout} -lbMethod LEASTCONNECTION -cltTimeout {Timeout}
add serviceGroup CAS_servicegroup_imap TCP -maxClient 0 -maxReq 0 -cip DISABLED -usip NO -SP OFF -useproxyport YES -cltTimeout {Timeout} -svrTimeout {Timeout} -CKA NO -TCPB NO -CMP NO
bind serviceGroup CAS_servicegroup_imap {CAS-1 Server} 143 -CustomServerID "\"None\"" bind serviceGroup CAS_servicegroup_imap {CAS-2 Server} 143 -CustomServerID "\"None\""
bind lb vserver CAS_vserver_imap CAS_servicegroup_imap

Note:

You can perform the preceding configuration for SSL-encrypted IMAP by changing the port to 993 and the virtual server/service types to SSL. Also bind a suitable SSL certificate.

Other Resources