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

Create a stitch that pings IP addresses that have been given out

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

12 REPLIES 12
Muhammad_Haiqal

Hi there,

Can you explain further about your requirements? Together with the device and its IP address?

 

haiqal
lfstudios10
New Contributor

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. 

Muhammad_Haiqal

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?

haiqal
lfstudios10

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. 

Muhammad_Haiqal

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?

 

haiqal
lfstudios10

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?

Muhammad_Haiqal

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.

haiqal
pminarik
Staff
Staff

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)

[ corrections always welcome ]
lfstudios10

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.

Announcements

Select Forum Responses to become Knowledge Articles!

Select the “Nominate to Knowledge Base” button to recommend a forum post to become a knowledge article.

Labels
Top Kudoed Authors