Forum Discussion
Load Balance traffic based on source IP location to hit local proxy.
I have a request to load balance traffic coming to proxys based on the source IP subnet (Location). So, if it comes from subnet 1.xc.0.0/16 and 1.df.0.0/16 and pool-A is up then send it to Proxy-A elseif 1.xc.0.0/16 and 1.df.0.0/16 and pool-A is Down then send it to Proxy-B. And if it comes from subnet 10.rt.0.0/16 and 10.nm.0.0/16 and pool-B is up then send it to Proxy-B elseif 10.rt.0.0/16 and 10.nm.0.0/16 and pool-B is Down then send it to Proxy-A. I tryed the below iRule but it keep defaulting to on Proxy.
when DNS_REQUEST { if {([IP::addr [IP::remote_addr]/16 equals 10.xc.0.0/16]) and ([active_members proxy_NJ_80_pool] > 0)}{ host } elseif { ([IP::addr [IP::remote_addr]/16 equals 10.xc.0.0/16]) and ([active_members proxy_NY_80_pool ] > 0)}{ host } elseif {([IP::addr [IP::remote_addr]/16 equals 10.nm.0.0/16]) and ([active_members proxy_NY_80_pool] > 0)}{ host } elseif { ([IP::addr [IP::remote_addr]/16 equals 10.nm.0.0/16]) and ([active_members proxy_NJ_80_pool ] > 0)}{ host } else { host } }
6 Replies
- JRahm
Admin
just for clarification, you are wanting to distribute the dns requests, or the http requests? - AbuAhmad
Nimbostratus
Yes Jason, the DNS request. I have 40 Subnets/16 that are coming out of two sites and need each to hit the local proxy if it is up and if it is down to hit the other site's proxy.
- Cory_50405
Noctilucent
Rather than an iRule, it sounds like topology based load balancing might be best for you.
http://support.f5.com/kb/en-us/products/big-ip_gtm/manuals/product/gtm-topology-lb-configuring-11-0-0/1.html
- JRahm
Admin
Is this with GTM or LTM iRules?
- AbuAhmad
Nimbostratus
It is on the GTM V.10.2.1
- JRahm
Admin
ok, with GTM I agree with Cory, topology is the way to go. If this was LTM with the dns services license, I'd recommend a datagroup with the source IP as the key and the proxy destination as the value, then it's a very short iRule.
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