Hello all,
Sorry for the delay with my feedback and thank you everyone for help. I managed to get some help from highly skilled iRule engineer, and below I am placing the final version. The biggest advantage of the iRule is that adding more clients, doesn't require any code modification. All I have to do is to modify 2 data groups; one called Clients_IPs (which is going to be universal, and which will be created for each wide IP.
when DNS_REQUEST {
set mon "[class match -value [IP::remote_addr] equals Clients_IPs]"
set ip "[class match -value [DNS::question name] equals www.test.com_IP]"
if { ( $mon ne "" ) && ( $ip ne "" ) } {
if {[LB::status vs $mon up]} {
host [getfield $ip "," 1]
} else {
host [getfield $ip "," 2]
}
}
}
Regards
Mariusz