Forum Discussion
wfaulk_98141
Altostratus
Mar 28, 2014Get information about Self-IPs in iRule
I have a need for an iRule that enables SNAT if the client and server addresses are in the same subnet. In practice, this only happens if the client and server addresses are on directly connected su...
IheartF5_45022
Nacreous
Mar 28, 2014Hi I think this might work for you - I have assumed that you use a mix of 24/25/26 masks - you adjust as appropriate (following code not tested BTW);-
when LB_SELECTED {
foreach mask [26 25 24] {
if {[IP::addr [clientside {IP::remote_addr}]/$mask equals [IP::remote_addr]/$mask]}{
snat automap
break
}
}
}IheartF5_45022
Nacreous
Mar 30, 2014Right. Good point. I'm afraid you are out of luck - you can't get the self-ip info from an iRule. You'll either need to snat everything or maintain a list of networks (which I agree is unwieldy).
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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