<div dir="ltr">Hi Simon,<div><br></div><div>I relly have some hosts declarations, but I don't have put these in the post.<br><br>Now really I have the config about this:<br><br>###############################################################<br>ddns-update-style none;<br>log-facility local7;<br><br>default-lease-time 7200;<br>max-lease-time 7200;<br>update-static-leases true;<br><br>authoritative;<br><br>option domain-name "<a href="http://company-test.com">company-test.com</a>";<br>option domain-search "<a href="http://company-test.es">company-test.es</a>","<a href="http://company-test.info">company-test.info</a>","<a href="http://company-test.com">company-test.com</a>";<br>option domain-name-servers 10.53.1.2, 8.8.8.8; <br><br>lease-file-name "/var/lib/dhcp/dhcpd.leases";<br><br>#******* Hosts Declarations *******#<br>class "smartphones" {<br>  match if option vendor-class-identifier = "android-dhcp-9";<br>}<br><br>#******* VLAN1 (<a href="http://10.53.0.0/16">10.53.0.0/16</a>) *******#<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>#******* VLAN10 (<a href="http://10.188.10.0/24">10.188.10.0/24</a>) *******#<br>subnet 10.153.10.0 netmask 255.255.255.0 {<br><br>  option broadcast-address 10.153.10.255;<br>  option routers 10.153.10.1;<br><br>  pool {<br>    range 10.153.10.50 10.153.10.99;<br>  }<br><br>  host PC-10-01 {<br>    hardware ethernet ff:ff:ff:ff:ff:10;<br>    fixed-address 10.153.10.5;<br>  }<br><br>}<br>###############################################################<br><br>This config seems that works, classifing the "smartphones" and assigning a IP from "range 10.53.10.2 10.53.11.254;" and assigning to unknown devices from "range 10.53.33.1 10.53.35.254;"<br><br>I'm going to test:<br><br>------------------------------------------------------<br>class "smartphones" {<br>  match if not known and (<br>    substring(option vendor-class-identifier,0,12) = "android-dhcp-" or<br>    substring(option vendor-class-identifier,0,6) = "dhcpcd-" or<br>    substring(option vendor-class-identifier,0,14) = "HUAWEI:android:" or<br>  );<br>}<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><br>Best regards<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El lun., 5 ago. 2019 a las 11:13, Simon Hobson (<<a href="mailto:dhcp1@thehobsons.co.uk">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>
> I'm testing this:<br>
<br>
And finding that it doesn't do what you expect !<br>
<br>
> ###############################################################<br>
> class "smartphones" {<br>
>   match if option vendor-class-identifier = "android-dhcp-9";<br>
> }<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 known-clients;<br>
>     range 10.53.33.1 10.53.35.254;<br>
>   }<br>
> ..<br>
>   # Smartphones Range.<br>
>   pool {<br>
>     allow members of "smartphones";<br>
>     deny known-clients;<br>
>     range 10.53.10.2 10.53.11.254;<br>
>   }..<br>
> ###############################################################<br>
> <br>
> My smartphone have a IP from "range 10.53.33.1 10.53.35.254;"<br>
> <br>
> To test if the classification work, I turn off the WIFI of my smartphone, wait some seconds and turn on the WIFI again, but the WIFI get the same IP that it had previously from "range 10.53.33.1 10.53.35.254;".<br>
> <br>
> Can you tell me how I can test this config correctly?<br>
<br>
Two things :<br>
<br>
If you refer to man dhcpd.conf you'll see that a "known" client is one that has a host declaration. Since you have no known clients, all of them are unknown and you cannot separate clients into pools using (un)known-client.<br>
<br>
DO NOT MIX ALLOW AND DENY ! They do not work as most people expect them to (specifically they are **NOT** evaluated top-down as a list, stopping at the first match), and rather than working out what the mix does, simply use only allow or only deny. If you use an allow statement, then anything not allowed is automatically disallowed (an implicit "deny all"). Similarly, if you use a deny statement, then anything not denied is automatically allowed (implicit "allow all").<br>
<br>
So you probably want to do this :<br>
<br>
  # Unknown Clients Range.<br>
  pool {<br>
    deny members of "smartphones";<br>
    # Note that he use of deny here implicitly allows everything else<br>
    range 10.53.33.1 10.53.35.254;<br>
  }<br>
..<br>
  # Smartphones Range.<br>
  pool {<br>
    allow members of "smartphones";<br>
    # Note that the allow statement here implicitly denies everything else<br>
    range 10.53.10.2 10.53.11.254;<br>
  }..<br>
<br>
When you expand you config, you'll end up with :<br>
  # Unknown Clients Range.<br>
  pool {<br>
    deny members of "smartphones";<br>
    deny members of "tablets";<br>
    deny members of "laptops";<br>
    range 10.53.33.1 10.53.35.254;<br>
  }<br>
AFAIK there is no easier way to do this bit other than listing all the classes that can't use the pool. You do have to explicitly deny the classes here, otherwise members of them are still allowed to have addresses from that pool.<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_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>