I have a question. We have a virtual server with a policy set to load balance to one pool with a specific URL and all others default to another pool. The problem I have is that the URL based pool requires a SNAT pool (the servers use a separate router for gateway) whereas the default requires IP passthrough (no SNAT pool) and uses the F5 as the gateway.
Is there a simple way to achieve this on the F5?
Any help is greatly appreciated.
I assume you mean a Local Traffic Policy? If so, in the “forward” target, you can add an target action using the parameters “snat” or “snatpool” an the same time as you add a pool target.
If you want to use an iRule, you can simply add the “snat” command to the portion of your iRule logic that does the pool selection. The argument to the “snat” command is either “automap”, a pool name, or “none”.
Here is an example of a Local Traffic Policy that would do a selective SNAT.
ltm policy multi-snat-test {
controls { forwarding }
requires { http }
rules {
rule1 {
actions {
0 {
forward
select
snatpool /Common/SNATPOOL
}
1 {
forward
select
pool THEPOOL
}
}
conditions {
0 {
http-uri
values { /path1 }
}
}
ordinal 1
}
}
strategy first-match
}