For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Mahantesh_Bisur's avatar
Mahantesh_Bisur
Icon for Nimbostratus rankNimbostratus
Aug 05, 2015

SNat iRule based on destination address

Hi All,

 

I would like to create snat iRule based on the destination IP address. I have VS with 3 pool members. If request hits first 2 pool members then do not SNAT & If destination hits 3rd pool member then SNAT is required.

 

Could any one please help me to script an iRule for above requirement.

 

Regards, Mahantesh

 

6 Replies

  • try this,

    when LB_SELECTED {
      if { not [IP::addr [LB::server addr] equals 10.0.0.1] } {
        snat none
      }
    }
    
  • Thanks arpdays for the reply. So above iRule has been written assuming that 10.0.0.1 is the 3rd pool member ? Correct me If I am wrong.. I will check on this & let you know.

     

    Regards, Mahantesh

     

  • @arpdays,

     

    whether below iRule will work without SNAT on VS ?

     

    when LB_SELECTED { if { not [IP::addr [LB::server addr] equals 10.0.0.1] } { snat none } else { snatpool xyz.com } }

     

  • should do, although this may be simpler,

    when LB_SELECTED {
      if { [IP::addr [LB::server addr] equals 10.0.0.1] } {
        snatpool xyz.com
      }
    }