Re: dhcpd synchronization: leases recovery after downtime

2020-07-19 Thread Guy Godfroy
Hello Edgar,

Le 19/07/2020 à 00:35, ed...@pettijohn-web.com a écrit :
> Not sure how to integrate it properly but this sounds like a job for
> ifstated(8).

Triggering a sync at interface up status change wouldn't be enough: for
instance if only dhcpd crashes and recovers later, there is no change on
interface status.



Re: dhcpd synchronization: leases recovery after downtime

2020-07-19 Thread Guy Godfroy
Hello Janne,

Le 19/07/2020 à 10:21, Janne Johansson a écrit :
> 2) dhcpd checks that ip's don't reply to ping (or exist in arp?) before
> handing out an ip from a dynamic range

How did you check that? I'm not as sure as you about that. For instance
if you define a static lease for a given machine, you have to exclude
the IP address from your dynamic range. So I don't think there is any
kind of check if the address is free on the network before assigning it.
There is no such piece of information in the man page either.

Also, even if it worked, I would like to know the purpose of the lease
sync mechanism; indeed, because of the lack of downtime recovery, high
availability isn't the reason of its existence.



Re: dhcpd synchronization: leases recovery after downtime

2020-07-19 Thread Janne Johansson
Den lör 18 juli 2020 kl 23:28 skrev Guy Godfroy :

> Hello,
>
> I am using two routers on OpenBSD (called mulder and scully), and I wish
> to make dhcpd listen on a carp interface between both of them. I am
> using the synchronization mechanism:
>

I noticed the same issue long time ago, but settled for just running two
unconnected dhcpds and made sure that
1) all fixed replies exist on both (and clients don't mind getting two
answers, they pick the first and stop listening for any extra replies)
and
2) dhcpd checks that ip's don't reply to ping (or exist in arp?) before
handing out an ip from a dynamic range

and this seems to cover most of my concerns, no client would get a
different offer from both dhcpds and ack both, and putting as many fixed
entries as possible on important hosts to make sure they would work in any
case.

-- 
May the most significant bit of your life be positive.


Re: dhcpd synchronization: leases recovery after downtime

2020-07-18 Thread edgar
On Jul 18, 2020 3:25 PM, Guy Godfroy  wrote:

  Hello,

  I am using two routers on OpenBSD (called mulder and scully), and I
  wish
  to make dhcpd listen on a carp interface between both of them. I am
  using the synchronization mechanism:

  mulder# rcctl get dhcpd flags
  -y em2 -Y em2 carp0

  scully# rcctl get dhcpd flags
  -y em2 -Y em2 carp0

  I tested it and it works great when both routers are up.

  But what is explained in the man page is that it is only a realtime
  sync. So if I understand correctly, when one of the hosts is down,
  there
  is no way for it to get the new leases when it gets back up. My
  thought
  about that is that it defeats the original purpose of the feature. My
  concerns are confirmed by the test:

  1. Make sure that carp0 master is mulder.
  2. Stop dhcpd on scully.
  3. Plug a new machine using a dhcp client on the network of carp0.
  4. Observe that the lease is present in /etc/dhcpd.leases on mulder.
  5. Start dhcpd on scully.
  6. Observe that the lease is missing in /etc/dhcpd.leases on scully.

  I have found no information about leases synchronization other than
  the
  one given in dhcpd man page, but I guess there is no possible leases
  recovery from other routers after a downtime, or when a new router is
  inserted in the stack.

  What is the correct solution to manage this case? Is there a
  possibility
  for a router to ask for its missing leases when it gets up? Something
  like this:

  0. mulder is up, scully is down.
  1. scully gets up and asks on multicast:
  "My last lease was created on date d, what's up since that date?"
  2. mulder answers:
  "Here is the leases created since d: ..."

  Thanks.

  Guy

Not sure how to integrate it properly but this sounds like a job for
ifstated(8).
Edgar 


dhcpd synchronization: leases recovery after downtime

2020-07-18 Thread Guy Godfroy
Hello,

I am using two routers on OpenBSD (called mulder and scully), and I wish
to make dhcpd listen on a carp interface between both of them. I am
using the synchronization mechanism:

mulder# rcctl get dhcpd flags
-y em2 -Y em2 carp0

scully# rcctl get dhcpd flags
-y em2 -Y em2 carp0

I tested it and it works great when both routers are up.

But what is explained in the man page is that it is only a realtime
sync. So if I understand correctly, when one of the hosts is down, there
is no way for it to get the new leases when it gets back up. My thought
about that is that it defeats the original purpose of the feature. My
concerns are confirmed by the test:

  1. Make sure that carp0 master is mulder.
  2. Stop dhcpd on scully.
  3. Plug a new machine using a dhcp client on the network of carp0.
  4. Observe that the lease is present in /etc/dhcpd.leases on mulder.
  5. Start dhcpd on scully.
  6. Observe that the lease is missing in /etc/dhcpd.leases on scully.

I have found no information about leases synchronization other than the
one given in dhcpd man page, but I guess there is no possible leases
recovery from other routers after a downtime, or when a new router is
inserted in the stack.

What is the correct solution to manage this case? Is there a possibility
for a router to ask for its missing leases when it gets up? Something
like this:

  0. mulder is up, scully is down.
  1. scully gets up and asks on multicast:
"My last lease was created on date d, what's up since that date?"
  2. mulder answers:
"Here is the leases created since d: ..."

Thanks.

Guy