Forum Discussion

pedinopa_170325's avatar
pedinopa_170325
Icon for Nimbostratus rankNimbostratus
Feb 23, 2015

SNAT

I am looking for a irule that will map the source address of specific machines. The situation is that I am load balancing using a pool / VS on my LTM . I need to ensure that ALL machines even if they are on the same subnet) get routed through the LTM. So simply stated I want to use auto map for 1 subnet which all the nodes / pool members are on and all other connections wont use auto map.

 

5 Replies

  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus

    So, on the VS don't have an option for Source Address Translation and then an irule like this might do the trick:

    when CLIENT_ACCEPTED { 
    
         Check if client is in same subnet as pool members 
        if {[IP::addr [IP::client_addr] equals x.x.x.x/x]}{ 
    
            Use snat automap
           snat automap
        } 
     } 
    

    Change x.x.x.x/x to the relevant subnet and any source IP on this range will use SNAT automap. If not then no SNATing will be done.

    Hope this helps,

    N

  • I added the irule (changed x.x.x.x/x to ip subnet) and attached it to the virtual server. It does not appeaar to be working?

     

    • nathe's avatar
      nathe
      Icon for Cirrocumulus rankCirrocumulus
      Hmmm. Check out this wiki. Has an example just like your scenario using LB_SELECTED event. https://clouddocs.f5.com/api/irules/SelectiveSNAT.html
    • nathe's avatar
      nathe
      Icon for Cirrocumulus rankCirrocumulus
      No probs. Glad I could help.