Forum Discussion
steve_111974
Nimbostratus
Feb 24, 2010combine irules for LB by client IP and then http hostname
Hi,
I want to LB a certain range of source IP to a particular pool, else forward all other traffic to another irule that will LB by hostname. When i apply both irules, it also go the the second one. How to it fix this and is it possible to combine both irules to one?
First irule-LB by source IP:
when CLIENT_ACCEPTED {
if { [matchclass [IP::client_addr] equals $::Sharepoint_SrcIP_Allowed] }{
Uncomment the line below to turn on logging.
log local0. "Connection accepted from [IP::client_addr]:[TCP::local_port] to tcp port [TCP::remote_port]"
pool sharepoint
}
}
----above irule sends client matching Sharepoint_SrcIP_Allowed" Datagroup to pool "sharepoint"--
2nd Irule - LB by hostname:
when HTTP_REQUEST {
if { [HTTP::host] eq "itportal" } {
pool itportal }
elseif { [HTTP::host] eq "espportal" }{
pool espportal }
elseif { [HTTP::host] eq "mysite" }{
pool mysite }
elseif { [HTTP::host] eq "qaportal" }{
pool qaportal }
elseif { [HTTP::host] eq "sharepointssp" }{
pool sharepointssp }
elseif { [HTTP::host] eq "portal" }{
pool portal_sharepoint }
}
----
If I either one, it works fine but when I apply both, it always process the 2nd irule even when i matches the first one. Any advice?
- The_Bhattman
Nimbostratus
Hi Steve,when HTTP_REQUEST { if { [matchclass [IP::client_addr] equals $::Sharepoint_SrcIP_Allowed] }{ pool sharepoint } else { switch -glob [HTTP::host] { "itportal" { pool itportal } "esportal" { pool esportal } "mysite" { pool mysite } "qaportal" { pool qaportal } "sharepointssp" { pool sharepointssp } "portal" { pool portal_sharepoint } } } }
- steve_111974
Nimbostratus
yes! Thanks! This forum is awesome! - The_Bhattman
Nimbostratus
Glad to be of some assistance
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