variables in configuration

Nenad Tomasevic Nenad.Tomasevic at bnet.hr
Tue Jun 30 12:31:06 UTC 2009


Hello,

I'm trying to get configuration file which will be assigning config files to clients based on predefined variables, more precise based on option 82 parameters in the dhcp request, so, if in dhcp request the option agent.circuit-id is "switch01" and option agent.remote-id is "01", the bootfile-name in dhcp offer will be "switch01.01.cfg".

here is my lame attempt to do that, dhcpd.conf;
 
#!/bin/bash

agent-id="option agent.remote-id";
circuit-id="option agent.circuit-id";

#local subnet
subnet 10.18.7.96 netmask 255.255.255.224 {

  option subnet-mask 255.255.255.224;
  option routers 10.18.7.97;
  option tftp-server-name "10.18.7.126";
  option bootfile-name "$circuit-id.$agent-id.cfg";


  range 10.18.7.110 10.18.7.120;
  default-lease-time 259200;
  max-lease-time  518400;
}

and that don't work, dhcp offer takes $circuit-id.$agent-id.cfg as bootfile-name, suprise, suprise (actually, i'm showing you the file only to make my idea more understandable)... :))
 



question is, is it possible to make such thing and if it is, in which direction I must look to achieve that?
point of the hole thing is to make dhcp server with 100% uptime because it wont need restart every time when configuration is changed.

Nenad

 



More information about the dhcp-users mailing list