For all current versions, you can create an address type datagroup in the GUI under Local Traffic >> iRules >> Datagroup List tab >> Create. Select a type of 'Address' and enter the host and/or networks you want.
Optionally, in v10.1, you can add a corresponding value to the datagroup. I assume this allows you to specify an arbitrary string that the class command can return if the IP address evaluation matches. Here is a sample class as listed in the bigip.conf:
class private_net {
{
host 1.1.1.1 { "test1" }
network 2.2.2.0/24 { "test2" }
network 10.0.0.0/8
network 172.16.0.0/12
network 192.168.0.0/16
}
}
And here is a simple logging iRule which references the class:
when RULE_INIT {
log local0. "\[class match 2.2.2.2 equals private_net\]: [class match 2.2.2.2 equals private_net]"
log local0. "\[class search -value private_net equals 2.2.2.2\]: [class search -value private_net equals 2.2.2.2]"
log local0. "\[class search -value private_net equals 2.2.2.2/24\]: [class search -value private_net equals 2.2.2.2/24]"
}
And the log output:
Rule class_v10.1_rule : [class match 2.2.2.2 equals private_net]: 1
Rule class_v10.1_rule : [class search -value private_net equals 2.2.2.2]: test2
Rule class_v10.1_rule : [class search -value private_net equals 2.2.2.2/24]: test2
Aaron