Forum Discussion
Load balance based on the source IP addresses 4th octet
Thanks to R Mac, I’m able to learn if the fourth octet is odd or even. However, I’m still not able to redirect based on this information.
when CLIENT_ACCEPTED { set fourthoctet [lindex [split [IP::client_addr] "."] 3] log local0. "CLIENT IP address [IP::client_addr]" log local0. "4th octect $fourthoctet" if { $fourthoctet%2} { log local0. "[IP::client_addr] is odd" } else { log local0. "[IP::client_addr] is even" } }
when HTTP_REQUEST { if { ( { $fourthoctet%2} ) and
( [active_members test01_pool] > 0 )} { HTTP::redirect http://test01.com[HTTP::uri] } elseif { ( { $fourthoctet%2} ) and
( [active_members test02_pool] > 0 )} { HTTP::redirect http://test02.com[HTTP::uri] } elseif { ( { $fourthoctet%2} ) and
( [active_members test02_pool] > 0 ) } { HTTP::redirect http://test02.com[HTTP::uri] } elseif { ( { $fourthoctet%2} ) and
( [active_members test01_pool] > 0)} { HTTP::redirect http://test01.com[HTTP::uri] } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
