Forum Discussion
Blaise_12761
Nimbostratus
Nov 05, 2007Transition from Foundry to LTM loadbalancer
Hello,
I am not sure if this has been addressed in the past, but I am in the process of moving from a Foundry platform to a LTM. One of the key features that I am going to need to implement is what Foundry calls "URL Mapping" or "Layer 7 switching".
I am going to need to be able to send traffic matching a certain pattern to a selected group of servers in the VIP.
A sample entry on the foundry would look like this:
url-map test
method suffix
default 2
match "/test/something/junk123.swf" 1
match "/test/something/junk135.swf" 1
match "/test/something/junk157.swf" 1
match "/test/something/junk246.swf" 1
I would have a virtual server with multiple real servers bound to it. Out of that group I would have 2 servers that would accept this "special" traffic. All other traffic would be balanced across the remaining real servers.
I was told that an irule needs to be created to do this, but I am not familiar with this.
Can someone help explain and maybe include an example that I can modify?
Thanks.
10 Replies
- This can be implemented in several ways.
1. HTTP Class Profile
In the LTM GUI (Assuming you have this feature licensed), Select Local Traffic.Virtual Servers.Profiles. Then from the drop down menus select Protocol.HTTP Class. In here you can create class profiles that associate certain classes of HTTP requests (Uris, Hosts, Headers, Cookies) to map to certain pools. In this case you could create the virtual server with the default pool of servers and then assign the class profile with the above URI's mapping to a secondary pool of servers.
2. iRules
Associate a default pool of servers to your Virtual server. Then assign an iRule like the followingwhen HTTP_REQUEST { switch [string tolower [HTTP::uri]] { "/test/something/junk123.swf" - "/test/something/junk135.swf" - "/test/something/junk157.swf" - "/test/something/junk246.swf" { pool swf_pool } } }
If you want to assign to multiple pools, you can use wildcards as followswhen HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "/test/something/junk123.swf" - "/test/something/junk135.swf" - "/test/something/junk157.swf" - "/test/something/junk246.swf" { pool swf_pool } "*.gif" - "*.jpg" - "*.png" { pool img_pool } } }
Hopefully this gives you enough to get you going.
-Joe - Blaise_12761
Nimbostratus
Thanks, That was quick. I would love to try this, but I do not have my LTM yet. I will give this a shot as soon as I get it and let you know the results. Thanks you so much for your assistance. - Blaise_12761
Nimbostratus
I am finally getting around to testing this irule, but I need to make a modification since I only have one VIP and one pool to play with.
I want to redirect the traffic in the first example above to a different URL that will be in the same pool. ( I hope I am explaining this correctly.)
I am assuming that this would be the way to do it:
when HTTP_REQUEST {
switch [string tolower [HTTP::uri]] {
"/test/something/junk123.swf" -
"/test/something/junk135.swf" -
"/test/something/junk157.swf" -
"/test/something/junk246.swf" {
HTTP::uri "/deadzone/dropit"
}
}
} - Blaise_12761
Nimbostratus
I tried to apply this irule to a vip that only has one pool called debian64-1.
when HTTP_REQUEST {
switch [string tolower [HTTP::uri]] {
"/test/something/junk123.swf" -
"/test/something/junk135.swf" -
"/test/something/junk157.swf" -
"/test/something/junk246.swf" {
pool debian64-1
}
}
}
But get this warning: What am I missing?
01070394:3: HTTP_REQUEST event in rule (URL_mapping) requires an associated HTTP or FASTHTTP profile on the virtual server (testvip). - JRahm
Admin
In your virtual server configuration under the property tab, select http (or one of the other options) for http profile field. - Blaise_12761
Nimbostratus
I am using version 9.4.1.
Under "LOcal Traffic" I clicked on the "+" box and the General properties screen for the Virtual servers came up. Is this correct?
I tried to select "http" from the http profile pull down. Now it won't let me exit unless I select the destination and service port. - Blaise_12761
Nimbostratus
I think that I was looking in the wrong field.
I was able to call up the "Advanced" configuration field and changed the type from Performance (Layer 4) to Performance (HTTP).
This allowed me to add the irule to the Virtual server.
What is the difference between the (Layer 4) and (HTTP) types?
Now I am going to try and do some testing. I hope... - JRahm
Admin
I think you are now creating a new virtual server. If you click virtual servers to the left of the "+", then select the virtual server you have already configured, in that properties screen you should see the option to apply the http profile. Please reference the configuration guide for screenshots. - Brian_Herr_1028
Nimbostratus
I came from a Cisco load balancer back ground so learning the LTM was a new experience. I can tell you from personal experience that if you can take the F5 basic and advanced classes together ( first is 2 days the second is 3) you will have a whole new appreciation for the LTM platform. Taking that class was the best thing I did to change my thinking from previous load balancer methods to thinking the LTM way. Hope your labs go well. - JRahm
Admin
If you do get the chance to go to class in Seattle, make a point to introduce yourself to the DevCentral team. Meeting up with Colin & Joe was one of the highlights of my trip...that and calling 9-1-1 for the poor guy who started siezing after getting sucker-punched right outside in the cul-de-sac.
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