Forum Discussion

wscottb13_17908's avatar
wscottb13_17908
Icon for Nimbostratus rankNimbostratus
Apr 24, 2015

iRules for SNAT translations with ISP load balancing

I'm looking for a way to create iRules that would have SNAT translations for specific hosts that needed to be sourced with a specific IP address and autosnat all others. For example, Node A must be sourced from public IP 100.1.1.2 using ISP A, node B would be sourced from public IP 200.1.1.3 using ISP B, while all others that did not need to be sourced from a specific IP would use autosnat to load balancing using both ISPs and setting the source IP to the appropriate self-IP based on the ISP connection used. Is this possible and if so what would the iRule look like?

 

  • As a follow up, would the following work? class HostA { host 192.168.1.10 } class HostB { host 192.168.1.11 } class HostC { host 192.168.1.12 } when CLIENT_ACCEPTED { if { [matchclass [IP::client_addr] equals HostA]} { snat 100.0.0.12 use pool ISP_A } elseif { [matchclass [IP::client_addr] equals HostB]} { snat 100.0.0.13 use pool ISP_A } elseif { [matchclass [IP::client_addr] equals HostC]} { snat 200.0.0.11 use pool ISP_B } else {snat automap use pool DefaultGWPool } }