<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
I think you're confused. A "known host" is any host that is
defined. It<br>
can be static or dynamic. Consider:<br>
<font color="#993300"><tt>host printer_1 {</tt><tt><br>
</tt><tt> hardware ethernet 00:11:22:33:44:55;</tt><tt><br>
</tt><tt> fixed-address 172.16.20.201;</tt><tt><br>
</tt><tt>}</tt><tt><br>
</tt><tt>host printer_2 {</tt><tt><br>
</tt><tt> hardware ethernet 11:22:33:44:55:66;</tt><tt><br>
</tt><tt>}</tt><tt><br>
</tt></font>printer_1 will get a static address; printer_2 will
get dynamic; both are<br>
known hosts because they are defined. MAC address 22:33:44:55:66:77<br>
is not defined in the dhcpd.conf and therefore is an
"unknown-client".<br>
<br>
HTH,<br>
Bill<br>
<br>
<br>
<div class="moz-cite-prefix">On 10/19/2017 5:26 AM, Narcis Garcia
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:ff335a9e-6e0c-c051-ad47-4f08d01b88cf@actiu.net">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<p>Okay, I've solved with your example, dhcp-eval manpage, and
Glenn Satchell's AA-01039 answer in ISC<b>:</b></p>
<p><tt>on commit {</tt><tt><br>
</tt><tt> if static {</tt><tt><br>
</tt><tt> set KnownHost =
pick-first-value(host-decl-name, "(none)");</tt><tt><br>
</tt><tt> } else {</tt><tt><br>
</tt><tt> set KnownHost = "(dynamic)";</tt><tt><br>
</tt><tt> }</tt><tt><br>
</tt><tt> set MacString = concat(</tt><tt><br>
</tt></p>
<p><tt> </tt><tt> suffix(concat ("0",
binary-to-ascii (16, 8, "", substring(hardware,1,1))),2), ":",</tt><br>
</p>
<tt> </tt><tt> suffix(concat ("0", binary-to-ascii
(16, 8, "", substring(hardware,2,1))),2), ":",</tt><tt><br>
</tt><tt> suffix(concat ("0", binary-to-ascii (16,
8, "", substring(hardware,3,1))),2), ":",</tt><tt><br>
</tt><tt> suffix(concat ("0", binary-to-ascii (16,
8, "", substring(hardware,4,1))),2), ":",</tt><tt><br>
</tt><tt> suffix(concat ("0", binary-to-ascii (16,
8, "", substring(hardware,5,1))),2), ":",</tt><tt><br>
</tt><tt> suffix(concat ("0", binary-to-ascii (16,
8, "", substring(hardware,6,1))),2)</tt><tt><br>
</tt><tt> );</tt><tt><br>
</tt><tt><br>
</tt><tt> log(info, concat(</tt><tt><br>
</tt><tt> "KnownHost:", KnownHost</tt><tt><br>
</tt><tt> ," ClientHostname:",
pick-first-value(option fqdn.hostname, option host-name,
config-option server.ddns-hostname, "(none)")</tt><tt><br>
</tt><tt> ," MAC:", MacString</tt><tt><br>
</tt><tt> ," leased-address:", pick-first-value(
binary-to-ascii(10, 8, ".", leased-address), "(none)")</tt><tt><br>
</tt><tt> ," lease-time:",
pick-first-value(binary-to-ascii(10,32,"",encode-int(lease-time,32)),
"(none)")</tt><tt><br>
</tt><tt> ));</tt><tt><br>
</tt><tt>}</tt><tt><br>
</tt><br>
<br>
<p><br>
</p>
<div class="moz-cite-prefix">El 19/10/17 a les 09:27, Narcis
Garcia ha escrit:<br>
</div>
<blockquote type="cite"
cite="mid:14d2c344-a164-7150-35b2-3982f993017d@actiu.net">
<pre wrap="">Thank you;
Is there some way to get the label of the host definition instead of
having to add a hostname/fqdn/identifier to each host?
(such as "printer_1" here)
host printer_1 {
hardware ethernet 00:11:22:33:44:55;
fixed-address 172.16.20.201;
}
El 19/10/17 a les 09:12, Bill Shirley ha escrit:
</pre>
<blockquote type="cite">
<pre wrap="">Add logging to your dhcpd.conf. Here is what I use:
on commit {
if static {
set is-static = " --> STATIC";
option dhcp-renewal-time = encode-int(43200 / 2, 32); #
43200 = 12 hours
option dhcp-rebinding-time = encode-int(43200 * 7 / 8, 32);
ddns-ttl = encode-int((43200 / 2) + 1, 32);
} else {
set is-static = "";
option dhcp-renewal-time = encode-int(lease-time / 2, 32);
option dhcp-rebinding-time = encode-int(lease-time * 7 / 8, 32);
ddns-ttl = encode-int((lease-time / 2) + 1, 32);
}
log ( info,
concat (
"Host:", pick-first-value(option fqdn.hostname, option
host-name, "(none)"), "=>", pick-first-value(config-option
server.ddns-hostname, "(none)")
," VendorId:", pick-first-value(option
vendor-class-identifier, "(none)")
," Lease:",
pick-first-value(binary-to-ascii(10,32,"",encode-int(lease-time,32)),
"(none)")
," Renewal:", pick-first-value(binary-to-ascii(10, 32, "",
config-option dhcp-renewal-time), "(none)")
," Rebind:", pick-first-value(binary-to-ascii(10, 32, "",
config-option dhcp-rebinding-time), "(none)")
," TTL:", pick-first-value(binary-to-ascii(10, 32, "",
config-option server.ddns-ttl), "(none)")
," GIaddr:", pick-first-value(binary-to-ascii(10, 8, ".",
packet(24,4)), "(none)")
, is-static
)
);
}
Bill
On 10/19/2017 3:00 AM, Narcis Garcia wrote:
</pre>
<blockquote type="cite">
<pre wrap="">isc-dhcp-server is currently logging in my system:
DHCPDISCOVER from 11:22:33:44:55:66 via eth0
DHCPOFFER on 172.16.20.201 to 11:22:33:44:55:66 via eth0
DHCPREQUEST for 172.16.20.201 from 11:22:33:44:55:66 via eth0
DHCPACK on 172.16.20.201 to 11:22:33:44:55:66 via eth0
How can I make the service logs some name about that known client? (such
as "printer_1")
Thanks.
_______________________________________________
dhcp-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:dhcp-users@lists.isc.org" moz-do-not-send="true">dhcp-users@lists.isc.org</a>
<a class="moz-txt-link-freetext" href="https://lists.isc.org/mailman/listinfo/dhcp-users" moz-do-not-send="true">https://lists.isc.org/mailman/listinfo/dhcp-users</a>
</pre>
</blockquote>
<pre wrap="">
_______________________________________________
dhcp-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:dhcp-users@lists.isc.org" moz-do-not-send="true">dhcp-users@lists.isc.org</a>
<a class="moz-txt-link-freetext" href="https://lists.isc.org/mailman/listinfo/dhcp-users" moz-do-not-send="true">https://lists.isc.org/mailman/listinfo/dhcp-users</a>
</pre>
</blockquote>
<pre wrap="">_______________________________________________
dhcp-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:dhcp-users@lists.isc.org" moz-do-not-send="true">dhcp-users@lists.isc.org</a>
<a class="moz-txt-link-freetext" href="https://lists.isc.org/mailman/listinfo/dhcp-users" moz-do-not-send="true">https://lists.isc.org/mailman/listinfo/dhcp-users</a></pre>
</blockquote>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
dhcp-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:dhcp-users@lists.isc.org">dhcp-users@lists.isc.org</a>
<a class="moz-txt-link-freetext" href="https://lists.isc.org/mailman/listinfo/dhcp-users">https://lists.isc.org/mailman/listinfo/dhcp-users</a></pre>
</blockquote>
<br>
</body>
</html>