Forum Discussion

Luis_Araujo_560's avatar
Luis_Araujo_560
Icon for Nimbostratus rankNimbostratus
Dec 18, 2017

Snat Pool Member Persist

Hello @ALL,

 

I´m facing issue with a snat persist. I need to persist a outbound connection in same snat pool member.

 

How is my scenario:

 

Clients -> Web Proxy -> F5 LTM -> ISP "X.X.X.X/28"

 

How is my virtual server config:

 

  • VS Forwarding ALL (0.0.0.0/0) - Forwarding IP;
  • Source: Proxy IP (10.20.30.40/32);
  • All Protocols;
  • Snat Pool: snat_pool_isp (200.1.2.1, 200.1.2.2, 200.1.2.3);
  • Pool: pool_default_gw (isp_member: 200.1.2.254).

Well, When the proxy forwarding the client's connection with the internet, I need to select a IP (member) of snat pool and persist that connection in the same snat pool member.

 

I mean, if a client starts a connection with the internet, he should always uses the same IP that was selected in snat pool

 

I tried to do some iRules, but I had not success.

 

Can someone help me about that?

 

Kinds Regards. Luis Araujo

 

1 Reply

  • Fun exercise! Not sure if I nailed the server side event here since it's a forwarding server. You might want to play around a bit with that part, but other than that this could work.

    when CLIENT_ACCEPTED {
    
        set newrecord 0
    
        if { [table lookup "ippersist[IP::remote_addr]"] == "" } {
            snatpool myPool
            set cip [IP::remote_addr]
            set newrecord 1
        } else {
            snatpool myPool member [table lookup "ippersist[IP::remote_addr]"]
        }
    
    }
    
    when SERVER_CONNECTED {
    
        if { $newrecord == 1 }{
            table set "ippersist$cip" [IP::local_addr] indef indef
        }
    
    }