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

Add Multiple DHCP reservation on Fortigate 60D

Hey guys, 

How you doing?

 

Well, I will migrate from DHCP on Windows Server to DHCP on fortigate. I have lot of resevations on the server, is there a way i can make this reservations on Fortigate without doing it one by one. 

Like a scrip or something? 

 

For example on Windows server i can do it through PowerShell, with something like this: 

 

Add-DhcpServerv4Reservation -ScopeId 192.168.0.0 -IPAddress 192.168.0.XX -ClientId "XXXXXXXXXXXX" -Description "Reservation for XXX"

 

And I just replicate for every reservation I want. 

 

Appreciate your help, 

 

Thank you

 

 

3 Solutions
lobstercreed
Valued Contributor

I'm not sure why you would want to do this as Windows DHCP is far better IMO, but here is a thread from a few months back addressing exactly this: https://forum.fortinet.com/tm.aspx?m=190549  Hope that helps.

View solution in original post

sw2090
Honored Contributor

hm I modified my prgram from the other thread to read windows dhcp reservervations csvs as exported via Powershell and create FGT cli script from it.

Seems to work so far.

I just will have to publish this one...

-- 

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

View solution in original post

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

I apologize for the delay but I didnt find the time earlier :(

Here is the modified one: https://www.dropbox.com/s/p7gkuiqya6yix15/windhcp2fgt.zip?dl=0

 

As the other one it does almost not contain any error handling and you may use it at your own risk.

It is released under cc-by-nc license (and as said inner-company-use to me is not commercial).

Also I just looked at the result and it looked correct but I never actually fed a Fortigate with it.

 

Hope it is still of some use to you though...

-- 

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

View solution in original post

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

I'm not sure why you would want to do this as Windows DHCP is far better IMO, but here is a thread from a few months back addressing exactly this: https://forum.fortinet.com/tm.aspx?m=190549  Hope that helps.

sw2090
Honored Contributor

yeah I remember that thread. Just the programs mentioned in there might wer written for unix dnsmasq reserfations afair. I am not sure wether windows dhcop can export its reservations (and in which format)

, so you might have to code your own or change the existing if possible.

 

Update:

I've had a look. Seems not to be possible to export reservations in a usable way in gui. 

However there is powershell cmdlets that can do it:

 

Get-DHcpServer4REservation -ComputerName "yourdhcpserver" -ScopId yourscopesubnet | Export-Csv -NoTypeInformation  -Path <pathandnameofcsvfile>

 

this will create a .csv that contains all needed information.

 

-- 

"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
Donaire
New Contributor III

Well, Windows dhcp can export to csv file.  It is as you said the programs mentinoed in the past thread are quite different but anyways they gave me some insight. Perhaps I have to try to code it myself.

sw2090
Honored Contributor

hm I modified my prgram from the other thread to read windows dhcp reservervations csvs as exported via Powershell and create FGT cli script from it.

Seems to work so far.

I just will have to publish this one...

-- 

"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
Donaire
New Contributor III

Thats awesome,  I appreciate if you could share/publish this one.

It will definately save me from a pain...

 

sw2090
Honored Contributor

I apologize for the delay but I didnt find the time earlier :(

Here is the modified one: https://www.dropbox.com/s/p7gkuiqya6yix15/windhcp2fgt.zip?dl=0

 

As the other one it does almost not contain any error handling and you may use it at your own risk.

It is released under cc-by-nc license (and as said inner-company-use to me is not commercial).

Also I just looked at the result and it looked correct but I never actually fed a Fortigate with it.

 

Hope it is still of some use to you though...

-- 

"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
Donaire
New Contributor III

sw2090 wrote:

I apologize for the delay but I didnt find the time earlier :(

Here is the modified one: https://www.dropbox.com/s/p7gkuiqya6yix15/windhcp2fgt.zip?dl=0

 

As the other one it does almost not contain any error handling and you may use it at your own risk.

It is released under cc-by-nc license (and as said inner-company-use to me is not commercial).

Also I just looked at the result and it looked correct but I never actually fed a Fortigate with it.

 

Hope it is still of some use to you though...

Thank you very much, I will try it and let you know of the outcome.  Definitely, it is still helpful...

Labels
Top Kudoed Authors