variables in configuration

Rask, Curt Curt_Rask at alliedtelesis.com
Tue Jun 30 17:07:07 UTC 2009


So, to summarize your intent, it sounds like you want to dynamically generate a bootfile name based off of something learned from the DHCP Discover / Request, in this case the Circuit ID and Remote ID from option 82.  One way to accomplish this is to use something like the following:

        option bootfile-name = concat((option agent.circuit-id),".",(option agent.remote-id),".cfg");

Curt



-----Original Message-----
From: dhcp-users-bounces at lists.isc.org [mailto:dhcp-users-bounces at lists.isc.org] On Behalf Of Nenad Tomasevic
Sent: Tuesday, June 30, 2009 8:31 AM
To: dhcp-users at lists.isc.org
Subject: variables in configuration

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


_______________________________________________
dhcp-users mailing list
dhcp-users at lists.isc.org
https://lists.isc.org/mailman/listinfo/dhcp-users



More information about the dhcp-users mailing list