Send dhcp-users mailing list submissions to
        dhcp-users@lists.isc.org

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.isc.org/mailman/listinfo/dhcp-users
or, via email, send a message with subject or body 'help' to
        dhcp-users-requ...@lists.isc.org

You can reach the person managing the list at
        dhcp-users-ow...@lists.isc.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of dhcp-users digest..."


Today's Topics:

   1. Re: ddns-fwd-name using the wrong name (Glenn Satchell)
      (Rob Moser)
   2. Questions about dhcpd.leases file (Klemen Sladic)
   3. Re: Questions about dhcpd.leases file (Simon Hobson)
   4. Re: Logging GI-Addr (Gregory Sloop)
   5. Re: Logging GI-Addr (Bill Shirley)


----------------------------------------------------------------------

Message: 1
Date: Mon, 12 Feb 2018 18:21:32 +0000
From: Rob Moser <rob.mo...@nau.edu>
To: "dhcp-users@lists.isc.org" <dhcp-users@lists.isc.org>
Subject: Re: ddns-fwd-name using the wrong name (Glenn Satchell)
Message-ID: <38d1f6ec0bc046099bc73dd701b3a...@nau.edu>
Content-Type: text/plain; charset="iso-8859-1"


"Glenn Satchell" <glenn.satch...@uniq.com.au> writes:

> The "dynamic;" entry marks it as something added using OMAPI, ie by
> omshell. Is is possible that this was done sometime in the past?

A number of our DNS management tools use OMAPI.  So that entry could definitely 
have been created by those tools, back when that machine had that name.  It 
_should_ have then been deleted, I assume, when the host was removed, but 
possibly that is where the failure lies.

Thanks!  That gives me another thread to pull on...

     - rob.

------------------------------

Message: 2
Date: Tue, 13 Feb 2018 10:09:41 +1300
From: Klemen Sladic <gostur...@gmail.com>
To: Users of ISC DHCP <dhcp-users@lists.isc.org>
Subject: Questions about dhcpd.leases file
Message-ID:
        <CAN6eUaHvPzQJ6UR8X=p-ucbfuzic8zkkgds+kzietn74-vz...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Hi.

I have a script parsing dhcpd.leases file and would like to ask few
questions:

1. What is the difference between dhcpd.leases and dhcpd.leases~ files?
2. My dhcpd.leases parsing script is executed on commit, like:

subnet 192.168.0.0 netmask 255.255.255.0
{
   interface "eth0";
   range 192.168.0.1 192.168.0.100;
   option routers 192.168.0.254;
   on commit {
      execute("/home/user/leases_parse.sh");
   }
}

Can I assume that dhcpd.leases has already been updated with latest lease
when my script is executed?

3. Is a new lease always appended at the end of dhcpd.leases file?
4. On renew is a new lease block always added at the end or is existing
block updated?

Thank you very much for your comments.

RegK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<https://lists.isc.org/pipermail/dhcp-users/attachments/20180213/44725119/attachment-0001.html>

------------------------------

Message: 3
Date: Mon, 12 Feb 2018 21:57:38 +0000
From: Simon Hobson <dh...@thehobsons.co.uk>
To: Users of ISC DHCP <dhcp-users@lists.isc.org>
Subject: Re: Questions about dhcpd.leases file
Message-ID: <5c7a5ec7-9065-436f-9382-db47b422a...@thehobsons.co.uk>
Content-Type: text/plain; charset=us-ascii

Klemen Sladic <gostur...@gmail.com> wrote:

> 1. What is the difference between dhcpd.leases and dhcpd.leases~ files?

The latter is the previous file. Periodically (compiled in 1 hour by default) 
the server will write out a fresh leases file, move the old one (that's the one 
with ~ appended to it's name), and the new file moved into place. It's done 
that way so that if an error occurs, you haven't just over-written the only 
copy of the file !

> 2. My dhcpd.leases parsing script is executed on commit, like:
> 
> subnet 192.168.0.0 netmask 255.255.255.0
> {
>    interface "eth0";
>    range 192.168.0.1 192.168.0.100;
>    option routers 192.168.0.254;
>    on commit {
>       execute("/home/user/leases_parse.sh");
>    }
> }
> 
> Can I assume that dhcpd.leases has already been updated with latest lease 
> when my script is executed?

Don't know. It's required that the leases file is updated before sending teh 
packet to the client, but I don't know if it's defined at what point the on 
commit is executed.

> 3. Is a new lease always appended at the end of dhcpd.leases file?

Yes

> 4. On renew is a new lease block always added at the end or is existing block 
> updated?

Yes. A lease is never updated in-place - a new record is appended to the leases 
file which is why you will see several entries for some clients. Obviously this 
append only method needs a cleanup from time to time - see 1 above.

BTW, there are some things you need to be aware of.

AIUI "on xxxx" scripts are not executed asynchronously - hence running your 
script has the ability to severely compromise the performance of your DHCP 
service.
If you are running the script to parse the lease that's just been written, can 
you obtain the information from within the server ? Eg build a log statement 
and then just tail the log file ?
Can values be passed in the on xxxx call ? I don't know, but if they can then 
that might save you have to parse the file.



------------------------------

Message: 4
Date: Mon, 12 Feb 2018 14:35:02 -0800
From: Gregory Sloop <gr...@sloop.net>
To: Users of ISC DHCP <dhcp-users@lists.isc.org>
Subject: Re: Logging GI-Addr
Message-ID: <744637046.20180212143...@sloop.net>
Content-Type: text/plain; charset="iso-8859-15"


"  GIaddr:", pick-first-value(binary-to-ascii(10, 8, ".", packet(24,4)), 
"(none)")

So, let me break this down, and see if I understand it correctly.
Starting from the inside...

Offset into the packet 24 bytes, and return 4 bytes [4 octets]. 
---
  I think this means that the OP, HType, HLen and HOPS, [4 bytes / 1 octet 
[each] *4]
  XID [4 octets / 4 bytes]
  SECs and FLAGs [4 bytes, 2 octets each*2]
  Then continue to offset past the CIADDR, YADDR & SIADDR (Four octets, 4 bytes 
each in IPV4) to get to the GIAddr, at byte 24. 
  Grab 4 bytes, 4 octets

  [The wikipedia page on dhcp is pretty handy here! 
https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol ]
---

Convert from binary to ASCII from base 8 to base 10. Separate the items with "."

Grab the first non-null output from that output of binary-to-ascii.
If there's no GIAddr in this packet, return "(none)"

Do I have that right?

Thanks so much!

-Greg


-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<https://lists.isc.org/pipermail/dhcp-users/attachments/20180212/aa8cae93/attachment-0001.html>

------------------------------

Message: 5
Date: Mon, 12 Feb 2018 19:23:05 -0500
From: Bill Shirley <b...@c3po.polymerindustries.biz>
To: dhcp-users@lists.isc.org
Subject: Re: Logging GI-Addr
Message-ID:
        <ed0c3520-a0f6-a9e8-02cf-82c1eb9df...@c3po.polymerindustries.biz>
Content-Type: text/plain; charset="iso-8859-15"; Format="flowed"

Yes, that is correct.?? Insert that line in with the rest of your logging.

on commit {
 ??? log (
 ??? ??? info,
 ??? ??? concat (
 ??? ??? ??? "Host:", pick-first-value(option fqdn.hostname, option host-name, 
"(none)"), "=>", pick-first-value(config-option 
server.ddns-hostname, "(none)")
...
 ??? ??? ??? ,"? GIaddr:", pick-first-value(binary-to-ascii(10, 8, ".", 
packet(24,4)), "(none)")
#?? ??? ??? ?,"? Circuit:", pick-first-value(binary-to-ascii(10, 8, ":", option 
agent.circuit-id), "(none)")
#?? ??? ??? ?,"? Remote:", pick-first-value(option agent.remote-id, "(none)")

 ??? ?? ??? ?,"? ReqOpt:", pick-first-value(binary-to-ascii(10, 8, ",", option 
dhcp-parameter-request-list), "(none)")
 ??? ??? )
 ??? );
}

Bill

On 2/12/2018 5:35 PM, Gregory Sloop wrote:
> Re: Logging GI-Addr
>
>       " ?GIaddr:", pick-first-value(binary-to-ascii(10, 8, ".", 
> packet(24,4)), "(none)")
>
>
>
> So, let me break this down, and see if I understand it correctly.
> Starting from the inside...
>
> Offset into the packet 24 bytes, and return 4 bytes [4 octets].
> ---
> ?I think this means that the OP, HType, HLen and HOPS, [4 bytes / 1 octet 
> [each] *4]
> ?XID [4 octets / 4 bytes]
> ?SECs and FLAGs [4 bytes, 2 octets each*2]
> ?Then continue to offset past the CIADDR, YADDR & SIADDR (Four octets, 4 
> bytes each in IPV4) to get to the GIAddr, at byte 24.
> ?Grab 4 bytes, 4 octets
>
> ?[The wikipedia page on dhcp is pretty handy here! 
> https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol]
> ---
>
> Convert from binary to ASCII from base 8 to base 10. Separate the items with 
> "."
>
> Grab the first non-null output from that output of binary-to-ascii.
> If there's no GIAddr in this packet, return "(none)"
>
> Do I have that right?
>
> Thanks so much!
>
> -Greg
>
>
>
>
>
> _______________________________________________
> dhcp-users mailing list
> dhcp-users@lists.isc.org
> https://lists.isc.org/mailman/listinfo/dhcp-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<https://lists.isc.org/pipermail/dhcp-users/attachments/20180212/de25402f/attachment.html>

------------------------------

Subject: Digest Footer

_______________________________________________
dhcp-users mailing list
dhcp-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/dhcp-users

------------------------------

End of dhcp-users Digest, Vol 112, Issue 8
******************************************

Reply via email to