Determining which failover host assigned a lease
niall.oreilly at ucd.ie
Tue Jan 8 10:42:29 UTC 2013
On 11 Dec 2012, at 23:04, Nick Rogers wrote:
> I recently started using ISC DHCP server 4.2.3 in a failover configuration. So far things are working well, except I am unable to determine which server assigned a lease by looking at the dhcpd.leases file. For a given client, both servers seem to contain an entry in dhcpd.leases with exactly the same information.
> I would like to be able to determine which router a client was assigned by looking at dhcpd.leases, as I have scripts that examine the leases file.
You can tag a lease by using the 'set' configuration directive.
I also have scripts which examine the leases file, and use a mixture of
global and per-subnet 'set' directives to avoid reconstructing state in
the scripts which can be captured during DHCP transaction processing.
For example, placing
set subnet-prefix = "10.137.192.0/23";
in a subnet declaration results in the same string appearing in the leases file.
You can construct the values for such tag data using the conditional evaluation
functions described in the man (5) page for "dhcp-eval", as in the following
examples, taken from the global section of a production configuration file here.
set vendor-string = option vendor-class-identifier;
set relay-string = option relay-agent-information;
set agent-circuit-id = option agent.circuit-id;
set requested-lease-time = binary-to-ascii (10,32,"",option dhcp-lease-time);
set agent-remote-id = option agent.remote-id;
You need to bear in mind that if evaluation of the expression on the right-hand
side of a 'set' directive gives a null value, no corresponding data is placed
in the leases file.
I hope this helps.
More information about the dhcp-users