Forum Discussion
Christopher_Ach
Nimbostratus
Dec 16, 2008Can a Irule do this 0.0.0.0-->LB-->to one of 2 SNAT Pools
Hi
I have a incoming traffic stream that I want to SNAT.
I want to control the way I SNAT the traffic based on a defined ratio (60-40).
So I want to have 2 separate SNAT Pools with obviously different Subnets in each.
This needs to be a pure routing function on the LTM at Fast-L4
So im thinking a single VIP 0.0.0.0 and 2 SNAT pools.
Traffic is destined for the Internet and is random so I cant make a decision using the source or destination IPs. Also the outbound GW is the same for both SNAT pools, so the LTM has a default route to that GW.
Can an Irule do this?
All traffic in --> LB to one of two Snat Pools based on (traffic ratio or Least cons)
Any ideas?
Chris
2 Replies
- dennypayne
Employee
This sounds do-able, I'm not sure of the best way to do the ratio but certainly you can use the snatpool command based on a decision that is made in the iRule logic of when to use each one.
My first thought is just a loop from 1 to 10 where the first 6 connections are sent to snatpool 1 and the rest to snatpool 2. Someone can probably think of a more efficient way to do that but here goes...
pseudocode:when RULE_INIT { set counter 0 } when CLIENT_ACCEPTED { if $counter < 6 { snatpool pool-1 } else { snatpool pool-2 } increment $counter (not sure of the best syntax here) if $counter > 9 { set counter 0 } }
Denny
EDIT: edited the code a bit... - Christopher_Ach
Nimbostratus
Hi Denny
Thanks and yes this is somewhat on the lines of what im looking for, I thought perhaps we could have the use of the inbuilt algorithms like "round robin" or "least cons" but at this stage all I really need is a ratio and i guess this is a great start.
Chris
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