Forum Discussion

Nicolas_ROMERO_'s avatar
Nicolas_ROMERO_
Icon for Nimbostratus rankNimbostratus
Dec 30, 2015

iRule SNAT for multiple ISP

Hi,

 

I tried to configure an iRule to SNAT specific LAN to a specific ISP (wan link). When I bind this iRule to my default VS (in fastL4) the iRule doesn't match when I generate traffic from my lan. I don't know if my iRule is good... :

 

when CLIENT_ACCEPTED { set my_ip [IP::client_addr]

 

if { [IP::addr [IP::client_addr] equals X.X.X.X/26] or [IP::addr [IP::client_addr] equals Y.Y.Y.Y/26]} {snat Z.Z.Z.Z pool default_gw_pool } else {snatpool snat_pool-CLD_ALL pool default_gw_pool } }

 

Some have an idea?

 

  • Hi,

     

    I applied the iRule. The problem is that the iRule is not matching with the traffic. I don't have the pattern "VS Reached" in my ltm log file.

     

    Do you know how can I debug this problem?

     

    When I look my tcpdump I still have a traffic passing from the LAN through the wrong ISP.

     

  • Hi Nicolas,

     

    did you applied the changes I've suggested a few post earlier?

     

    "The default-VS needs to be changed to "Forwarding (IP)" mode, with Destination Address/Mask 0.0.0.0/0, global SNATPOOL settings for ISP2 and point the default route to Y.Y.Y.1. Delete the conditional SNAT rules and also the default_gw_pool"

     

    Cheers, Kai

     

  • Hi,

     

    If I put the default-VS with Forwarding IP mode, I will not be able to load balance traffic through multiple links right? My final goal is to loadbalance traffic through multiple Links.

     

    According to my problem I found something interesting. I understand why the iRule was not matching! There was a mistake on the VS_default configuration which had a Destination Adress 0.0.0.0 instead of 0.0.0.0/0 So now my default VS is matching. On the BIGIP I see a traffic from my LAN to internet but I don't have the return...

     

  • Hi,

    you can create the VS with performance (Layer 4) mode and make sure the address translation and port translation are unchecked... (these options are unchecked if the destination is a network)

    In this VS, you can define the pool default_gw_pool

  • Hi Nicolas,

    the previously provided iRule would in combination with an "Forwarding (IP)" virtual perfrom some sort of load balancing, where each customer-segment would use a different nexthop address and snat address (aka. using a different WAN-Link).

    Cheers, Kai

  • Okey thank you guys for those information.

     

    I will test first the VS fastL4 with address translation and port translation disabled. I prefer this option to avoid iRules (that are more difficult to maintain). Then if it doesn't work I will try to use iRules. I give you a feedback ASAP.

     

  • Hi Guys,

     

    We are approaching the goal !

     

    Using the FastL4 still doesn't work because as Kai explain, I have to configure different route for some specific LAN.

     

    I switch the default VS to a Forwarding IP + iRule. It works with the LAN which have the iRule with next-hop but with others LAN which have the irule with the pool gateway I still have some timeouts because in the capture I see that the BIGIP still route some traffic through the incorrect Link.

     

    I though that it was because the default VS have a pool which include the specific Link used by the iRule next-hop. I disble this link on the defautl pool and IT WORKS! I just would like to confirm with you if i'm right and if this is the correct configuration. To summerize : - VS_default in Forwarding IP with iRule (which route traffic through a specific next-hop for LAN1 and on the other hand a SNAT-pool for all others LAN) - Default_pool (bound to default_vs) : with two links (except the specific link for LAN1) - A SNAT_pool : to SNAT all LAN except the LAN1 - A SNAT : to SNAT the LAN1 on a specific Public_IP on the Link1 network.

     

    • Kai_Wilke's avatar
      Kai_Wilke
      Icon for MVP rankMVP
      Hey Romeo. You can't have pools on a "Forwarding (IP)" virtual. You may use a pool for the default_gw on your route domain. But is this required? Note: I tend to not use any default_gw_pools but use HSRP/VRRP on the upstream routers instead... ;-) Cheers, Kai
    • Nicolas_ROMERO_'s avatar
      Nicolas_ROMERO_
      Icon for Nimbostratus rankNimbostratus
      Hi, Okey, I remove the pool on the Default_VS. You're right, I have a default route with a default_gw_pool which have 2 routers from 2 different ISP. That's why I have to use a pool. I also optimize the configuration deleting the SNAT entry for LAN1 because the SNAT is performed by the iRule. So now i think that everything is OK !
    • Kai_Wilke's avatar
      Kai_Wilke
      Icon for MVP rankMVP
      Glad to hear, that you've finally solved your Multi ISP / SNAT nightmare ;-)
  • This is a very good news! I would like to thank you all for you advice and your involvement on my case.