[lvs-users] Anything special about DNS?

To: "lvs-users@xxxxxxxxxxxxxxxxxxxxxx" <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: [lvs-users] Anything special about DNS?
From: "Mark Rosen (marrosen)" <marrosen@xxxxxxxxx>
Date: Fri, 21 Aug 2015 12:55:14 +0000
I had trouble getting LVS to work with DNS.  The issue is with nanny.
I'm guessing that nanny was designed originally for HTTP and so it is text
Through mainly trial and error, I got nanny to properly probe my DNS Real

I'm sure there is a better/easier way ( like configuring nanny to just
make sure UDP port 53 is listening on the real server ) but I used the
script function of nanny ( -e and -x ).
-e tells nanny to run an external script and -x specifies the expected
result to consider the real server viable.  You may also add --regex to
have nanny interpret -x as a regex ( but honestly, I couldn't get regex to
work).  Keep in mind that the nanny parameters are specified in the
-- pulse runs nanny for LVS.

So, since I could get regex to work, I had to write my own custom script:
nslookup  ( I put it in /root/nslookup for nowŠ I'll have to move it
eventually).  It is listed here:


# This program is a thin wrapper on nslookup
# The program simply returns the exit status of
# nslookup so that it can be evaluated by 'nanny'
# Nanny should be configured to expect a '0' for a healthy DNS server.

[ $# -ne 2 ] && echo 1
/usr/bin/nslookup $* >& /dev/null
echo $?

And here is the

primary = X.X.X.X
primary_private =
service = lvs
backup_active = 1
backup = Y.Y.Y.Y
backup_private =
heartbeat = 1
heartbeat_port = 539
keepalive = 6
deadtime = 18
network = nat
nat_router = eth0:1
nat_nmask =
debug_level = NONE
monitor_links = 0
syncdaemon = 0

virtual DNS {
     active = 1
     address = Z.Z.Z.Z eth1:1
     vip_nmask =
     port = 53
     expect = "0"
     use_regex = 0
     send_program = "/root/nslookup %h"
     load_monitor = none
     scheduler = wrr
     protocol = udp
     timeout = 6
     reentry = 15
     quiesce_server = 0
     server dns-int-02 {
         address =
         active = 1
         weight = 1
     server dns-int-01 {
         address =
         active = 1
         weight = 1

As you can see in config above, I am executing the program /root/nslookup.
I also pass a valid name to the nslookup command since nslookup will
return with a non-zero status if it can't resolve a name ( of course, if
your DNS is not recursive you'll need to choose a name it does have ).

Lastly, please review /var/log/messages to see if nanny is doing its job.
On CentOS, nanny logged all of its messages with its PID.

Please read the documentation before posting - it's available at: mailing list - lvs-users@xxxxxxxxxxxxxxxxxxxxxx
Send requests to lvs-users-request@xxxxxxxxxxxxxxxxxxxxxx
or go to

<Prev in Thread] Current Thread [Next in Thread>
  • [lvs-users] Anything special about DNS?, Mark Rosen (marrosen) <=