Forum Discussion
Deon
Nimbostratus
Sep 26, 2008Select Alternate Pool Based On Client IP?
This would appear to be a common enough idea but I can't locate any examples that lead me down the direction I need. I am looking for an iRule that looks at the client IP address at the time the load balance decision is made and then changes to a different pool in the case where the client IP is within a specific subnet.
Thanks
- Deon
Nimbostratus
OK, I think I might have the solution figured out. This is what I have so far and it appears to be working. Anybody see any issue with what I am doing here? Critiques welcome!when RULE_INIT { log local0. "Select_CSS_Pool rule loading..." } when CLIENT_ACCEPTED { log local0. "Select_CSS_Pool: accepted client" TCP::collect } when CLIENT_DATA { set clientip [IP::client_addr] log local0. "Select_CSS_Pool: accepted client- $clientip" if { $clientip starts_with "172.22.166." } { log local0. "Selecting alternate pool CSS_2" pool CSS_2 } TCP::release }
- hoolio
Cirrostratus
Hi Deon, - hoolio
Cirrostratus
Hi Deon,when CLIENT_ACCEPTED { if { [IP::addr [IP::client_addr]/24 equals 172.22.166.0] } { pool CSS_2 } }
- Deon
Nimbostratus
I think this is what you might be looking for.when CLIENT_ACCEPTED { if { not [IP::addr [IP::client_addr]/24 equals 10.1.1.0] } { pool maintenance_pool } }
- Deon
Nimbostratus
It sounds like then you want to send a redirect back to the client instead of selecting a specific pool. sending a redirect and choosing a specific pool to me would be mutually exclusive choices. in other words, you would not do both in the same condition in one iRule. A redirect looks something like this: - Deon
Nimbostratus
From your description or inclusion of the words "maintenance page", I think you are really looking for a redirect. Selecting a pool (or member for that matter) to use is a different type of decision that is made in the BigIP and determines where the users request(s) will be sent along to for processing.
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