Can anyone write me a script that will ping IP addresses the Fortigate has handed out when it hands them out? Is that a variable that's accessible? Running 6.4.9
Hi there,
Can you explain further about your requirements? Together with the device and its IP address?
I have an FG-101F. Each time it hands out a DHCP address I need it to ping that address. This will need to happen at regular intervals unless the address is no longer in the assigned pool.
Hi @lfstudios10 ,
Here is my understanding:
Fortigate give out DHCP to the devices
Fortigate ping the devices on regular intervals
May i know what you want to achieve for this requirements?
That is correct.
it’s complicated why but due to how I’m using my FortiAp units without a software switch, the devices aren’t making it into the aero table when they are remote. Since the local and remote DHCP pool is the same, it’s just easier to ping everything.
Hi @lfstudios10
Fortigate itself basically not a network monitoring tools that constantly ping devices. If you want to monitor the network devices, this is more to Network Monitoring solution.
It will be great if you can explain what you want to achieve by doing this.
So i can provide some idea. And im not sure what you mean by "Local and remote DHCP pool is the same" Do you have multiple dhcp server beside Fortigate?
I already have an auto ping setup to automatically ping my entire DHCP range however I'd much rather have it ping only the addresses handed out. I'm not interested in discussing the rest of my setup. Will you help me get to where I want or no?
Hi @lfstudios10 ,
Thank you for the information. Fortigate does not have that feature at the moment. You may discuss with your sales person to request for NFR(New feature request) if you think this feature is critical to you.
Some food for thought (definitely not a ready-made solution):
Log ID 26001 is LOG_ID_DHCP_ACK, which is logged by FortiOS whenever it does a DHCP ACK, confirming an IP for a DHCP client's request. The log entry contains a field "ip" with client's assigned IP.
You could set up an automation trigger to start a stitch based off this. Then you could perhaps use the %%log.ip%% variable to ping this ip in a CLI script action: exec ping %%log.ip%%
With that said, stitches are meant to be one-off events. You will not be able to run this on schedule/periodically. You could perhaps prepend the ping command with a ping-options command, setting a long period and total number of pings, to effectively turn it into a long-running ping command, but this will not be robust. (it won't reflect IP changes that happen during the ongoing ping command; it will not automatically restart after any failure; and I would not be surprised at all if the CLI script gets eventually timed out and killed)
Doing some research, it does appear that this is a solution and I was going to suggest something similar. There is a schedule option for the stitch so I'm not worried. I am not a programmer however so I'm hoping someone can come up with a script that parses the DHCP log and does a ping based on the last log.
I'd have two stitches run, one hourly for ping the entire log and another that is triggered based on a DHCP address being given out and that just pings the last address in the log.
User | Count |
---|---|
2116 | |
1187 | |
770 | |
451 | |
344 |
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.
Copyright 2025 Fortinet, Inc. All Rights Reserved.