Forum Discussion
Selective SNAT iRule
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
's to become a [SNAT]
's. as you like.[SNATPOOL]
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
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com