failover / questions

Peter Rathlev peter at
Thu Jul 9 08:13:09 UTC 2015

Hi Leandro,

On Mon, 2015-07-06 at 18:01 -0300, Leandro wrote:
> dhcpd.conf:
> After writing dhcpd.conf file I had to comment following lines, 
> otherwise server refused to start.
> #        max‐response‐delay 60;
> #        max‐unacked‐updates 10;
> #        load balance max seconds 3;
> mine is isc-dhcpd-4.1.1-P1.
> Does server used default values for those parameters?

No, you have to specify these, as "man dhcpd.conf" says. We use:

   max-response-delay 30;
   max-unacked-updates 10;
   load balance max seconds 5;

Haven't given is trouble so far. :-)

> Puting the server down:
> Is there any difference on doing:
> service dhcpd stop or using omshell? (On both cases all used sockets 
> were released).

If you use a Redhat based OS then "service dhcpd stop" just sends a TERM
signal to the running dhcpd process. I haven't used omshell to shut down
a running server, but my guess is it does something a little different.
Like nicely asking the process to exit.

We have always just used the TERM way and have never had problems.

> Releasing all leases:
> Witch is the proper way to release all leases?
> Currently Im doing:
> rm -rf /var/lib/dhcpd/dhcpd.leases~ ; echo "" > /var/lib/dhcpd/dhcpd.leases
> But What I can see Is that secondary don't automatically clear the 
> leases file.

You would have to stop both servers, remove lease files on both and the
restart both. If the lease file is missing (and probably also if it is
empty) on startup then the server just asks for leases from the partner.

> Is there a cleaner way to do it? using omshell ?

Yes, you could use omshell to delete leases. I haven't used it but I
guess the servers would synchronize such a deletion.

> Is there some way to force leases synchronization ?

Just stop the dhcpd process, delete the leases file and restart dhcpd.
It will then ask the partner for a current copy if the lease database.

> After 10 mins restarting primary I still seeing that leases db are not 
> equal; what should I do ?

The lease files aren't necessarily the same but their contents should
describe the same state. Remember that the server just appends newly
assigned leases to the end of the file. A lease might appear several
times in the file and the two servers might not have them in the same
order. And certain "set" statements are (as far as I can tell) only
committed to the lease file on the server that served the lease.

> Server state.
> How can I know wich server is currently serving leases?

Both servers are serving leases. :-) Which server answers which queries
depends on the "split" or "hba" declarations in your configuration. You
would probably have to look at the source code to determine exactly
which server would answer a given client.

As long as the client's "secs" field is below your configured "load
balance max seconds" then only one of the servers will answer the query.
When the "secs" field exceeds "load balance max seconds" then both
servers will answer the query. The client decides which of these to use.

The "secs" field is supposed to describe the seconds elapsed since the
DHCP client process was started as described in RFC 2131.

> How many states exists for master and server? how can I check current state?
> Only through logs?

>From the 4.3.2 source it seems there are 13 different states that the
dhcpd process can have. The values are from an enum defined in
includes/failover.h, "failover_state":

  unknown_state               =  0, /* XXX: Not a standard state. */
  startup                     =  1, 
  normal                      =  2,
  communications_interrupted  =  3,
  partner_down                =  4,
  potential_conflict          =  5,
  recover                     =  6,
  paused                      =  7,
  shut_down                   =  8,
  recover_done                =  9,
  resolution_interrupted      = 10,
  conflict_done               = 11,
  recover_wait                = 254

Take a look at "dhcp_failover_state_name_print" in server/failover.c to
see the names that would be printed to e.g. log files.

You can use omshell to see the current local and remote states:

  > server
  > port 7911
  > key omapi-local-key "super-secret-key"
  > connect
  obj: <null>
  > new failover-state
  obj: failover-state
  > set name = "name-of-failover"
  obj: failover-state
  name = "name-of-failover"
  > open
  obj: failover-state
  name = "name-of-failover"
  partner-state = 00:00:00:02
  local-state = 00:00:00:02
  > close
  obj: <null>
  > ^C

This is from a running server in "normal" state with a "normal" partner.


More information about the dhcp-users mailing list