Forum Discussion
iRule to forward traffic based in state pool member
Hi eveyone, I have my F5 connected with 3 Internet Service Provider. I have a pool with 3 pool members: Router Provider A, Router Provider B and Router Provider C. I have an irule to take decision about outgoing traffic.Look at this: if { [IP::addr [IP::client_addr] equals 192.168.2.170/32 }{ pool Pool_xxx snat X.X.X.X Today, if the Router o link of Service Provider is down, I manually edit the Irule and change the Source Nat for the IP of other Provider. How can i do this automatically with an irule?? Foe example, if ip address == Y.Y.Y.Y and the Router A is down, then snat is Z.Z.Z.Z. Any idea?
- Simon_Blakely
Employee
So you have a gateway pool, with gateway_icmp monitors (maybe with a transparent monitor).
You need to select the appropriate SNAT IP address based on the selected outgoing router.
I would apply priority group settings so that you have a preferred router (10.0.0.1) and fallback routers (10.0.0.2, 10.0.0.3).
Then use an irule similar to the following:when CLIENT_ACCEPTED { if {[LB::status pool default_gateway_pool member 10.0.0.1 0] eq "up"} Preferred router 10.0.0.1 up, so use correct SNAT { snat 10.1.0.1 } elseif {[LB::status pool default_gateway_pool member 10.0.0.2 0] eq "up"} Preferred Router not up, Fallback1 router 10.0.02 up, { snat 10.2.0.1 } elseif {[LB::status pool default_gateway_pool member 10.0.0.3 0] eq "up"} Preferred router, Fallback1 router not up, { snat 10.3.0.1 } }
I hope this helps.
Recent Discussions
Related Content
* 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