Forum Discussion
Kmussa_164917
Nimbostratus
Nov 01, 2014Load balance based on the source IP addresses 4th octet
Hello,
I’m attempting to create an iRule that will load balance based on the source IP addresses 4th octet and based on the availability of pool members. If it’s odd, I want it to redirect to http:/...
Kmussa_164917
Nimbostratus
Nov 03, 2014Thanks 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] } }
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