Forum Discussion
how to use irule to customize use of persistence profile
Hello All,
I want to use irule to allocate persistence profile for some subnets and have to exclude some subnets.
can you please suggest how i can use switch command for this?
when CLIENT_ACCEPTED { switch -glob [IP::client_addr] { "10.123.123.70/32" { persist source_addr} "10.122.122.47/32" { persist none } default { persist source_addr} } }
6 Replies
- nitass
Employee
it is going to be string comparison, so you do not need /32.
when CLIENT_ACCEPTED { switch [IP::client_addr] { "10.123.123.70" { persist source_addr } "10.122.122.47" { persist none } default { persist source_addr } } } - Kalpesh_48932
Nimbostratus
what if I need to exclude complete subnet from persistence? say I don't want 10.124.124.0/24 use persistence.
how I can update it in iRule.
- Brad_10504
Nimbostratus
I believe you can do:
when CLIENT_ACCEPTED { switch -glob [IP::client_addr] { "10.124.124.*" { persist none } default { persist source_addr } } }I didn't get a chance to test, but this should work.
- Kalpesh_48932
Nimbostratus
Thanks Brad. it works, however still I want to customized it.
how I can define perticular subnet like. 1.1.1.0/30 ?
- Brad_10504
Nimbostratus
You would just have to use the string rule, as IP::client_addr is a string value, so you could make the rules like
when CLIENT_ACCEPTED { switch -glob [IP::client_addr] { "10.124.124.*" - "10.124.123.*" { persist none } default { persist source_addr } } }I'm really not a pro at this, but this is the way that I do it.
- Brad_10504
Nimbostratus
I did a little digging and it looks like you can do the calculations like:
[IP::addr "10.0.0.0 mask 255.0.0.0" equals [IP::client_addr]]https://devcentral.f5.com/wiki/iRules.ip__addr.ashx
You could also use a data group for that.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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