failover / questions

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

failover / questions

Leandro
Hi dhcp users:
Im very happy with my failover configuration. It is working great.
I would like to ask some questions about proper pair function:

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?

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

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.
Is there a cleaner way to do it? using omshell ?
Is there some way to force leases synchronization ?
After 10 mins restarting primary I still seeing that leases db are not
equal; what should I do ?

Server state.
How can I know wich server is currently serving leases?
How many states exists for master and server? how can I check current state?
Only through logs?

Thanks for your help.
Regards.
Leandro.




_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: failover / questions

Peter Rathlev
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 127.0.0.1
  > 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.

--
Peter

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: failover / questions

Marc Haber
On Thu, Jul 09, 2015 at 10:13:09AM +0200, Peter Rathlev wrote:
> 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.

SIGTERM is, according to the dhcpd manpage, a valid and documented way
to nicely ask the daemon to exit.

Greetings
Marc

--
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Leimen, Germany    |  lose things."    Winona Ryder | Fon: *49 6224 1600402
Nordisch by Nature |  How to make an American Quilt | Fax: *49 6224 1600421
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: failover / questions

Leandro
In reply to this post by Peter Rathlev
Thanks for your answers peter!!

On 09/07/15 05:13, Peter Rathlev wrote:

> 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.
Thanks for the tip.

>
>> 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 127.0.0.1
>    > 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.
>

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users