Forum Discussion
lboogie25_20449
Dec 13, 2015Nimbostratus
Basic iRule
Sirs and Ma'ams:
I'm new to F5 (even newer to iRules) and I'm stuck on comprehending the operators/commands. What I'm trying to do is handle traffic from Linux machines and send to one pool whil...
Mark_22062
Nimbostratus
Because you are doing an if statement within an if statement I'd say you would need this:
when CLIENT_ACCEPTED {
if { [IP::addr [IP::remote_addr] equals 192.168.1.1]}
{ if {[TCP::client_port equals 80} {pool Our-HTTP_Pool}}
if { [IP::addr [IP::remote_addr] equals 192.168.1.1]}
{ if {[TCP::client_port equals 22} {pool IRule-22-Test}}
}
A more elegant way would be:
when CLIENT_ACCEPTED {
if { [IP::addr [IP::remote_addr] equals 192.168.1.1]}
{ if {[TCP::client_port equals 80} {pool Our-HTTP_Pool}}
elseif {[TCP::client_port equals 22} {pool IRule-22-Test}
}
You might want to consider what you want to do with traffic that doesn't match.
lboogie25_20449
Dec 16, 2015Nimbostratus
I tried this and it worked like a champ. Thanks for the tip on non-matching traffic. Many thanks for everyone's time!
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