Class matching based on client host name - solved

Mcwilliams, Rhys (ADP DSI) rhys_mcwilliams at adp.com
Fri May 16 06:04:17 UTC 2008


Hi Simon,
Thanks - made me look at the whole config properly and I found the
problem (quite stupid actually...) - the "ignore unknown-clients;" in
the "subnet" options MUST NOT BE THERE!!!! (I've hashed it already in
the config below).

As for the log - no - nothing is logged at all when I use my test
machine - (but I guess with the system being told to "ignore
unknown-clients;", why should it log anything ;) - and now (with the
correct config:D) it logs the "no free leases" if the machine name does
not match - yippeeeeeeeeee

In response to Niall's concern about the other possible case variations
of the windows names - we setup the machines in out workshop and set the
names - Windows defaults to upper case but sometimes the techie
remembers to run a small utility we use to change the machine name to
lower case. If a user modifies the machine name themselves then with the
DHCP config we trying to get we'd find those users when they are in the
other branch and can then slap them around a bit :)

######### Start of config
ddns-updates off;
server-identifier br1-DHCP;
ddns-update-style none;
log-facility local6;

	class "br2-clients" {
		match if (
		  (substring(option host-name,0,4) = "br2-") or
		  (substring(option host-name,0,4) = "BR2-"));
	}
# Internal network
shared-network BR1-INT {
	# LAN (subnet)
	subnet 10.10.11.0 netmask 255.255.255.0 {
		default-lease-time 604800;
		max-lease-time 604800;
		option ntp-servers 10.10.11.254;
		option domain-name "xyz.com";
		option broadcast-address 10.10.11.255;
		option subnet-mask 255.255.255.0;
		#ignore unknown-clients;  (this must not be here!!!)
		authoritative;
	        filename "pxelinux.0";
	        next-server 10.10.11.253;

		# Servers
		group {
			option routers 10.10.11.254;
			option domain-name-servers
10.10.11.252,10.10.11.251;
			ignore unknown-clients;
			use-host-decl-names on;
			host br1-server {
				hardware ethernet 00:1c:5d:2e:a6:05;
				fixed-address 10.10.11.225;
				}
			}
		# Printers
		group {
			option routers 10.10.11.254;
			option domain-name-servers
10.10.11.252,10.10.11.251;
			host br1-printer1 {
				hardware ethernet 00:2d:a1:cf:1d:6e;
				fixed-address 10.10.11.127;
				}
			}
		# Computers
		group {
			option routers 10.10.11.254;
			option domain-name-servers
10.10.11.252,10.10.11.251;
			host br1-john {
				hardware ethernet 00:11:e6:5c:3a:b3;
				fixed-address 10.10.11.160;
				}
			host br1-jane {
				hardware ethernet 00:2f:e9:5e:88:14;
				fixed-address 10.10.11.161;
				}
			}
		# Temp for training room
		group {
			option domain-name-servers 10.10.11.250;
			host TRAINN01 {
				hardware ethernet 00:8f:6c:49:d1:11;
				fixed-address 10.10.11.130;
				}
			}
		# Temp Workshop setups
		group {
			option routers 10.10.11.254;
			option domain-name-servers
10.10.11.252,10.10.11.251;
			host customerA {
				hardware ethernet 00:1d:37:2e:d8:ff;
				}
			}
		pool {
			allow members of "br2-clients";
			allow known-clients;
			max-lease-time 86400;
			default-lease-time 43200;
			range 10.10.11.0 10.10.11.61;
			}
	}
}
######### End of config 


Regards
---------------------------------------------
Rhys McWilliams


-----Original Message-----
From: dhcp-users-bounce at isc.org [mailto:dhcp-users-bounce at isc.org] On
Behalf Of Simon Hobson
Sent: 15 May 2008 16:50
To: dhcp-users at isc.org
Subject: Re: Class matching based on client host name

Mcwilliams, Rhys \(ADP DSI\) wrote:

>Scenario: I have 2 branches each with its own default gateway, DNS 
>servers etc... (lets call then "br1" & "br2") The Windows machine names

>are all prefixed with the branch name (e.g. br1-john or br2-peter). The

>users regularly travel between the branches.
>The dhcpd.conf will specify a "fixed-address" for each client of their 
>specific branch based on MAC (this is all up and running already).
>
>What I'm trying to achieve is a class match based on the first 4 
>characters of the users Windows machine name something like the 
>following # branch 2 DHCP server
>       class "br1-clients" {
>                 match if (
>                   (substring(option host-name,0,4) = "br1-") or
>                   (substring(option host-name,0,4) = "BR1-"));
>         }
>
># branch 1 DHCP server
>       class "br2-clients" {
>                 match if (
>                   (substring(option host-name,0,4) = "br2-") or
>                   (substring(option host-name,0,4) = "BR2-"));
>         }
>
>Then I need a pool on each to assign from based on the class something 
>like the following # branch 2 DHCP server (plus all the other usual 
>options like "option routers" etc local to each site)
>      pool {
>                         allow members of "br1-clients";
>                         allow known-clients;
>                         max-lease-time 86400;
>                         default-lease-time 43200;
>                         range 10.10.10.1 10.10.10.61;
>      }
>
># branch 1 DHCP server (plus all the other usual options like "option 
>routers" etc local to each site)
>      pool {
>                         allow members of "br2-clients";
>                         allow known-clients;
>                         max-lease-time 86400;
>                         default-lease-time 43200;
>                         range 10.10.11.1 10.10.11.61;
>      }
>
>So what should happen then is that if a user from br1 visits br2 - the 
>machine name starts with "br1-" and is therefore assigned an IP out of 
>the 10.10.10 pool.
>
>There seems to be a problem with this attempted config as my test 
>machines are not getting assigned IP's from the pool - it doesn't even 
>show anything in the log file while one of the machines is trying for 
>an IP. I'm guessing that my problem lies with the "(substring(option 
>host-name,0,4) = "br1-")". I'm using that because I found such an 
>example on the net (it didn't stat whether it work
>though...) and I can't find any other option...

You haven't posted the whole config file, so we have to guess at what
else you have included or omitted !

Do you have separate subnets (ie 10.10.10.0/24 & 10.10.11.0/24), one
larger one (eg 10.10.10.0/23), or soemthing totally different ?

If you have separate subnets, have you included them in a shared-subnet
declaration ?

Is anything at all logged ?


*********************************************************************
Disclaimer
This message and any attachments are intended only for the use of the addressee(s) and may contain information that is privileged and/or confidential. If the reader of the message is not the intended recipient(s) or an authorized representative of the intended recipient(s), please do not use, copy, distribute this email or its attachments or take action based on them. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system.
ADP Dealer Services South Africa, incorporated in the UK. Registration No. 1990/005462/10;
*********************************************************************


More information about the dhcp-users mailing list