Forum Discussion
TMcGov_92811
Nimbostratus
Jan 21, 2009IRule to use Pool depending on Client source address
I need to add some more logic to an existing iRule, and I think I need to clean it up before doing so. I'm sure there must be a better way for me to do this. Basically, I just want to examine the client's source IP, and based on that, send them to a specific pool. Here's what I have now...how can I simplify this ?
when CLIENT_ACCEPTED {
switch [IP::client_addr] {
63.208.77.21 { pool http-Test-mediation }
166.90.79.2 { pool http-Test-mediation }
198.204.15.125 { pool http-Test-mediation }
198.204.15.126 { pool http-Test-mediation }
202.54.137.90 { pool http-Test-mediation }
203.99.192.0/19 { pool http-Test-mediation }
203.99.195.2 { pool http-Test-mediation }
203.99.208.0/23 { pool http-Test-mediation }
203.197.245.101 { pool http-Test-mediation }
203.199.245.10 { pool http-Test-mediation }
65.5.4.196 { pool alt-http-Test }
65.5.4.198 { pool alt-http-Test }
65.5.4.199 { pool alt-http-Test }
65.5.4.253 { pool alt-http-Test }
65.5.4.254 { pool alt-http-Test }
65.201.27.93 { pool alt-http-Test }
default { pool alt-http-Test-mediation }
}
}
- dennypayne
Employee
Hi,when CLIENT_ACCEPTED { if { [matchclass $::http-Test-mediation contains [IP::client_addr]] } { pool http-Test-mediation } elseif { [matchclass $::alt-http-Test contains [IP::client_addr]] } { pool alt-http-Test } else { pool alt-http-Test-mediation } }
- TMcGov_92811
Nimbostratus
I tried something similar but my syntax was wrong - Thanks this works great. - hoolio
Cirrostratus
I think that hyphens in TCL variables (or class names) need to be bracketed or they'll be interpreted incorrectly: - TMcGov_92811
Nimbostratus
I think you're right, great catch I'll just skip them altogether. - krishna_52361
Nimbostratus
I have a doubt , is that a similar to Topology Load balancing in GTM - krishna_52361
Nimbostratus
I have a doubt , is that a similar to Topology Load balancing in GTM
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