Forum Discussion
Matthew_M_23576
Nimbostratus
Oct 25, 2018Odd/Even IP address iRule
I have a VIP with 2 backend nodes, and I am trying to create an iRule that will forward traffic based on whether the last octet of the source IP address is an odd or even number (e.g. for ip_addr 10....
Lee_Sutcliffe
Nacreous
Oct 25, 2018Try this iRule - let me know how you get on
when CLIENT_ACCEPTED {
set lastOctet [getfield [IP::client_addr] "." 4]
if {($lastOctet % 2) == 0} {
log local0. "$lastOctet is even"
node 10.10.10.2
} else {
log local0. "$lastOctet is odd"
node 10.10.10.1
}
}
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