How to mapping client with Server using iRUle

Dear all

I had 2 web server ip 172.16.41.55 and 172.16.41.56 and 2 app server 172.16.36.49 and 172.16.36.50. I want to mapping priority all connection from 172.16.41.55 to app 172.16.36.49 if app 36.49 up else if app 36.49 down then 41.55 connect to 36.50. And the same with 41.56 to 36.50. But I don’t know how to config it. Please help me

Hi Voung Hong Vu,

i would create to independent pools for the two backend systems with priority based activation where each pool is prefering a different app server.

App_Pool1
    Node1: 172.16.36.49 Priority 1
    Node2: 172.16.36.50 Priority 0
App_Pool2
    Node1: 172.16.36.49 Priority 0
    Node2: 172.16.36.50 Priority 1

For further information on priority based activation see: 404 Page not found | BIG-IP Documentation

Once done, then configure the iRule below on the virtual server serving your app servers.

when CLIENT_ACCEPTED {
    if { [IP::client_addr] equals 172.16.41.55 } then {
        pool App_Pool1
    } else {
        pool App_Pool2
    }
}

Note: Change

[IP::client_addr] equals 172.16.41.55

to

[IP::client_addr] starts_with 172.16.41.55

if your setup uses multiple route domains.

Cheers, Kai