IPv6 log remote-id

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

IPv6 log remote-id

Nicholas Thompson

I am having issues logging remote-id in IPv6.  I can see in the packet capture that option 37 does have the proper information.  

However when I attempt to log it I get blank string and the lines after it don't process either.


Here is what I have

log(info,
      concat("IP Address: ",
        binary-to-ascii(16, 16, ":", suffix(option dhcp6.ia-pd, 16)),
        "/",
        binary-to-ascii(10, 8, ":", substring(suffix(option dhcp6.ia-pd, 17), 0, 1)),
        " | Subscriber:",
        v6relay(1, option dhcp6.remote-id),
        " | MacID: ",
        binary-to-ascii(16, 8, ":", suffix(option dhcp6.client-id, 6))
      )
    );

Here is the log result:
IP Address: 2604:b400:1e59:b400:0:0:0:0/56 | Subscriber:

If I take out the subscriber section:
log(info,
      concat("IP Address: ",
        binary-to-ascii(16, 16, ":", suffix(option dhcp6.ia-pd, 16)),
        "/",
        binary-to-ascii(10, 8, ":", substring(suffix(option dhcp6.ia-pd, 17), 0, 1)),
      " | MacID: ",
        binary-to-ascii(16, 8, ":", suffix(option dhcp6.client-id, 6))
      )
    );

Here is the log result:
IP Address: 2604:b400:1e92:6700:0:0:0:0/56 | MacID: 0:23:6a:9:8e:2e

We have the same logging format working with IPv4 and option82 not sure why I can't log option 37 in v6

Thank you in advance for any help you can provide.
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: IPv6 log remote-id

perl-list
My understanding (and personal experience) is that, in the case of remote-id, dhcp doesn't attempt to decode it (RFC says not to), or does decode it and its binary (which won't log and will break the log line).

When I log, I log the option 18 / option 37 / ip-mac-lease details on separate lines in case of this type of thing. Binary values will break log lines.

You can probably decode the remote-id also if you can figure the proper parameters for binary-to-ascii() for that particular option (assuming the incoming value is binary encoded instead of ASCII).

Is remote-id supposed to be a mac address in your case? If so, something like this may work:

binary-to-ascii(16,8,":",v6relay(1,option dhcp6.remote-id))

----- Original Message -----
> From: "Nicholas Thompson" <[hidden email]>
> To: "Users of ISC DHCP" <[hidden email]>
> Sent: Wednesday, November 7, 2018 7:40:29 AM
> Subject: IPv6 log remote-id

> I am having issues logging remote-id in IPv6. I can see in the packet capture
> that option 37 does have the proper information.

> However when I attempt to log it I get blank string and the lines after it don't
> process either.

> Here is what I have

> log(info,
> concat("IP Address: ",
> binary-to-ascii(16, 16, ":", suffix(option dhcp6.ia-pd, 16)),
> "/",
> binary-to-ascii(10, 8, ":", substring(suffix(option dhcp6.ia-pd, 17), 0, 1)),
> " | Subscriber:",
> v6relay(1, option dhcp6.remote-id),
> " | MacID: ",
> binary-to-ascii(16, 8, ":", suffix(option dhcp6.client-id, 6))
> )
> );

> Here is the log result:
> IP Address: 2604:b400:1e59:b400:0:0:0:0/56 | Subscriber:

> If I take out the subscriber section:
> log(info,
> concat("IP Address: ",
> binary-to-ascii(16, 16, ":", suffix(option dhcp6.ia-pd, 16)),
> "/",
> binary-to-ascii(10, 8, ":", substring(suffix(option dhcp6.ia-pd, 17), 0, 1)),
> " | MacID: ",
> binary-to-ascii(16, 8, ":", suffix(option dhcp6.client-id, 6))
> )
> );

> Here is the log result:
> IP Address: 2604:b400:1e92:6700:0:0:0:0/56 | MacID: 0:23:6a:9:8e:2e

> We have the same logging format working with IPv4 and option82 not sure why I
> can't log option 37 in v6

> Thank you in advance for any help you can provide.
> _______________________________________________
> dhcp-users mailing list
> [hidden email]
> https://lists.isc.org/mailman/listinfo/dhcp-users
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

RE: IPv6 log remote-id

Nicholas Thompson
In reply to this post by Nicholas Thompson
Thanks you for getting me looking in the right direction again, we did not have to do binary-to-ascii.  What I did have to do it get just the last 10 bytes that are the string the first 4 are the enterprise id and is in binary.  That was not the case in v4

Here is what I have now:
    log(info, (concat("Customer: ", suffix(v6relay(1, option dhcp6.remote-id), 10),
        " | IP Address: ", binary-to-ascii(16, 16, ":", suffix(option dhcp6.ia-pd, 16)),
        "/", binary-to-ascii(10, 8, ":", substring(suffix(option dhcp6.ia-pd, 17), 0, 1)),
        " | MacID: ", binary-to-ascii(16, 8, ":", suffix(option dhcp6.client-id, 6)),
        " | Interface ID ",
        v6relay(1, option dhcp6.interface-id)
    )));

And it outputs a log like
Customer: 10001XXXXX | IP Address: 2604:b400:1e25:3d00:0:0:0:0/56 | MacID: 0:23:6a:e:e2:bd | Interface ID JK-1 eth 3/1/5

-----Original Message-----
From: Nicholas Thompson
Sent: Wednesday, November 07, 2018 7:40 AM
To: '[hidden email]' <[hidden email]>
Subject: IPv6 log remote-id


I am having issues logging remote-id in IPv6.  I can see in the packet capture that option 37 does have the proper information.  

However when I attempt to log it I get blank string and the lines after it don't process either.


Here is what I have

log(info,
      concat("IP Address: ",
        binary-to-ascii(16, 16, ":", suffix(option dhcp6.ia-pd, 16)),
        "/",
        binary-to-ascii(10, 8, ":", substring(suffix(option dhcp6.ia-pd, 17), 0, 1)),
        " | Subscriber:",
        v6relay(1, option dhcp6.remote-id),
        " | MacID: ",
        binary-to-ascii(16, 8, ":", suffix(option dhcp6.client-id, 6))
      )
    );

Here is the log result:
IP Address: 2604:b400:1e59:b400:0:0:0:0/56 | Subscriber:

If I take out the subscriber section:
log(info,
      concat("IP Address: ",
        binary-to-ascii(16, 16, ":", suffix(option dhcp6.ia-pd, 16)),
        "/",
        binary-to-ascii(10, 8, ":", substring(suffix(option dhcp6.ia-pd, 17), 0, 1)),
      " | MacID: ",
        binary-to-ascii(16, 8, ":", suffix(option dhcp6.client-id, 6))
      )
    );

Here is the log result:
IP Address: 2604:b400:1e92:6700:0:0:0:0/56 | MacID: 0:23:6a:9:8e:2e

We have the same logging format working with IPv4 and option82 not sure why I can't log option 37 in v6

Thank you in advance for any help you can provide.
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users