How to create a trigger which the client is not one, but subnet?

Hi guys,

I need help creating a trigger.
I want to create an application-based trigger script.
The application is created by the traffic of subnet A.

I’m successful to create a trigger script if the client only from one IP Address.
I’m confused if the client is not one address but a subnet.

Anyone can help me how to create this trigger?

Thank before for this :slightly_smiling_face:

Hi @psanggabuana - Great question, thanks for reaching out.

There are a few different ways, if your trigger is assigned to all devices, the Flow mask instance methods could be helpful, Trigger API Reference

if ((Flow.ipaddr1.mask(24).toString() === "")||
(Flow.ipaddr2.mask(24).toString() === ""))
{Flow.setApplication("My L4 App");}

You could also create a dynamic device group using the IP Address = CIDR block of interest, then assign to trigger to that device group. Then additional server/client or sender/receiver logic could be handled from within the trigger.

Hope that helps! Happy coding.

1 Like

A custom device might also be an option, if you want a device to represent an entire subnet, but I agree with @girardo, his suggestion will result in less complexity.