Forum Discussion
dkraut_23236
Nimbostratus
Sep 02, 2008newbie needs irule help....
ok, I'm completely new to irules so break out the coloring book and crayons for me! lol.
I'm trying to create a rule that takes the incoming URI from the client and appends a number to the end of the host and then forwards to the corresponding pool member. For example, John Doe sends a request to http://bmcmtr:5282
and then the F5 adds a 01 to this request and forwards to pool member 01 as > http://bmcmtr01
The next request does the same thing except it is forwarded to 02 and the next to 03 and the next to 04.
The irule below generates "wrong args" errors when I attempt to create it. Am I completely off base here? Thanks!
when HTTP_REQUEST {
if { ([HTTP::host] eq "BMCMTR:5282") } {
HTTP::host "BMCMTR01:5282"
pool HTTP_pool member 10.1.1.14 80
}
if { ([HTTP::host] eq "BMCMTR:5382") } {
HTTP::host "BMCMTR02:5282"
pool HTTP_pool member 10.1.1.15 80
}
if { ([HTTP::host] eq "BMCMTR:5382") } {
HTTP::host "BMCMTR03:5282"
pool HTTP_pool member 10.1.1.16 80
}
if { ([HTTP::host] eq "BMCMTR:5382") } {
HTTP::host "BMCMTR04:5282"
pool HTTP_pool member 10.1.1.17 80
}
}
}
- Colin_Walker_12Historic F5 AccountIt sounds like you're trying to implement a counter, of sorts, and update the hostname with the value of the counter and then forward to a pool based on that number, resetting it every fourth pass or so. Does that sound about right?
- dkraut_23236
Nimbostratus
For whatever reason, they require that a number be appended to the host name before sending it to the server. I was basically trying to accomplish that while also load balancing. It doesn't have to happen in any set order. User 1 can be sent to server03 and user 4 can be sent to server01, etc. - Patrick_Chang_7Historic F5 AccountYou can set up a normal pool and choose whatever load balancing method you want. The iRule would be something like this:
- dkraut_23236
Nimbostratus
Thanks pchang. So if I add in my data (assuming pool members were 10.1.1.1 thru 10.1.1.4) Would the rule look like this? - dkraut_23236
Nimbostratus
Posted By pchang on 09/02/2008 8:00 PM
- dkraut_23236
Nimbostratus
Hi nmenant, thanks for the reply. - hoolio
Cirrostratus
You can create a datagroup in the GUI under Local Traffic >> iRules >> Datagroups tab >> Create. If you install the iRule editor (Click here) you can create a datagroup from the Tools | Datagroup Editor menu. - dkraut_23236
Nimbostratus
ok all, thanks for all the replies. After numerous iterations, etc. I've come up with the following rule. However, one of our guys took a look at this and could not understand how it would actually load balance? Will this dog hunt? - The_Bhattman
Nimbostratus
A couple of things - dkraut_23236
Nimbostratus
Posted By cmbhatt on 09/09/2008 3:07 PM
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