jdam_41848
Jan 31, 2013Altocumulus
iRule - 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 seem to be working and I don't know why.
Regardless of what network the source IP is part of, the CatchAll rate class is always applied. Anyone have any thoughts on why this doesn't work?
The iRule looks like -
when CLIENT_ACCEPTED {
if { [ rateclass [class match [IP::client_addr] equals RateClasses ] ] } {
rateclass CatchAll
}
}
Several rate classes have been created (CatchAll, rateclass1, rateclass2, ...)
The data group is an internal DG called RateClasses and is of type Address (network). Once created in the GUI, the data group class definition looks like this in bigip.conf -
class RateClasses {
{
network 10.50.0.0/22 { "{ \"rateclass1\" }" }
network 10.50.4.0/24 { "{ \"rateclass2" }" }
network 10.50.5.0/24 { "{ \"rateclass3\" }" }
network 10.50.6.0/24 { "{ \"rateclass4" }" }
network 10.50.7.0/24 { "{ \"rateclass5\" }" }
network 10.50.8.0/24 { "{ \"rateclass6" }" }
network 10.50.11.0/24 { "{ \"rateclass7\" }" }
network 10.51.0.0/16 { "{ \"rateclass8\" }" }
network 172.30.1.0/24 { "{ \"rateclass9" }" }
network 172.31.0.0/22 { "{ \"rateclass10\" }" }
network 192.168.254.0/24 { "{ \"rateclass11" }" }
}
}