21-Oct-2020 11:09
I have two sources A & B, one vertual server with a pool of two members X & Y
I want source A to send traffic to member X, source B to send traffic to memeber Y
If member X Or Y went down, then trafic from A & B will go to the live memeber
Can you please help with the iRule, persistence will be source address
21-Oct-2020
13:47
- last edited on
04-Jun-2023
21:13
by
JimmyPackets
Hi Anas A. Hijjawi,
Can you try this iRule after change IPs, subnets and poolname?
when CLIENT_ACCEPTED {
if { [IP::addr [IP::client_addr] equals 10.11.12.13/32] && [LB::status pool pool_name member 172.16.20.1 80] eq "up" } {
node 172.16.20.1 80
}
elseif { [IP::addr [IP::client_addr] equals 10.12.14.0/24] && [LB::status pool pool_name member 172.16.20.2 80] eq "up" } {
node 172.16.20.2 80
}
else {
pool pool_name
}
}
21-Oct-2020
17:20
- last edited on
04-Jun-2023
21:13
by
JimmyPackets
Anas,
You can create two pools, one for each client address using Priority Group.
You can then combine them with an iRule to get the behavior you described.
As far as persistence goes you're probably better off doing that at the virtual server level.
No real need to do it within an iRule.
Pool for A:
pool_for_A
Health Monitors = whatever is appropriate for the application/service on X and Y
Priority Group Activation = Less Than 1
Members:
10.0.0.X Priority 2
10.0.0.Y Priority 1
Pool for B:
pool_for_B
Health Monitors = whatever is appropriate for the application/service on X and Y
Priority Group Activation = Less Than 1
Members:
10.0.0.X Priority 1
10.0.0.Y Priority 2
# iRule to select pool based on source IP
when CLIENT_ACCEPTED {
# Select pool for client A
if { [IP::remote_addr] equals "10.0.0.A" } {
pool pool_for_A
}
# Select pool for client B
if { [IP::remote_addr] equals "10.0.0.B" } {
pool pool_for_B
}
}
Hope that helps.