Tuesday, October 14, 2014

Netscaler CLI to load balance DNS

Ahhhh, coffee and Netscaler CLI in the morning. It's going to be an awesome day!

I've always been comfortable at the command line. Back in the day I enjoyed poking around in DOS, and later on in Linux, Cisco, and Brocade. These days I don't get to do much networking as I'm much more focused on Citrix in my job duties.

Netscalers are almost a black box to many IT workers. There is little available in the way of books and training videos on Netscaler outside of Citrix eDocs and costly Citrix training. Learning Netscaler has been on my to-do list for quite a long time. We have two in my network that haven't been used for anything beyond Citrix Access Gateway until recently. If I'm going to learn something, doing it by CLI  and understanding the command syntax is going to stick in my brain and is going to be more efficient than clicking around a GUI.

This morning I'm configuring DNS load balancing on Netscaler 10.5 by way of the command line.

# In the proxy mode a DNS service type VIP is created
# To this VIP, external DNS servers are bound.
# External DNS Servers:;
# NetScaler appliance will respond to DNS queries on port 53

#Enable Load Balancing Feature:
enable ns feature lb

# Add external DNS servers:
add service ext_dns_1 dns 53
add service ext_dns_2 dns 53

# Create a custom DNS monitor (Using the default dns monitor will result in a state of DOWN. Using the default ping monitor is a bad idea. I've seen servers respond to pings even though essential services were down and I couldn't RDP into the server.)

add lb monitor ext_dns_1 DNS -query host.domain.com -queryType Address -LRTM ENABLED -destIP -destPort 53 -IPAddress <IPofHost>

add lb monitor ext_dns_2 DNS -query host.domain.com -queryType Address -LRTM ENABLED -destIP -destPort 53 -IPAddress <IPofHost>

# Bind monitor to the service:
bind monitor ext_dns_1 ext_dns_1
bind monitor ext_dns_2 ext_dns_2

# Create a DNS virtual server:
add lb vserver vdns dns 53

#Bind the external DNS services to the DNS virtual server:
bind lb vserver vdns ext_dns_1
bind lb vserver vdns ext_dns_2