How to add MANY dhcp reservations?
I am currently investigating how we can replace a dnsmasq(1) based dhcp server with FortiGate.
For that I need to enter a lot (and I mean a LOT) of dhcp reservations and I am looking for an efficient way to re-use or import the current dhcp reservation files from dnsmasqdhcp, at least for the initial configuration.
Such a reservations file can look like this:
[...]
40:b0:34:9d:10:aa,id:*,hf-lj-zi103,192.168.99.79,set:vlan80
##c8:d3:ff:11:18:02,id:*,hf-ljm651dn,192.168.100.240,set:vlan80
c8:d3:ff:11:18:02,id:*,hf-ljm651dn,192.168.100.240,set:vlan80-forti # Test GW=fortihf-81, dh.2010132004
[...]
"set:" is used to assign a tag that will provide different dhcp options (i.e. GW, DNS, etc.) in the config file.
But basically I need the entries in bold (I think), to be added to the right dhcp server.
Anyway, I can convert i.e. the first line into something like this in CLI (http://docs.fortinet.com/document/fortigate/6.4.2/cli-reference/57620/system-dhcp-server) (lines with # are added by me for clarification. I know that this is not valid in real CLI):
config system dhcp server
edit 4 # seems there is no way to name this differently in the GUI, can I name it here?
config reserved-address
edit 1
set ip 192.168.99.79 # when this line exists, set "action reserved seems" to be implicit?
set mac 40:b0:34:9d:10:aa
set action reserved # really needed if "set ip" is there?
set description "hf-lj-zi103"
next
end
next
end
However, this is s tedious task or I have to create a script (and I am not really a coder).
A one-liner would help too.
Is there a simpler way? Perhaps an import function for tables, .csv, etc. of dhcp reservations, which I have overseen?
(in the interface GUI, DHCP server, "Add from DHCP Client List".. would be nice to see an "import" button there)
Or is there perhaps already a script or tool available out there?
Other question:
Can I actually assign a proper name (instead of "4" or "1") to the dhcp server and the sub configurations?
Thanks
Dan
