clients with no hostname

Glenn Satchell glenn.satchell at uniq.com.au
Thu Jan 19 11:16:50 UTC 2012


On 01/19/12 13:49, jeffrey j donovan wrote:
>
> On Jan 18, 2012, at 10:03 AM, Glenn Satchell wrote:
>
>> There are a few ways you can do it on the server, eg:
>>
>> option hostname = pick-first-value (option hostname, binary-to-ascii( ...) );
>>
>> where the unique string for the default hostname can be derived from the mac or ip address using binary-to-ascii, eg:
>>
>> concat (binary-to-ascii (10, 8, "-", leased-address), "-dhcp");
>>
>> concat (binary-to-ascii (16, 8, "-", substring (hardware, 1, 6), "-dhcp");
>>
>> Useful man pages are dhcp-options and dhcp-eval.
>>
>> regards,
>> -glenn
>>
>
> thanks for the reply glenn,
>
> I'm a little confused on how to trigger if the hostname is blank. Ive already been able to group by the first characters in the hostname.
> sample of my config.
> class "FHS" {
>          match if substring (option host-name,0,3) = "FHS"
>           or substring (option host-name,0,3) = "CFF";
> }
>
>
> could i do something like this ?
>
> class "FOO" {
>          match if substring (option host-name,0,8) = " ";
> }
>
>
> does that look correct ?

The pick-first-value() function does that for you - it returns the first 
non-null argument.

class "FOO" {
          match if pick-first-value (substring (option host-name,0,8), 
"something") = "abcdefgh";
}

But usually done like this:

option host-name = pick-first-value (substring (option host-name,0,8), 
"something");

and the host-name option will be set to the sub-string if it is 
non-null, or the value "something" otherwise. Yo can put more choices 
inhere, or create a string based on the ip or mac address.

To see if an option is set use exists(), so this would create a class of 
devices with no host-name set.

class "FOO" {
          match if not exists (option host-name);
          # we don't have a host-name set
}

and then permit or deny those classes in the appropriate pools.

regards,
-glenn

> -j
>
>
>> On 01/19/12 00:05, jeffrey j donovan wrote:
>>> Greetings
>>>
>>> I have been giving out ip addresses to machines on my network. I'm looking at my lease file and I have found many devices do not have a hostname identifier.
>>>
>>> IP address: 10.153.15.101    Lease status: Active    Lease start: 17/01/2012 09:01:11    Lease end: 18/01/2012 09:01:11    Mac address: 00:1e:52:70:f7:53    WINS name: FHS-CFF-LA06-06
>>> IP address: 10.153.15.114    Lease status: Active    Lease start: 17/01/2012 09:01:35    Lease end: 18/01/2012 09:01:35    Mac address: 00:1e:52:70:f7:5e    WINS name: FHS-CFF-LA06-02
>>> IP address: 10.153.15.115    Lease status: Active    Lease start: 17/01/2012 08:27:05    Lease end: 18/01/2012 08:27:05    Mac address: 00:23:12:06:20:4a
>>> IP address: 10.153.15.117    Lease status: Active    Lease start: 17/01/2012 08:45:28    Lease end: 19/01/2012 08:45:28    Mac address: 00:23:12:06:20:6e
>>>
>>>
>>> how can I ensure a client has a hostname before dhcp hands out an address . in this case, two machines have the correct WINS name, the other has nothing.
>>>
>>> Is there a way I can say,...
>>>
>>> If WINS name =  " blank" then send this address , else send this.
>>>
>>> or
>>>
>>> if WINS name = F00 then send " ipaddress "
>>>
>>>
>>> any insight would be helpful.
>>> -j



More information about the dhcp-users mailing list