Forum Discussion
SSHSSH_97332
Nimbostratus
Jan 07, 2012IRule To Source Nat based on Load Balanced Pool
i want to source nat based on the Pool choosen for load balancing
ie :
1-if choosen pool for load balancing is PoolX , source nat using snat-pool-X
2- if if choosen pool for load balancing is PoolY , source nat using snat-object-Y ( thsi SNAt object contains mapping between Origin address & translation address
Can some one help me to get this IRule ?
6 Replies
- hoolio
Cirrostratus
Hi sshssh,
How are you selecting the pools? In general, you could select a SNAT pool based on the selected pool using a switch statement or datagroup to map pool names to snat pool names:when LB_SELECTED { Check the selected pool name switch [LB::server pool] { pool1 { LB pool was pool1, so select the corresponding snat pool snatpool pool1_snatpool } pool2 { snatpool pool2_snatpool } default_pool { LB pool was not pool1 or pool2, so select a default snat pool snatpool default_snatpool } } }
Aaron - SSHSSH_97332
Nimbostratus
Thanks alot
and if i want ( when LB selected , if pool=pool1 & if src-ip=X.X.X.X ) the snat using snat pool= Y
ie : i want to add another condition for src ip - nitass
Employee
e.g.when LB_SELECTED { Check the selected pool name switch [LB::server pool] { pool1 { LB pool was pool1, so select the corresponding snat pool if {[IP::addr [IP::client_addr] equals X.X.X.X]} { snatpool Y } else { snatpool pool1_snatpool } } pool2 { snatpool pool2_snatpool } default_pool { LB pool was not pool1 or pool2, so select a default snat pool snatpool default_snatpool } } } - SSHSSH_97332
Nimbostratus
Thanks alot , last question , what is the difference between "if" & "switch" - nitass
Employee
what is the difference between "if" & "switchJoe has written good article about them. hope it is helpful.
Comparing iRule Control Statements by Joe
http://devcentral.f5.com/Tutorials/TechTips/tabid/63/articleType/ArticleView/articleId/1086424/Comparing-iRule-Control-Statements.aspx - SSHSSH_97332
Nimbostratus
Thanks , it is perfect
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
