Forum Discussion
jmloveless_4477
Nov 09, 2010Nimbostratus
iRule to SNAT and select pool member
Good evening,
I am using the LC with an irule on the default gateway pool to snat a particular internal client to an outside address (overriding the automap on the default gateway pool). The SNAT works great until the connection is routed out the wrong ISP. I need to be able to set the SNAT and Pool member with the same irule. I have tried couple things but they dont seem to work, any input would be appreciated!!!
here is an example of one iRule I have tried:
when CLIENT_ACCEPTED {
if {[IP::addr "[IP::client_addr]" equals "10.251.1.65"]} {
snat X.X.X.10
pool default_gateway_pool member X.X.X.1 0
}
elseif {[IP::addr "[IP::client_addr]" equals "10.40.14.12"]} {
snat Y.Y.Y.10
pool default_gateway_pool member Y.Y.Y.1 0
}
}
- hooleylistCirrostratusHi,
- hooleylistCirrostratusActually, maybe the issue is with specifying port 0 for the pool member? If that's the issue, you might try something like this:
when CLIENT_ACCEPTED { if {[IP::addr [IP::client_addr] equals 10.251.1.65]} { snat X.X.X.10 pool default_gateway_pool member X.X.X.1 [TCP::local_port] } elseif {[IP::addr [IP::client_addr] equals 10.40.14.12]} { snat Y.Y.Y.10 pool default_gateway_pool member Y.Y.Y.1 [TCP::local_port] } }
- jmloveless_4477NimbostratusThanks for the quick response, do I need the [TCP::local_port]
- Chris_MillerAltostratusWhen I had a similar challenge, I created a separate pool containing only that specific member and selected the pool (rather than member) from the iRule.
- jmloveless_4477NimbostratusChris, funny you mention that, I just did the same thing this morning and it appears to be working!!! FingersCrossed.
- hooleylistCirrostratusChris' idea is a good workaround. But I'm curious why the pool command didn't work. Were the pool members defined on port 0?
- tcl_newfanNimbostratusHi,
- hooleylistCirrostratusHi Jaime,
when LB_SELECTED { if {[IP::addr [IP::client_addr] equals 10.10.1.1]}{ snatpool snat_pool_10_10_1 } }
- tcl_newfanNimbostratusHi Aaron,
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects