Forum Discussion

THASIN's avatar
THASIN
Icon for Nimbostratus rankNimbostratus
Oct 29, 2013

Intelligent SNAT with two condition

Hi F5iers, I have two ISP link which are load balanced using BIG_IP link controller. I want to apply intelligent SNAT for outgoing traffic based on two conditions - conditions are- IF LB selects first ISP link and source IP addresses are within IP address data class group, then SNAT should be 182.1X.XX.X or IF LB selects second ISP link and source IP addresses are within IP address data class group, then SNAT should be

 

183.2X.XX.X

 

I have created the following irule.

 

when LB_SELECTED { if { [IP::addr [LB::server addr] equals 185.1X.1XX.1] } {

 

if { [class match [IP::client_addr] equals sp_internal_ip]}{ snat 1XX.1X.1XX.XX } } else { if { [class match [IP::client_addr] equals sp_internal_ip]}{ snat 1XX.1X.1XX.XX } } }

 

Appreciate your comments and feedback to make it elegant this irule

 

Regards Thasin

 

1 Reply

  • Here's my take;

    when LB_SELECTED { 
     If link A is selected and the client is internal
     if { [IP::addr [LB::server addr] equals 185.1X.1XX.1] && [class match [IP::client_addr] equals sp_internal_ip] } {
       snat 1XX.1X.1XX.XX
      }
     If link B is selected and the client is internal
     elseif { [IP::addr [LB::server addr] equals 185.1X.1XX.1] && [class match [IP::client_addr] equals sp_internal_ip] } {
       snat 1XX.1X.1XX.XX 
      }
    }