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.
You just need to add the rest of your reservatons to it.
If you have a load of them I suggest writing some Programm that reads the reservations from you dnsmasq and creates FGT cli script.
Then you can apply that script via FGT gui or paste it into cli.
And no it is not possible to name dhcp server or reservation neither on cli nor on gui.
This is the usuall structure on FGT. Even policies are numbered (but can have a name additinally).
The number is used everywhere needed internally in FortiOS.
Btw: the FGT uses the number "0" as wildcard. So if you keep setting "edit 0" on cli the FGT will do an auto increment for the number. This works for dhcp reservations as for polices and anything that is umbered on a FGT.
"It is a mistake to think you can solve any major problems just with potatoes." - Douglas Adams
I have used Excel's text formula's to write code like this in the past. I'm sure there is a better way, but it has worked well for me since I'm already very familiar with Excel. I think it would work well in your scenario.
Basically you dump the info from your dnsmasq and either it's already separated into the fields you need (sounds like it would be, since CSV) or you can use the LEFT(), RIGHT(), and MID() functions in Excel to extract the parts you need (sometimes combined with LEN() if the length of fields vary). Then you simply add the "config" parts to a cell further to the right on that row.
So you might have a cell that has "edit" in it, and another cell that is a number that fills down, then a cell that uses =CONCATENATE("set ip ",C1) to refer to the value for the IP address in column C (or wherever it is), then the next cell is =CONCATENATE("set mac ",A1) and so on, you get the idea. Then the final column on that row takes all the config pieces and puts them together with carriage returns, or CHAR(10), something like this: =F1 & CHAR(10) & G1 & CHAR(10) & H1 & CHAR(10) & I1
The end result when you copy/paste out of that last column into, say Notepad++ is a script that has double quotes around every line, so you simply do a find/replace to get rid of those and then boom, you're done. I've used this many times. As I say, there may be a better way and I'd love to learn it, but this works well for me especially since once I set up the spreadsheet I can use it again with similar inputs.
I used your sample input string, and any line beginning with a hash (#) was a comment and not included. The only change you may need to make before importing is the first "edit 0". That will need to be replaced with the actual DHCP scope number.
*** Made an overnight change
Any column may now be used to populate any field: IP, MAC or description. Just indicate which columns correspond at the bottom of the form before submitting it.
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.