Problems using class match by user-option
Bill Shirley
bill at c3po.polymerindustries.biz
Thu Dec 7 12:48:47 UTC 2017
Class/subclass would better fit your needs:
# -------------
class "gaeste" {
match hardware;
option routers 10.69.0.251; # can set the routers here or in "gaste" pool
}
# MAC address is preceded by '1:' indicating ethernet
subclass "gaeste" 1:aa:bb:cc:dd:ee:ff; # test1
# -------------
# -------------
class "subnet2" {
match hardware;
}
subclass "subnet2" 1:bb:cc:dd:ee:ff:aa; # test2
subclass "subnet2" 1:cc:dd:ee:ff:aa:bb { # test3 - can have additional settings
ddns-hostname = "test3-PC";
ddns-domainname "different.domain.com";
}
# -------------
shared-network tfd {
subnet 10.69.0.0 netmask 255.255.0.0 {
...
pool { # host test1 should get IP of this pool
allow members of "gaeste";
# option routers 10.69.0.251;
range 10.69.253.1 10.69.253.254;
}
}
subnet 130.75.69.0 netmask 255.255.255.0 {
...
pool { # host test2 should get IP of this pool
allow members of "subnet2";
range 130.75.69.50 130.75.69.60;
....
}
pool { # NO INTERNET
deny members of "gaeste";
deny members of "subnet2";
range 130.75.69.61 130.75.69.70;
....
}
}
}
#host test1 {
# hardware ethernet aa:bb:cc:dd:ee:ff;
# option tfd-scope-identifier "gaeste";
#}
#host test2 {
# hardware ethernet bb:cc:dd:ee:ff:aa;
#}
Host declarations are global and should not be inside any
other structure except 'group'. Pools should be inside subnet
declarations.
There are other ways to do class matches:
class "10.mobile_device" {
match if (
option host-name ~~ "dhcpcd"
or option host-name ~~ "android"
or option vendor-class-identifier ~~ "android"
or option host-name ~~ "samsung-sm"
or option host-name ~~ "iphone"
or option host-name ~~ "ipod"
or option host-name ~~ "ipad"
or option host-name ~~ "watch"
);
if (lcase(option host-name) = "iphone") { ddns-hostname = concat("iPhone-", binary-to-ascii(16, 8, "", substring(hardware,
4, 3))); }
if (lcase(option host-name) = "iphone-2") { ddns-hostname = concat("iPhone2-", binary-to-ascii(16, 8, "",
substring(hardware, 4, 3))); }
if (lcase(option host-name) = "ipod") { ddns-hostname = concat("iPod-", binary-to-ascii(16, 8, "", substring(hardware, 4,
3))); }
if (lcase(option host-name) = "ipad") { ddns-hostname = concat("iPad-", binary-to-ascii(16, 8, "", substring(hardware, 4,
3))); }
if (substring(lcase(option host-name), 0, 10) = "samsung-sm") {
ddns-hostname = concat("samsung-", binary-to-ascii(16, 8, "", substring(hardware, 4, 3)));
}
}
The 'if' statements above creates a unique name for those people
that leave their iPhone name with the out-of-the-box default name.
~~ is a regex comparison.
Kyocera printer:
class "Kyocera" {
# match if substring(hardware, 1,3) = 00:c0:ee;
match if (
substring(hardware, 1,3) = 00:c0:ee
or substring(hardware, 1,3) = 00:17:c8
);
}
Bill
On 12/7/2017 3:49 AM, Sven Schumacher wrote:
> class "gaeste" {
> match if (config-option tfd-scope-identifier = "gaeste");
> }
>
> shared-network tfd {
>
> subnet 10.69.0.0 netmask 255.255.0.0 {
> deny unknown-clients;
> ...
> }
> subnet 130.75.69.0 netmask 255.255.255.0 {
> deny unknown-clients;
> ...
> }
>
> host test1 {
> hardware ethernet aa:bb:cc:dd:ee:ff;
> option tfd-scope-identifier "gaeste";
> }
> host test2 {
> hardware ethernet bb:cc:dd:ee:ff:aa;
> }
> pool { # host test2 should get IP of this pool
> range 130.75.69.50 130.75.69.60;
> deny members of "gaeste";
> ....
> }
> pool { # host test1 should get IP of this pool, but didn't
> range 10.69.253.1 10.69.253.254;
> option routers 10.69.0.251;
> allow members of "gaeste";
> }
> }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20171207/cb6fd76f/attachment.html>
More information about the dhcp-users
mailing list