Hey TCP179,
there was a very similiar question a few weeks ago. The outcome of the request was to use the snippet below...
when CLIENT_ACCEPTED {
log local0. "VS Reached"
if { ( [IP::addr [IP::client_addr] 10.32.1.192/26] ) or
( [IP::addr [IP::client_addr] equals 10.32.2.0/26] ) } then {
snat X.X.X.203
nexthop X.X.X.201
log local0. " -- SNAT CUSTOMER2 -- "
} elseif { ( [IP::addr [IP::client_addr] 10.32.3.192/26] ) or
( [IP::addr [IP::client_addr] equals 10.32.4.0/26] ) } then {
snat X.X.X.103
nexthop X.X.X.101
log local0. " -- SNAT CUSTOMER3 -- "
} elseif { ( [IP::addr [IP::client_addr] 10.32.5.192/26] ) or
( [IP::addr [IP::client_addr] equals 10.32.6.0/26] ) } then {
snat X.X.X.13
nexthop X.X.X.11
log local0. " -- SNAT CUSTOMER4 -- "
} else {
log local0. " -- SNAT DEFAULT -- "
}
}
Note: The iRule has to be attached to a "Forwarding (IP)" virtual server. You can change the [SNAT]
's to become a [SNATPOOL]
's. as you like.
Note: Before going the iRules route you may also check if using different "Route Domains" may fit to your scenario. Its much more elegant... https://support.f5.com/kb/en-us/products/big-ip_ltm/manuals/product/bigip_redundant_systems_config_11_0_0/6.html
Note: The link to the original post is https://devcentral.f5.com/questions/irule-snat-for-multiple-isp
Cheers, Kai