Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
New Contributor II

IP-MAC DHCP script

am trying to add bulk IP-DHCP reservation, created a script. it keeps failing.

this is the script, there 100 entries, even if i restrict it to just two entries i fails. Any idea why the script fails


config system dhcp server edit 3 config reserved-address edit 4 set ip set mac 5C:87:9C:D7:67:16 set description "mylap3" next edit 5 set ip set mac B0:FC:36:B0:90:8B set description "mylap4" next end


Valued Contributor

Have you tried running it directly in CLI to see why it is failing?


Obviously this is incomplete; should I assume you already have IP ranges configured for server 3?  If not, that's probably the error.


I ran that in to the CLI and its working. I have IP ranges configured too.


looks a bit fussy to me :)


Better do this way:


config system dhcp server

 edit 3

  config reserved address 

   edit 0

    set ip <ip>

    set mac <mac>

    set description <description>







You could then repeat the edit stanze in config reserved address as often as you want and fill it with new ip/mac pair.

edit 0 is like auto increment in fortios :) If you use it you don't need to care about the number. FortiOS does this for you then.

Just lafter the last edit standza in config reserved address you have to have an "end" to end config reserved address stanza itself :)

Then complete it with an end to end the edit 3 stanza and annother end to end config system dhcp server stanza.


And yes try to run it on cli to see where it fails or read the error logs after executing the script.





"It is a mistake to think you can solve any major problems just with potatoes." - Douglas Adams

-- "It is a mistake to think you can solve any major problems just with potatoes." - Douglas Adams

Select Forum Responses to become Knowledge Articles!

Select the “Nominate to Knowledge Base” button to recommend a forum post to become a knowledge article.

Top Kudoed Authors