Reply

Script for Adding/Modifying DHCP Options to Network

EAxzell
Techie
Posts: 3
2751     0

Hello,

I am trying to update my networks custom dhcp options (Unique options for each network). ( I will run this script on 1000+ networks )

Purpose of the script is to edit my networks and add/edit option 221 and option 222 with my custom string value.

(Adding options to the whole network, not just the specific ranges in the network)
 
Example of usage:
Site0001
Network 10.10.10.0/24
option221="site0001"
option222="server0001.localdomain"
 
Site0002
Network 10.10.11.0/24
option221="site0002"
option222="server0002.localdomain"
 
 

I wrote this script, but i cannot get it to work. I don't have a lot of Perl experience so some guidance or maybe even a solution will be highly appreciated! Smiley Happy

 

Re: Script for Adding

FTerlinck
Techie
Posts: 4
2751     0

Hi Erik,

you should use something like this:

In fact the "options" of a network object, is an Array. You can simply add an option to the array, by using the "push" function.

Re: Script for Adding

EAxzell
Techie
Posts: 3
2751     0

Thank you, it works! :-)

Highlighted

Re: Script for Adding

GHorne Community Manager
Community Manager
Posts: 254
2751     0

If you are using NIOS-6, this is much easier with a CSV export. You just set up a file with the network and the options and run the import in 'update' mode.

Showing results for 
Search instead for 
Do you mean 

Recommended for You