Forum Discussion
Misty_Spillers
Nimbostratus
Sep 23, 2015Need an iRule to choose pool by port.
First of all this isn't http traffic so I can't use the http profile. (I tried, doesn't work)
I basically need an iRule that says something like this. I'll just write in the parts I don't know the syntax for
when CLIENT_ACCEPTED {
if { if dst port less than 50000} {
pool Pool1
} else {
pool pool2
}
}
Can someone help me with the syntax for "if dst port less than 50000" part.
Just to put it in other words. When the client tries to connect with a port less than 50000 send to pool1 and everything else to pool2
Thanks in advance!
Misty
10 Replies
- Brad_Parker_139
Nacreous
Give this a try,
when CLIENT_ACCEPTED { if {[TCP::local_port clientside] << 50000}{ pool pool1 } else { pool pool2 } }- Brad_Parker_139
Nacreous
updated to use TCP::local_port clientside as it is more appropriate. - Misty_Spillers
Nimbostratus
Thank you for the quick response. If I wanted to look at source port instead, would I just change clientside to serverside? Sorry, the documentation I was given is confusing, want to make sure I could it either way. Thanks again! - Brad_Parker_139
Nacreous
TCP::client_port would you give the clients source port. If you changed it to serverside, what you would have would be the source port of the LTM's connection to the backend server not the source port of the client's connection to the LTM.
- Brad_Parker
Cirrus
Give this a try,
when CLIENT_ACCEPTED { if {[TCP::local_port clientside] << 50000}{ pool pool1 } else { pool pool2 } }- Brad_Parker
Cirrus
updated to use TCP::local_port clientside as it is more appropriate. - Misty_Spillers
Nimbostratus
Thank you for the quick response. If I wanted to look at source port instead, would I just change clientside to serverside? Sorry, the documentation I was given is confusing, want to make sure I could it either way. Thanks again! - Brad_Parker
Cirrus
TCP::client_port would you give the clients source port. If you changed it to serverside, what you would have would be the source port of the LTM's connection to the backend server not the source port of the client's connection to the LTM.
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