Using custom variable to assign value to bootfile-name

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Using custom variable to assign value to bootfile-name

karteek.challa

Hi All,

 

I am facing problem when assigning the variable to the option bootfile-name. Request your help in solving this.

 

As we need to test multiple software packages, we need to change the bootfile-name frequently in the dhcp configuration file.

So, thought of assigning the bootfile-name option to a variable and passing the filename to the variable in a different file.

 

Generally the testers will always edit the dhcp configuration file to assign bootfile-name to their required software to test. In this process, so many times they are unknowingly changing the mac address of the target or some other which end up in problems.

Because of this issue, I am planning to make the dhcp configuration file as only readable to all users and create a separate file with write permission which contains the variables respective to each target and which are assigned with the required software.

Below is the example of my thought.

 

fsname.conf:

group target_1{

      set tg1_fs = “soft_1.tar”;

}

 

group target_2 {

      set tg2_fs = “soft_2.tar”;

}

 

group target_3{

      set tg3_fs = “soft_3.tar”;

}

 

group target_4{

     set tg4_fs = “soft_4.tar”;

}

 

My-dhcpd.conf:

host target1 {

hardware ethernet 00:1a:ea:4e:5e:0a;
fixed-address 10.10.10.1;

group “target_1”;

log (info, tg1_fs);
option boot-filename = tg1_fs;

log (info, boot-filename);

unset tg1_fs;
}

 

host target2 {
hardware ethernet 00:1a:ea:4e:5e:0b;
fixed-address 10.10.10.2;

group “target_2”;
option boot-filename = tg2_fs;

unset tg2_fs;
}

 

host target3 {
hardware ethernet 00:1a:ea:4e:5e:0c;
fixed-address 10.10.10.3;

group “target_3”;
option boot-filename = tg3_fs;

unset tg3_fs;
}

 

host target4 {
hardware ethernet 00:1a:ea:4e:5e:0d;
fixed-address 10.10.10.4;

group “target_4”;
option boot-filename = tg4_fs;

unset tg4_fs;
}

 

 

I tried with one host “host target1” by placing log() in its declaration.

I got "soft_1.tar" in the /var/log/messages 2 times.
This says that the variable fs and the option bootfile-name contains "soft_1.tar".
But the strange thing is that, in this way of assigning the bootfile-name, the software is not getting loaded in the target.
So, I have captured the tcpdump and observed in DHCP response packet that there is no option 67 Bootfile-name in Bootstrap Protocol.

Whereas, if I specify "option bootfile-name "soft_1.tar";" directly in the host declaration, the software is loading in the target.
In this case, in the tcpdump, in the DHCP response packet, option 67 Bootfile-name has "sample.tar"

Not able to get where is the problem.

Please help me.

 

BR,

Karteek

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Using custom variable to assign value to bootfile-name

Niall O'Reilly
On Wed, 11 Nov 2015 13:08:47 +0000,
<[hidden email]> wrote:

>
>
> Below is the example of my thought.
>
> fsname.conf:
>
> group target_1{
>
> set tg1_fs = “soft_1.tar”;
>
> }

  Variables don't do what you need.

  I'ld suggest something like this, repeated for the other groups:

group target_1 {
  option boot-filename = "soft_1.tar";
}

  Best regards,
  Niall O'Reilly
 
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Using custom variable to assign value to bootfile-name

Simon Hobson
Niall O'Reilly <[hidden email]> wrote:

>  Variables don't do what you need.
>
>  I'ld suggest something like this, repeated for the other groups:
>
> group target_1 {
>  option boot-filename = "soft_1.tar";
> }

I think the problem he has is that if he allows the devs to edit that themselves, they screw up the rest of the config. I'm wondering if some include files (and perhaps some scripts) might work.

group target_1 {
 $INCLUDE soft1.cfg
}

Then generate a number of config files that you can use with the include statements. Either let the devs edit them directly, or let them work through a script that does some sanity checking.

Or put placeholders in the config, and have a script that replaces them with the desired values to generate a config file for the server to use.

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Using custom variable to assign value to bootfile-name

Niall O'Reilly
On Wed, 11 Nov 2015 22:42:55 +0000,
Simon Hobson wrote:
>
> I think the problem he has is that if he allows the devs to edit that themselves, they screw up the rest of the config.

  Ah! Sorry: I missed that.

> I'm wondering if some include files (and perhaps some scripts) might work.
>
> group target_1 {
>  $INCLUDE soft1.cfg
> }
>
> Then generate a number of config files that you can use with the include statements. Either let the devs edit them directly, or let them work through a script that does some sanity checking.
>
> Or put placeholders in the config, and have a script that replaces them with the desired values to generate a config file for the server to use.
>

  All good ideas.

  /Niall
 
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

RE: Using custom variable to assign value to bootfile-name

karteek.challa
In reply to this post by Simon Hobson
Hi Niall and Simon,

Thanks a ton for your inputs.
I have created the config files with only entry with the software version for each target and included them in the actual dhcp file. And gave full permission to these config files and only r&x permission to actual dhcp file.

I have one more query!
How can I calculate the string length in the dhcp file.
For example:
Option software-version "soft_v1_g2333.tar"
I want to know the length of "soft_v1_g2333.tar" in the dhcp conf file.
Is it possible? Is there any function similar to substring()?


BR,
Karteek


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Simon Hobson
Sent: den 11 november 2015 23:43
To: Users of ISC DHCP
Subject: Re: Using custom variable to assign value to bootfile-name

Niall O'Reilly <[hidden email]> wrote:

>  Variables don't do what you need.
>
>  I'ld suggest something like this, repeated for the other groups:
>
> group target_1 {
>  option boot-filename = "soft_1.tar";
> }

I think the problem he has is that if he allows the devs to edit that themselves, they screw up the rest of the config. I'm wondering if some include files (and perhaps some scripts) might work.

group target_1 {
 $INCLUDE soft1.cfg
}

Then generate a number of config files that you can use with the include statements. Either let the devs edit them directly, or let them work through a script that does some sanity checking.

Or put placeholders in the config, and have a script that replaces them with the desired values to generate a config file for the server to use.

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

RE: Using custom variable to assign value to bootfile-name

glenn.satchell
Hi Karteek

man dhcp-eval will give you all the boolean, arithmetic and string
functions. There is substring(), but there does not appear to be a
length() function.

regards,
-glenn

On Wed, November 18, 2015 5:20 am, [hidden email] wrote:

> Hi Niall and Simon,
>
> Thanks a ton for your inputs.
> I have created the config files with only entry with the software version
> for each target and included them in the actual dhcp file. And gave full
> permission to these config files and only r&x permission to actual dhcp
> file.
>
> I have one more query!
> How can I calculate the string length in the dhcp file.
> For example:
> Option software-version "soft_v1_g2333.tar"
> I want to know the length of "soft_v1_g2333.tar" in the dhcp conf file.
> Is it possible? Is there any function similar to substring()?
>
>
> BR,
> Karteek
>
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Simon Hobson
> Sent: den 11 november 2015 23:43
> To: Users of ISC DHCP
> Subject: Re: Using custom variable to assign value to bootfile-name
>
> Niall O'Reilly <[hidden email]> wrote:
>
>>  Variables don't do what you need.
>>
>>  I'ld suggest something like this, repeated for the other groups:
>>
>> group target_1 {
>>  option boot-filename = "soft_1.tar";
>> }
>
> I think the problem he has is that if he allows the devs to edit that
> themselves, they screw up the rest of the config. I'm wondering if some
> include files (and perhaps some scripts) might work.
>
> group target_1 {
>  $INCLUDE soft1.cfg
> }
>
> Then generate a number of config files that you can use with the include
> statements. Either let the devs edit them directly, or let them work
> through a script that does some sanity checking.
>
> Or put placeholders in the config, and have a script that replaces them
> with the desired values to generate a config file for the server to use.
>
> _______________________________________________
> dhcp-users mailing list
> [hidden email]
> https://lists.isc.org/mailman/listinfo/dhcp-users
> The information contained in this electronic message and any attachments
> to this message are intended for the exclusive use of the addressee(s) and
> may contain proprietary, confidential or privileged information. If you
> are not the intended recipient, you should not disseminate, distribute or
> copy this e-mail. Please notify the sender immediately and destroy all
> copies of this message and any attachments. WARNING: Computer viruses can
> be transmitted via email. The recipient should check this email and any
> attachments for the presence of viruses. The company accepts no liability
> for any damage caused by any virus transmitted by this email.
> www.wipro.com
> _______________________________________________
> dhcp-users mailing list
> [hidden email]
> https://lists.isc.org/mailman/listinfo/dhcp-users
>


_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users