Forum Discussion
load balancing beetween two next hop irule
Hi!
I am trying to implement an irule to load balancing between two next hops, like the configuration in the network section but in irule. I am implementing this on a Virtual server forwarding IP.
Someting like this:
when CLIENT_ACCEPTED { if { [class match [IP::client_addr] equals "ip_snat"] and [active_members pool_xxxx] > 0 and [class match [IP::local_addr] equals "dst_video_conf"] } { nexthop vlan_isp3 xxx.xxx.xxx.xxx nexthop vlan_isp2 xxx.xxx.xxx.xxx return } }
Thanks.
- Jeff_Maddox_394Historic F5 Account
You can use rand() with a conditional;
 
if {rand() < .5} {nexthop blah} else {nexthop other} will send roughly 50/50 to either next hop.
 
See related article on ratio load balancing: https://devcentral.f5.com/s/articles/ratio-load-balancing-using-rand-function
 
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