Forum Discussion
Jason_Hook_4092
Nimbostratus
Mar 10, 2015Select member from within two pools via 4th octet value in URI
The following iRule works well, but I'm in need of some expert help altering this to accept a number equal to the 4th octet of the member IP, looking at more than one pool.
https://devcentral.f5...
nitass
Employee
Mar 10, 2015is it something like this?
configuration
[root@ve11c:Active:In Sync] config tmsh list ltm virtual bar
ltm virtual bar {
destination 172.28.24.10:80
ip-protocol tcp
mask 255.255.255.255
pool foo
profiles {
http { }
tcp { }
}
rules {
qux
}
source 0.0.0.0/0
source-address-translation {
type automap
}
vs-index 9
}
[root@ve11c:Active:In Sync] config tmsh list ltm pool foo
ltm pool foo {
members {
200.200.200.101:80 {
address 200.200.200.101
}
}
}
[root@ve11c:Active:In Sync] config tmsh list ltm pool foobar
ltm pool foobar {
members {
200.200.200.111:80 {
address 200.200.200.111
}
}
}
[root@ve11c:Active:In Sync] config tmsh list ltm rule qux
ltm rule qux {
when RULE_INIT {
List of pool name
set static::poollist { foo foobar }
Parameter name
set static::uriparam "member"
}
when HTTP_REQUEST {
set param [URI::query "?[HTTP::query]" $static::uriparam]
if { $param ne "" } {
foreach name $static::poollist {
foreach mbr [active_members -list $name] {
if { [lindex $mbr 0] ends_with $param } {
log local0. "Param=$param Pool=$name Pool member=$mbr"
pool $name members [lindex $mbr 0] [lindex $mbr 1]
return
}
}
}
} else {
No parameter
}
}
}
/var/log/ltm
[root@ve11c:Active:In Sync] config tail -f /var/log/ltm
Mar 10 22:21:14 ve11c info tmm[15262]: Rule /Common/qux : Param=111 Pool=foobar Pool member=200.200.200.111 80
Mar 10 22:21:24 ve11c info tmm[15262]: Rule /Common/qux : Param=101 Pool=foo Pool member=200.200.200.101 80
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