Forum Discussion
Fawad_29089
Nimbostratus
Jun 04, 2013irule based on source ip not working..plz help!
I am running LTM v 11.1. I am defining irule based on source IP address to select a specific pool. I am getting some syntax and not supported command like error messages for the first few lines. The error message is probably for the class i created. Can somebody help with this!
class ip_subnets_class {
{
network 120.36.32.0 mask 255.255.240.0
network 172.20.0.0 mask 255.255.0.0
network 172.31.0.0 mask 255.255.0.0
network 149.2.0.0 mask 255.255.0.0
network 149.237.0.0 mask 255.255.0.0
}
}
when HTTP_REQUEST {
if { [matchclass [IP::client_addr] contains ip_subnets_class }
{ pool VDI_TEST_pool
} else { pool VDI_TEST_POOL_INT}
}
6 Replies
- hoolio
Cirrostratus
Can you try this and reply back with the specific error messages you see when trying to save the iRule?
Aaronwhen CLIENT_ACCEPTED { if { [class match [IP::client_addr] equals ip_subnets_class] }{ pool VDI_TEST_pool } else { pool VDI_TEST_POOL_INT } } - richard_77048
Nimbostratus
matchclass has been deprecated as of v10. You should use the class command instead. See https://devcentral.f5.com/wiki/irules.class.ashx .
You rule would look like this:when HTTP_REQUEST { if { [class match [IP::client_addr] equals ip_subnets_class } { pool VCI_TEST_pool } else { pool VDI_TEST_POOL_INT } } - Fawad_29089
Nimbostratus
I tried what you suggest with class and got following message :
01070151:3: Rule [/Common/VDI_TEST_REDIRECT] error:
line 1: [command is not valid in the current scope] [class ip_subnets_class {
{
network 36.36.32.0 mask 255.255.240.0
network 172.20.0.0 mask 255.255.0.0
network 172.31.0.0 mask 255.255.0.0
network 18.2.0.0 mask 255.255.0.0
network 18.237.0.0 mask 255.255.0.0
}
}] - Fawad_29089
Nimbostratus
I tried what you suggest with class and got following message :
01070151:3: Rule [/Common/VDI_TEST_REDIRECT] error:
line 1: [command is not valid in the current scope] [class ip_subnets_class {
{
network 36.36.32.0 mask 255.255.240.0
network 172.20.0.0 mask 255.255.0.0
network 172.31.0.0 mask 255.255.0.0
network 18.2.0.0 mask 255.255.0.0
network 18.237.0.0 mask 255.255.0.0
}
}] - hoolio
Cirrostratus
The data group should be defined separately in the GUI under Local Traffic | iRules | Data group tab.
I also edited the iRule in my first post slightly. Can you try that once you have the data group created?
Aaron - Fawad_29089
Nimbostratus
Finally I was able to do it using data group. So the class map for defining IP addresses does not work. Thanks hoolio and all for helping me out!
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