<div dir="ltr">Hi again,<br><br>I have tested this and work:<br><br>--------------------------------------------------------------------------<br>class "smartphones" {<br><br> match if substring(option vendor-class-identifier,0,13) = "android-dhcp-" or<br> substring(option vendor-class-identifier,0,7) = "HUAWEI:" or<br> substring(option vendor-class-identifier,0,7) = "dhcpcd-";<br><br>}<br>--------------------------------------------------------------------------<br><br>But if I change it to:<br><br>--------------------------------------------------------------------------<br>class "smartphones" {<br><br> match if substring(option vendor-class-identifier,0,13) or<br> substring(option vendor-class-identifier,0,7);<br><br>}<br><br>subclass "smartphones" "android-dhcp-";<br>subclass "smartphones" "HUAWEI:";<br>subclass "smartphones" "dhcpcd-";<br>--------------------------------------------------------------------------<br><br>When I reload the config in the server, It shows me this error:<br><br>--------------------------------------------------------------------------<br># service dhcp-server force-reload <br>dhcpd self-test failed. Please fix the config file.<br>The error was: <br>Internet Systems Consortium DHCP Server 4.1.1-P1<br>Copyright 2004-2010 Internet Systems Consortium.<br>All rights reserved.<br>For info, please visit <a href="https://www.isc.org/software/dhcp/">https://www.isc.org/software/dhcp/</a><br>/etc/dhcp/dhcpd.conf line 67: expecting boolean expressions<br> substring(option vendor-class-identifier,0,7);<br> ^<br>WARNING: Host declarations are global. They are not limited to the scope you declared them in.<br>Configuration file errors encountered -- exiting<br># <br>--------------------------------------------------------------------------<br><br>I can't do this or I am doint it wrong?<br><br>Best regards<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El jue., 8 ago. 2019 a las 7:50, Bill Shirley (<<a href="mailto:bill@c3po.polymerindustries.biz">bill@c3po.polymerindustries.biz</a>>) escribió:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
Here's a couple of classes you might find useful:<br>
<font color="#993300"><tt>class "mobile_device" {</tt><tt><br>
</tt><tt> match if (</tt><tt><br>
</tt><tt> option vendor-class-identifier ~~ "android"</tt><tt><br>
</tt><tt> or option host-name ~~ "android"</tt><tt><br>
</tt><tt> or option host-name ~~ "iphone"</tt><tt><br>
</tt><tt> or option host-name ~~ "samsung-"</tt><tt><br>
</tt><tt> or option host-name ~~ "galaxy"</tt><tt><br>
</tt><tt> or option host-name ~~ "ipod"</tt><tt><br>
</tt><tt> or option host-name ~~ "ipad"</tt><tt><br>
</tt><tt> or option host-name ~~ "watch"</tt><tt><br>
</tt><tt> or option host-name ~~ "nintendo 3ds"</tt><tt><br>
</tt><tt> );</tt><tt><br>
</tt><tt>}</tt><tt><br>
</tt><tt>class "Microsoft" {</tt><tt><br>
</tt><tt> match if substring(option vendor-class-identifier, 0,
4) = "MSFT";</tt><tt><br>
</tt><tt> set member_of = "Microsoft";</tt><tt><br>
</tt><tt>}</tt><tt><br>
</tt></font>The first class uses the regexp operator ~~ (case
insensitive). There is also the<br>
case sensitive operator ~=.<br>
<br>
On the subject of implicit deny for a pool with only "allow
members":<br>
I classify most of my devices (i.e. Panasonic, Ricoh, Canon, Linux,
Microsoft) to assign<br>
them to a specific pool (i.e Printers, Linux, Microsoft,
mobile_device). Then I have an<br>
"uncategorized" pool for those devices that aren't in a currently
defined class so that they<br>
will get an address. If later I change a class to include a device
(say Epson), that device<br>
will request its previous address on renew and <b>will get it</b>
if my "uncategorized" pool doesn't<br>
have a 'deny members of "Epson"' configuration line.<br>
<br>
TL;DR - If a device requests a renewal of an address and there is no
"deny members" for<br>
the pool, it will be granted.<br>
<br>
dhcp-server-4.3.6-10.fc27.x86_64<br>
<br>
Bill<br>
<br>
<div class="gmail-m_-817474410703249745moz-cite-prefix">On 8/7/2019 8:42 AM, Juan Antonio
García Moreno wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>Hi Simon,<br>
<br>
Too much thanks by your anotation about the Hosts
Declarations. I will keep them in mind and I will change it.<br>
<br>
About the Hosts Classifications, I have tested this and works
for me:<br>
<br>
------------------------------------------------------------------------------<br>
class "smartphones" {<br>
match if substring(option vendor-class-identifier,0,13) =
"android-dhcp-" or<br>
substring(option vendor-class-identifier,0,7) =
"HUAWEI:" or<br>
substring(option vendor-class-identifier,0,7) =
"dhcpcd-";<br>
}<br>
------------------------------------------------------------------------------<br>
<br>
That is the same that this:<br>
<br>
------------------------------------------------------------------------------<br>
class "smartphones" {<br>
match option vendor-class-identifier;<br>
}<br>
<br>
subclass "smartphones" "android-dhcp-9"<br>
subclass "smartphones" "android-dhcp-8.1.0"<br>
subclass "smartphones" "android-dhcp-7.0"<br>
subclass "smartphones" "HUAWEI:android:FIG-L11"<br>
subclass "smartphones" "HUAWEI:android:QC_Reference_Phone"<br>
subclass "smartphones" "dhcpcd-5.5.6"<br>
------------------------------------------------------------------------------<br>
<br>
And I can change it to:<br>
<br>
------------------------------------------------------------------------------<br>
class "smartphones" {<br>
match option vendor-class-identifier;<br>
}<br>
<br>
include smartphones.cfg<br>
<br>
* smartphones.cfg file containing the subclass lines.<br>
------------------------------------------------------------------------------<br>
<br>
But, is there any way to minimize the number of lines to
include in the smartphones.cfg file using some kind of
wildcard or expression/function like "substring()" used in the
Class Declaration?<br>
<br>
Another question:<br>
<br>
The iPhones and the iPads not send the
"vendor-class-identifier" option in the DHCP Discover Packet.<br>
<br>
Could I classify iPhones and iPads taking into account some
other parameter of the DHCP Discover Packet?<br>
<br>
<br>
Best regards<br>
</div>
<div><br>
</div>
<div><br>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">El lun., 5 ago. 2019 a las
19:35, Simon Hobson (<<a href="mailto:dhcp1@thehobsons.co.uk" target="_blank">dhcp1@thehobsons.co.uk</a>>)
escribió:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Juan Antonio García
Moreno <<a href="mailto:jagarcia@emergya.com" target="_blank">jagarcia@emergya.com</a>>
wrote:<br>
<br>
> I relly have some hosts declarations, but I don't have
put these in the post.<br>
<br>
Ah yes, about that ... see below !<br>
<br>
> subnet 10.53.0.0 netmask 255.255.0.0 {<br>
> <br>
> default-lease-time 86400;<br>
> max-lease-time 172800;<br>
> <br>
> option broadcast-address 10.53.255.255;<br>
> option routers 10.53.1.1;<br>
> <br>
> # Unknown Clients Range.<br>
> pool {<br>
> deny members of "smartphones";<br>
> range 10.53.33.1 10.53.35.254;<br>
> }<br>
> <br>
> # Smartphones Range.<br>
> pool {<br>
> allow members of "smartphones";<br>
> range 10.53.10.2 10.53.11.254;<br>
> }<br>
> <br>
> host PC-01 {<br>
> hardware ethernet ff:ff:ff:ff:ff:01;<br>
> fixed-address 10.53.100.5;<br>
> }<br>
> <br>
> host PC-02 {<br>
> hardware ethernet ff:ff:ff:ff:ff:02;<br>
> fixed-address 10.53.100.6;<br>
> }<br>
> <br>
> }<br>
<br>
That is another common mistake. Host declarations are always
global in scope even though you might think that putting
them inside a subnet declaration would tie them to that
subnet. So even though declared inside one subnet, they will
be "known" in any subnet - which in itself can cause
considerable confusion.<br>
But what really makes life "interesting" (see <a href="https://en.wikipedia.org/wiki/May_you_live_in_interesting_times" rel="noreferrer" target="_blank">https://en.wikipedia.org/wiki/May_you_live_in_interesting_times</a>)
is that should a host be connected to a different network,
it will inherit option values from the subnet where it is
defined. Thus you find yourself with a client that's been
given an address by DHCP, but the gateway address it's been
given is in a completely different subnet !<br>
<br>
<br>
> And too, howto fill a text file with the
"vendor-class-identifier" of the smartphones and include in
the DHCP Server config to match the smartphones devices too.<br>
<br>
It's a simple scripting exercise to take a text file
containing one string per line, and build a config file
snippet. You can then use an include statement to
incorporate that config snippet into the daemon config.<br>
<br>
_______________________________________________<br>
dhcp-users mailing list<br>
<a href="mailto:dhcp-users@lists.isc.org" target="_blank">dhcp-users@lists.isc.org</a><br>
<a href="https://lists.isc.org/mailman/listinfo/dhcp-users" rel="noreferrer" target="_blank">https://lists.isc.org/mailman/listinfo/dhcp-users</a><br>
</blockquote>
</div>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr" class="gmail-m_-817474410703249745gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr"><a href="http://www.emergya.com/" rel="noopener" alt="www.emergya.com" target="_blank"><img alt="EMERGYA" src="https://drive.google.com/uc?export=view&id=1Qq3n-rKeCyFt3CQBeL55l8d_ynzEikrr" style="border: 0px; height: auto; width: 80px; padding: 6px;" width="80" border="0"></a>
<table cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:305px;padding-bottom:3px;padding-left:10px;vertical-align:top;line-height:25px" valign="top"><strong style="color:rgb(12,35,64);font-family:Roboto,Verdana,sans-serif;font-size:10pt"><span style="font-size:12pt;color:rgb(239,51,64)">Juan García</span></strong><font face="Roboto, Verdana,
sans-serif" color="#0c2340"><span style="font-size:10pt"> </span></font><br>
<pre><font face="times new roman, serif" color="#444444"><b>Dto. de Soporte Interno</b></font><font face="Roboto, Verdana, sans-serif" color="#444444"><span style="font-size:13.3333px">
</span></font></pre>
<span style="color:rgb(12,35,64);font-family:Roboto,Verdana,sans-serif;font-size:11pt"><strong>EMERGYA
INGENIERÍA</strong></span></td>
</tr>
<tr>
<td style="font-size:10pt;color:rgb(68,68,68);font-family:Roboto,Verdana,sans-serif;padding-bottom:3px;padding-top:3px;padding-left:10px;vertical-align:top" valign="top"><span>
<pre><strong style="font-family:Roboto,Verdana,sans-serif;color:rgb(12,35,64);font-size:13.3333px">m:</strong><span style="font-size:10pt;font-family:Arial,sans-serif"> +34 954 517 577</span>
</pre>
</span><span><span style="color:rgb(12,35,64)"><strong>p:</strong></span><span style="font-size:10pt;font-family:Arial,sans-serif"> +34 954 517 577<br>
</span></span><span><span style="color:rgb(12,35,64)"><strong>e:</strong></span><span style="font-size:10pt;font-family:Arial,sans-serif"> <a href="mailto:jagarcia@emergya.com" target="_blank">jagarcia@emergya.com</a></span></span></td>
</tr>
<tr>
<td style="font-size:10pt;font-family:Arial,sans-serif;padding-bottom:5px;padding-top:5px;padding-left:10px;vertical-align:top" valign="top"><span><a href="https://www.linkedin.com/company/emergya" rel="noopener" target="_blank"><img alt="linkedin icon" src="https://drive.google.com/uc?export=view&id=14q9KMnHl26KNIOktIUE0SY3sPgQpFWS5" style="border: 0px; height: 23px; width: 23px;" width="23" border="0"></a> </span> <span><a href="https://www.facebook.com/Emergya" rel="noopener" target="_blank"><img alt="facebook icon" src="https://drive.google.com/uc?export=view&id=14LlHRBrAqHVDnAAy4ZeOiDWUtegdTCwT" style="border: 0px; height: 23px; width: 23px;" width="23" border="0"></a> </span> <span><a href="https://twitter.com/emergya" rel="noopener" target="_blank"><img alt="twitter icon" src="https://drive.google.com/uc?export=view&id=14LwyilYJrI3ovruB9yF8ZSF5YP0siLBp" style="border: 0px; height: 23px; width: 23px;" width="23" border="0"></a></span><span> </span> <span><a href="https://www.youtube.com/channel/UCU0ISPwk1pcOWwjpX63gN_A" rel="noopener" target="_blank"><img alt="youtube icon" src="https://drive.google.com/uc?export=view&id=14TBFW3LI-4fqSz3-Vqk9MM0B4wonpZVp" style="border: 0px; height: 23px; width: 23px;" width="23" border="0"></a> </span></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="gmail-m_-817474410703249745mimeAttachmentHeader"></fieldset>
<pre class="gmail-m_-817474410703249745moz-quote-pre">_______________________________________________
dhcp-users mailing list
<a class="gmail-m_-817474410703249745moz-txt-link-abbreviated" href="mailto:dhcp-users@lists.isc.org" target="_blank">dhcp-users@lists.isc.org</a>
<a class="gmail-m_-817474410703249745moz-txt-link-freetext" href="https://lists.isc.org/mailman/listinfo/dhcp-users" target="_blank">https://lists.isc.org/mailman/listinfo/dhcp-users</a>
</pre>
</blockquote>
</div>
_______________________________________________<br>
dhcp-users mailing list<br>
<a href="mailto:dhcp-users@lists.isc.org" target="_blank">dhcp-users@lists.isc.org</a><br>
<a href="https://lists.isc.org/mailman/listinfo/dhcp-users" rel="noreferrer" target="_blank">https://lists.isc.org/mailman/listinfo/dhcp-users</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><a href="http://www.emergya.com/" rel="noopener" alt="www.emergya.com" target="_blank"><img alt="EMERGYA" width="80" border="0" src="https://drive.google.com/uc?export=view&id=1Qq3n-rKeCyFt3CQBeL55l8d_ynzEikrr" style="border: 0px; height: auto; width: 80px; padding: 6px;"></a><table cellpadding="0" cellspacing="0"><tbody><tr><td valign="top" style="width:305px;padding-bottom:3px;padding-left:10px;vertical-align:top;line-height:25px"><strong style="color:rgb(12,35,64);font-family:Roboto,Verdana,sans-serif;font-size:10pt"><span style="font-size:12pt;color:rgb(239,51,64)">Juan García</span></strong><font color="#0c2340" face="Roboto, Verdana, sans-serif"><span style="font-size:10pt"> </span></font><br><pre><font color="#444444" face="times new roman, serif"><b>Dto. de Soporte Interno</b></font><font color="#444444" face="Roboto, Verdana, sans-serif"><span style="font-size:13.3333px"><br></span></font></pre><span style="color:rgb(12,35,64);font-family:Roboto,Verdana,sans-serif;font-size:11pt"><strong>EMERGYA INGENIERÍA</strong></span></td></tr><tr><td valign="top" style="font-size:10pt;color:rgb(68,68,68);font-family:Roboto,Verdana,sans-serif;padding-bottom:3px;padding-top:3px;padding-left:10px;vertical-align:top"><span><pre><strong style="font-family:Roboto,Verdana,sans-serif;color:rgb(12,35,64);font-size:13.3333px">m:</strong><span style="font-size:10pt;font-family:Arial,sans-serif"> +34 954 517 577</span><br></pre></span><span><span style="color:rgb(12,35,64)"><strong>p:</strong></span><span style="font-size:10pt;font-family:Arial,sans-serif"> +34 954 517 577<br></span></span><span><span style="color:rgb(12,35,64)"><strong>e:</strong></span><span style="font-size:10pt;font-family:Arial,sans-serif"> <a href="mailto:jagarcia@emergya.com" target="_blank">jagarcia@emergya.com</a></span></span></td></tr><tr><td valign="top" style="font-size:10pt;font-family:Arial,sans-serif;padding-bottom:5px;padding-top:5px;padding-left:10px;vertical-align:top"><span><a href="https://www.linkedin.com/company/emergya" rel="noopener" target="_blank"><img border="0" width="23" alt="linkedin icon" src="https://drive.google.com/uc?export=view&id=14q9KMnHl26KNIOktIUE0SY3sPgQpFWS5" style="border: 0px; height: 23px; width: 23px;"></a> </span> <span><a href="https://www.facebook.com/Emergya" rel="noopener" target="_blank"><img border="0" width="23" alt="facebook icon" src="https://drive.google.com/uc?export=view&id=14LlHRBrAqHVDnAAy4ZeOiDWUtegdTCwT" style="border: 0px; height: 23px; width: 23px;"></a> </span> <span><a href="https://twitter.com/emergya" rel="noopener" target="_blank"><img border="0" width="23" alt="twitter icon" src="https://drive.google.com/uc?export=view&id=14LwyilYJrI3ovruB9yF8ZSF5YP0siLBp" style="border: 0px; height: 23px; width: 23px;"></a></span><span> </span> <span><a href="https://www.youtube.com/channel/UCU0ISPwk1pcOWwjpX63gN_A" rel="noopener" target="_blank"><img border="0" width="23" alt="youtube icon" src="https://drive.google.com/uc?export=view&id=14TBFW3LI-4fqSz3-Vqk9MM0B4wonpZVp" style="border: 0px; height: 23px; width: 23px;"></a> </span></td></tr></tbody></table></div></div></div></div></div></div></div></div></div></div></div></div>