Selective SNAT using iRule on a standard VS
Hi,
I realize this issue has been addressed in a lot of posts and i have applied those to solve this issue but nothing has worked out so far. Our LTM services two vlans and applications from these vlans talk to each other a lot. Most of them are round-robin and so approx. 50% of the connections are successful and the rest of them are resets (since they end up bypassing the LTM on their return path) We used iRules and a snat pool to selectively SNAT such apps and haven't had any issues since. Although, i would like to create a generic rule for such apps. This rule would SNAT a client request only when the client and the server are in the same vlan. Something like this:
when CLIENT_ACCEPTED {
set default_pool [LB::server pool]
log local0. "default pool = $default_pool"
if {client is in vlanA AND server is in vlanA} {
snatpool snat_pool
}
elseif {client is in vlanB AND server is in vlanB} {
snatpool snat_pool
}
else {
pool $default_pool
}
}
I would like to know if this is possible using only the CLIENT_ACCEPTED event. Also, in the app specific rules used so far, the "pool $default_pool" part doesn't work out well. Only when i explicitly specify the name of the default pool, things work. For example the following works:
when CLIENT_ACCEPTED {
if {[class match -- [IP::client_addr] equals some_hosts]} {
snatpool snat_pool
}
elseif {[class match -- [IP::client_addr] equals some_networks]} {
pool vs_default_pool
}
else {
pool vs_default_pool
}
}
But this doesn't:
when CLIENT_ACCEPTED {
set default_pool [LB::server pool]
log local0. "default pool = $default_pool"
if {[class match -- [IP::client_addr] equals some_hosts]} {
snatpool snat_pool
}
elseif {[class match -- [IP::client_addr] equals some_networks]} {
pool $default_pool
}
else {
pool $default_pool
}
}
I have also tried Kevin's answer to https://devcentral.f5.com/questions/default-pool-question But that hasn't worked out either. Not sure what is problem is here but i kinda need this to work in order to have a generic iRule for selective SNAT.
TIA !