Forum Discussion

atultilekar_718's avatar
atultilekar_718
Icon for Nimbostratus rankNimbostratus
Jan 29, 2016

Can We have multiple snats assigne dto single VIP.

I have single VIP say 192.168.1.5 and i need to have three snats assigned to it.

 

Source NAT (PAT) to 172.x.x.x on server interface vlan 2692 (SNAT done if servers are routed to vlan A) Source NAT (PAT) to 10.x.x.x on server interface vlan 2858 (SNAT done if servers are routed to vlan B ) Source NAT (PAT) to 192.x.x.x on server interface vlan 2699 (SNAT done if servers are routed to vlan C)

 

Please suggest how can i fulfill this requirement.

 

1 Reply

  • mo_99289's avatar
    mo_99289
    Historic F5 Account

    I think this example could help you:

     

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

     

    the pseudo code an exmaple:

     

    assume that you have servers: 1.1.1.100 and 2.2.2.200

     

    when routing to server 1.1.1.100, use snat 1.1.1.1

     

    when routing to server 2.2.2.200, use snat 2.2.2.2

     

    when LB_SELECTED {
       log local0. "LB_SELECTED [LB::server addr]"          
       if { [IP::addr [LB::server addr] equals 1.1.1.100] } {
          log local0. "snat based on pool member"
          snat 1.1.1.1
       }   
       if { [IP::addr [LB::server addr] equals 2.2.2.200] } {
          log local0. "snat based on pool member"
          snat 2.2.2.2
       }
    }

    if it suite your need, you could revise it accordingly.