Forum Discussion
Dave_73612
Nimbostratus
Jul 28, 2009Pool redirect based on source IP Range
Hi guys,
I need to write an IRule to route traffic to different pools based on source IP range.
Would this be the best syntax to use?
when CLIENT_ACCEPTED ...
Gideon_Chong_24
Nimbostratus
Jan 20, 2016Hi Randy,
I'm also in a similar situation as you.
The following iRule is also not working for me:
when CLIENT_ACCEPTED {
set rserver1 "xserver"
set rserver2 "yserver"
if { [IP::addr [IP::client_addr] equals a.a.a.a] } {
pool mypool member $rserver1 80
}
if { [IP::addr [IP::client_addr] equals b.b.b.b] } {
pool mypool member $rserver2 80
}
}
I will test with HTTP_REQUEST tomorrow. But what are is the difference between the 2 and why would it work with one and not with the other? Also I'm using type "standard" as virtual server.
Any suggestion is very appreciated. Thanks.
JRahm
Admin
Jan 20, 2016if you are matching an exact IP address you only need IP::client_addr. If you are matching a network, you need a mask with that IP::addr command. Please check the wiki page for IP::addr for examples. If strictly doing IP matching/comparison, no need to use HTTP_REQUEST. Finally, depending on how many servers you end up with, a switch would be preferable to multiple if statements. If you can give me some specifics of what you are trying to accomplish (sanitized) I can cook up a sample for you.
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