Forum Discussion
Mark_Givens_877
Nimbostratus
Oct 14, 2005iRule help with ports and pools
I need to create an iRule that will redirect incoming connections for certain ports to specific pools. I'm not sure how to do it. I found an example for something similar for v.4. I need to do the same thing but for v.9. I also need to specify a pool for more then one port. Using the 4.x example below, I would need Pool1 to be used if ports 4080 through 4085 were accessed. Is there a way to specify a range of ports instead of ==?
rule AppMgt {
}
if (ip_protocol == 6 and server_port == 4080) {
use ( Pool1 )
}
else if (ip_protocol == 6 and server_port == 5080) {
use ( Pool2 )
}
else if (ip_protocol == 6 and server_port == 9080) {
use ( Pool3 )
}
else {
discard
}
}
Thanks for the help!!
- Brian_Gupta_115
Nimbostratus
Please read the following thread: - Brian_Gupta_115
Nimbostratus
Actually, How many ports are we talking about? An iRule may help if it's a very large number.... - drteeth_127330Historic F5 AccountAre you directing traffic according the the destination port of the client request? If so, then why not set up a separate vip for each port that is a special case?
- Mark_Givens_877
Nimbostratus
I'd like to be able to set up a VIP for each port but it isn't that simple. I'm replacing Cisco Local Directors with BIG-IP's. The infrastructure is in place and I'm not supposed to change anything on the network with the exception of the load balancers. Currently the VIP's on the Local Director load balance multiple ports. For instance, one VIP is used for 10 different ports on a group of load balanced servers. Another VIP is for 4 ports. With a Local Director you can bind multiple ports to a single VIP but you can't with an BIG-IP. I didn't configure the Local Directors. I figured that an iRule that would direct traffic sent to specific server ports to different pools would be the best solution. An F5 engineer mentioned that I could assign port 0 to the VIPs and pools which would load balance all traffic. I might have to do that if an iRule doesn't work. I would rather lock things down somewhat then allow all traffic if at all possible. - Brian_Gupta_115
Nimbostratus
I think there is a disconnect. In F5 terminology a VIP is an IP-Address/Port combination. Multiple VIPs can listen on the same IP address. - Mark_Givens_877
Nimbostratus
I realize that setting up a VIP for each port will work too. The reason I don't want to do that is for administrative purposes. The BIG-IP would have a few dozen VIP's if I did that. I figured there should be a way to use an iRule to accept traffic on a single VIP and send it to the appropriate pools which would make configuration and management much simpler. - drteeth_127330Historic F5 AccountYes, you can do it with an iRule. However, I'm going to recommend that you setup multiple vips. It's more efficient that way. The iRule would look something like this:
when CLIENT_ACCEPTED { if {[TCP::local_port] == 4080} { pool Pool1 } elseif {[TCP::local_port] == 5080} { pool Pool2 } elseif {[TCP::local_port] == 9080} { pool Pool3 } }
- Mark_Givens_877
Nimbostratus
Thanks for the advice/assistance drteeth and brandorr. Much appreciated. - Jessica_42876
Nimbostratus
hi! good mornig! i have a problem, i need create in only one pool many ports with their VS, - hoolio
Cirrostratus
Hi Jessica,
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