Skip to main content
vfCpht
Explorer
August 20, 2024
Solved

Import mac address list for dhcp allocation

  • August 20, 2024
  • 6 replies
  • 2340 views

Dear all,

 

i want to set up dhcp server on dedicated vlan for my clients on fortigate.

Basically, i want to import list of mac address which will receive an ip from dhcp range (not reserved). On web UI, i did not see any menu which allows me to do that. How can i achieve it ?

 

Best regards.

Best answer by ozkanaltas

Hello @vfCpht ,

 

Yes, you are right. You can just use tcl scripts on FortiManager.

 

If you know Python or any scripting language you can create a cli template with them. If you don't know anything about Python, ChatGPT can help you :). 

6 replies

ozkanaltas
Valued Contributor III
August 20, 2024

Hello @vfCpht ,

 

Fortigate doesn't have the ability to import a mac address list into the DHCP. But you can import all mac addresses via CLI. I think, this is best efficient way for import mac address bulky.

 

You can review example cli commands below. 

 

 

config system dhcp server edit <DHCP_Scope_ID> config reserved-address edit 0 set type mac set mac <MAC_ADDR> set action assign set description '' next edit 0 set type mac set mac <MAC_ADDR> set action assign set description '' next end next  end

 

 

If you want to reserve an IP address for a client, you can use these commands. 

 

config system dhcp server edit <DHCP_Scope_ID> config reserved-address edit 0 set type mac set ip <IP_ADDR> set mac <MAC_ADDR> set action reserved set description '' next edit 0 set type mac set ip <IP_ADDR> set mac <MAC_ADDR> set action reserved set description '' next end next  end

 

vfCpht
vfCphtAuthor
Explorer
August 20, 2024

Thanks for your answer.

I will try to set up a tcl script which will parse input file and will assign address for each mac parsed. It must be possible, musn't it ? It will be easier to do this on Tcl language instead of CLI script.

ozkanaltas
Valued Contributor III
August 20, 2024

Hello @vfCpht ,

 

Probably, tcl scripts will be better than cli. Because, with tcl scripts, you can read mac addresses from files and you can use these inputs on a loop. The loop will create all input for the configuration.

vfCpht
vfCphtAuthor
Explorer
August 20, 2024

I will use bash.

 

Thanks.

Thought Leadership Security Summit. Outpace New Threats with AI - enhanced defense. Tuesday, Septmeber 15, 8:30 AM - 2:30 PM PT. The Golf Club at Newcastle, WA.
Virtual event | September 2026. SASE summit. The age of autonomous trust. Register here!