Recently I was asked to assist in setting up a Citrix Netscaler to load balance two App-V servers. Having had no hands on experience with a Netscaler before, I jumped on the net to see what information I could find. Very little specific information came up and so I’ve detailed how I got the load balancing working:
Equipment / Config :
App-V Management Servers x2
Citrix Netscaler x1
- On the Netscaler create a VIP that is associated with the two App-V servers based on TCP across all ports. Two Services should be created with RTSP monitors. Persistence should be set to SourceIP and Redirection Mode should be MAC based.
- Add a loopback adapter on the App-V servers; configure the IP to be the same as your VIP and enable forwarding.
- Configure the APP-V client to use the VIP. A restart of the service will be required.
Configuring the Netscaler
- Log into the Netscaler and expand the “Load Balancing” or “Virtual Servers and Services” folder.
- Click on the Monitors node and then Add to begin creating an RTSP monitor for the first App-V server. Set the Name of this Monitor (APPV_RTSP1) and set the Type to RTSP.
- Set the Destination IP and Port (554 for RTSP) with the settings corresponding to your first App-V server, leave the remaining options as default.
- Switch to the Special Parameters tab and set the RTSP Request to “OPTIONS *” and set a response code of 401. Click Create to finish the creation of the Monitor.
- Repeat steps 2 to 4 to create another monitor (APPV_RTSP2) for your second App-V server.
- Once all your monitors have been created, click on the Virtual Servers node in the left hand pane and then right click Add.
- Set the Name (VIP_APPV) of this load balancing Virtual Server and its corresponding Virtual IP address. Select a protocol of ANY and a port of *.
- To create the Services click on the Add button and you’ll be presented with a new dialog box.
- In the Create Service dialog box enter a Service Name (SV_APPV1). You will need to create a new service for each App-V server, so select a name that helps differentiate between your App-V servers.
- For Server, enter the IP address of your first App-V server. Protocol should be set to ANY and port should be *.
- From the Monitors/Available selection box, highlight the monitor that corresponds to this App-V server and then click on Add to move it to the right hand side. Policies and Advanced tabs can be left as default. Click Create to finish.
- Repeat steps 8 to 11, enter the information corresponding to your second App-V server.
- Once the Services have been created, ensure they are Active by checking their corresponding check boxes, and then move to the Method and Persistence tab.
- Choose your Load Balancing method, I selected Least Connection.
- Persistence should be set to SourceIP, time out can be left as default and Persist-Netmask should be set to 255.255.255.255.
- Move to the Advanced tab and set the Redirection Mode to MAC Based.
- Click on Create to finish the setup.
If you have a working setup the State and Effective State should both indicate UP on the Virtual Servers node. Both services should also indicate UP on the Services node. Experiment by stopping the App-V services and checking their status via the Netscaler. Note that it might take a few moments for the Netscaler to report changes in state (in particular from DOWN to UP)
If you open the services node, select a particular service and highlight the monitor you can see the return response from the App-V server to the request that was sent. You will see that the response code is 401 which corresponds to Unauthorized. I’m taking this as a positive response as the App-V server is up and able to return a response, if the sever was down, this would not have been returned.
The App-V servers must now be configured with a Loopback adapter.
- Open Device Manager, select the machine name, right click and select Add Legacy Hardware
- When the wizard opens, click on Next, choose Install hardware manually and then Next
- Select Network Adapters, Microsoft and then select Loopback Adapter and then Next
- Open up Network Connections from Control Panel and rename the newly created Loopback adapter to “MS Loopback”
- Open CMD as an Administrator
- In the CMD type “netsh interface ipv4 add address “MS Loopback” ip-address” where ip-address is your virtual ip address
- In the CMD type “netsh interface ipv4 set interface “MS Loopback” forwarding=enabled”
- In the CMD type “netsh interface ipv4 set interface “Local Area Connection” forwarding=enabled”
Finally, the App-V clients must be reconfigured to use the newly created Virtual Server. Note that after setting the new hostname a restart of the local App-V service will be required.