Forum Discussion

sgamer's avatar
sgamer
Icon for Nimbostratus rankNimbostratus
Aug 28, 2013

iRule that source SNATs based on destination

We have a server pool in an Internet DMZ that requires the source IP addresses of the servers to be translated into the VS IP address when it's communicating with the Internet. The servers also need to communicate with internal resources using their real IP addresses. I'm new to iRules so I'm wondering if the following is close to correct and/or is there a better way to accomplish it?

 

when CLIENT_ACCEPTED { if { [IP::addr [IP::client_addr] equals 10.0.0.0/8] or [IP::addr [IP::client_addr] equals 192.168.0.0/16] } { snat none } elseif { snat 1.1.1.1 } }

 

1 Reply

  • it is wildcard (0.0.0.0:0/0) virtual server,isn't it? i understand you have to also check destination ip in irule for not using snat.

     

    IP::server_addr

     

    https://devcentral.f5.com/wiki/iRules.IP__server_addr.ashx