Forum Discussion
jdam_41848
Altocumulus
Jan 31, 2013iRule - select rate class based on source IP match in data group
Hello iRule gurus -
I am trying to create an iRule/Datagroup that applies a rate class based on matching source IP to a network definition in a data group. The matching IP to network does not se...
What_Lies_Bene1
Cirrostratus
Jan 31, 2013I'd suggest this, assuming the DG is correctly configured;
when HTTP_REQUEST {
Compare the request source IP with the addresses in the thoseclasses data group
and populate the variable 'thatclass' with the associated string value if
there is a match
set thatclass [class match -value [IP::client_addr] equals thoseclasses]
As long as our variable: thatclass isn't empty, continue
if { $thatclass ne "" } {
Apply the rateclass
rateclass $thatclass
}
If there wasn't a match and variable 'thatclass' is empty, use a default
else {
rateclass CatchAll
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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