Forum Discussion
david_20522
Nimbostratus
Jun 03, 2009class command please explain??
The wiki definition states:
The new class command, implemented in v10.0.0, allows for the use of extended functionality built into external data groups. These commands work for both internal an...
hoolio
Cirrostratus
Jan 20, 2010For 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
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