I would like to write an Irule to basically say “if a group of IP’s come into the VIP, load balance to server 1 and 2, all others hit server 3” I’m newish to Irules so would like some help please.
Thanks
I would like to write an Irule to basically say “if a group of IP’s come into the VIP, load balance to server 1 and 2, all others hit server 3” I’m newish to Irules so would like some help please.
Thanks
There are a few ways to deal with this, but one example is to use an iRule data group and match the specific source IP and make a decision based on that. I would set this up using two pools, a data group and a rule as per this example:
Pool1 - Server 1 and 2 Pool2 - Server 3
iRule Data group (String type)
Name: Pool1IPs
Add the IP Addresses to route to Pool1
iRule to direct the traffic:
when HTTP_REQUEST {
if {[class match [IP::client_addr] equals Pool1IPs} {
Pool Pool1
} else {
Pool Pool2
}
}
Hello,
You can use list directly in the irule as shown in the example below :
when RULE_INIT {
set static::ipaddress ["10.1.1.1" "10.1.1.2" "10.1.1.3"]
}
when HTTP_REQUEST {
if { [lsearch -glob $static::ipaddress "[IP::client_addr]"] != -1 } {
pool mypool
} else {
pool default_pool
}
}