Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Clear all filters

define datagroup in the irule

Hello All,

I have a multiple irule who realize filtering but it's too complicated to handling this with classic datagroup so I want to create the datagroup in my irules and i don't know how

I make the filter with the ip address, anyone knows how to create with host or network

example with my code

## the datagroup
when RULE_INIT {
    class persoDG {
        host := "google",
        network := "local",

    set reqBlock 0

    switch -glob -- [string tolower [HTTP::path]] {
        "/private/*" {
            set AllowedGroups { local }

        "/public/*" {
            set AllowedGroups { google }
        default {
           set reqBlock 1

    if {[info exists AllowedGroups] && ([lsearch -exact $AllowedGroups [class match -value [IP::client_addr] equals "persoDG " ]] ne -1)} {
        # If user IP is in AllowedGroups, allow the request
        set reqBlock 0
    } elseif {[info exists AllowedGroups]}{
        # If AllowedGroups is set but user IP is not in AllowedGroups, Block the request
        set reqBlock 1
    unset -nocomplain AllowedGroups

thank you

Rate this Question

Answers to this Question