I think it is always easier to demonstrate some of the Citrix NetScaler features early on. Now that we have configured theNSIP, NetScaler IP and the MIP, Mapped IP and added licenses to the NetScaler appliance we can now show features. We could also spend more time in the initial configuration such as delegating rights to users in LDAP and much more, but often, like me people are impatient so it is easy to show something simple like load balancing at this stage so we have some idea of what NetScaler can do.
For the demonstration I have two web servers configured on the addresses 192.168.0.72 and 192.168.0.73. These are on the same network as the MIP we assigned to the NetScaler 192.168.0.203. These addresses often would represent private address ranges on your secure network. We will assign a single IP address to the NetScaler and the appliance then will load balance incoming HTTP requests across the two web servers.
Enable Load Balancing Feature
Load Balancing is included with the Standard Edition of NetScaler and NetScaler Express, the free Licenses for the VPX, so long as you have a valid license installed then you will be able to use the load balancing feature. The feature though will need to enabled. This can be done through the GUI or from the command line. Where possible we use the CLI, command line interface, as it tends to be quicker and and easier to demonstrate in the videos.
enable feature LB show feature | grep LB
If we are not sure on the feature name to enable then use the show feaure command first and review the output
With load balancing now enabled we can move onto creating the necessary elements to load balance
Three Elements of Load Balancing
1. Create entries for backend servers : First we need to create entries for the backend servers that we will be load balanicing across. We have two web servers on our private network so we will crate records for them first.
add server www1 192.168.0.72 add server www2 192.168.0.73 show server
2. Now we need to create entries for the services to load balance: With the servers created we now need to create records for the services, in this case HTTP and the servers they are linked to
add service w1-web www1 HTTP 80 add service w2-web www2 HTTP 80 show service
3. Finally, we create the virtual; server for load balancing: The virtual server will be assigned an IP Address, often this would be a public address and the DNS record for the website would point to this address. The load balancing method can be Round Robin as in the entry, valid entries include LEASTCONNECTION, LEASTRESPONSETIME, URLHASH, DOMAINHASH. The default is LEASTCONNECTION.
add lb vserver lbvswww HTTP 192.168.0.204 80 -lbmethod ROUNDROBIN show vserver lbvswww
Part of the output of the show vserver command will show the current state of the laod balanced services, this way we can check which services are available to load balance across
Now when we access the virtual server with the a web browser, 192.168.0.204 are connection will be assigned to each server in turn as set with ROUNDROBIN. The DNS record for the website that we need to access shold be pointing to this address, the address of the vserver and not the individual web server records.