Forum Discussion

AbuAhmad's avatar
AbuAhmad
Icon for Nimbostratus rankNimbostratus
Apr 07, 2014

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

  • just for clarification, you are wanting to distribute the dns requests, or the http requests?
  • 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.

     

  • 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

     

  • 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.