Forum Discussion

Jungyi_133013's avatar
Jungyi_133013
Icon for Nimbostratus rankNimbostratus
Dec 20, 2015

By src network address redirect to spedify node

I have a request of about irule by source network redirect to specified node. My environment is both a web server in pool_http. I need for by source network address to redirect to a specified node in pool_http. For example network_a can redirect to node-a, network_b can redirect to node-b. If node-a server failure , network_a can redirect to node-b. And node_b server failure, network_b can redirect to node-a. In addition to redirect to specified node, Also need to consider load balancing. Can someone help me do this case, thanks.

 

2 Replies

  • Hi Jungyi, I would solve it with an iRule and multiple pools. The pools will contain the available nodes in prioritized order and the iRule will select these pools according to predefined matches of client IP networks to associated pools. The prioritization in your pools help to fallback to an alternative server in case the preferred servers fails. Does this fit your requirements? Cheers, Stephan
  • Hi Jungyi,

    You could solve this scenario with the LTM Priority group feature in combination with some iRule code.

    The first step would be to create two additional pools, with absolutely identical settings and member nodes as the one currently in use. Name these pools "pool_http_a" and "pool_http_b".

    Then increase the priority of node_a in pool_http_a and the priority of node_b in pool_http_b to a value greater than 0, as outlined in the chapters "Priority group number" and "Priority-based member activation" of this guide...

    https://support.f5.com/kb/en-us/products/big-ip_ltm/manuals/product/ltm-concepts-11-1-0/ltm_pools.html1216212

    Now you've three pools for your two servers, where the original pool would still load balance the requests and two new pools for your servers would perform an active/standby configuration where each is prefering either node a or node b.

    Now you could select those pools as required by using iRules:

     

    when HTTP_REQUEST {
        if { [IP::addr [IP::client_addr] equals 10.1.0.0/16] } then {
             Send requests prefered to node A and use B as standby
            pool pool_http_a
        } elseif { [IP::addr [IP::client_addr] equals 10.2.0.0/16] } then {
             Send requests prefered to node B and use node A as standby    
            pool pool_http_b
        } default {
             Balance requests either to node B or node A   
            pool pool_http
        }
    }
    

     

    Note: If using different route groups, then you may have change the [IP::client_addr] command to exclude the route domain sufix.

    Cheers, Kai