Forum Discussion
Fred_01
Nimbostratus
Dec 11, 2018define 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 8.8.8.8 := "google",
network 10.0.0.0/8 := "local",
}
}
when HTTP_REQUEST {
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 youNo RepliesBe the first to reply
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects