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

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

Yes, also assumes SNAT is configured on VS

cheers

@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
  }
}

OK Thanks arpydays for the response. I will check on this & will update you.