Forum Discussion

ASF's avatar
ASF
Icon for Altocumulus rankAltocumulus
Jun 15, 2020

http traffic shift to a VIP in another LTM

Hi

I am a newbie in irule development.

Despite that I have to deploy an irule that redirects http traffic to a vs placed in another LTM device.

 

SetUp details:

 

Clients reach www.mypage.com at vs_aaa.bbb.ccc.ddd_80 configured in system LTM-A, a BIG-IP appliance.

vs_aaa.bbb.ccc.ddd_80 includes fancy irules to modify GET statement and redirect the request to appopiate pool.

 

This works perfect.

 

But a new BIG-IP gear (LTM-B) has been placed which will handle www.mypage.com requests in the future.

In LTM-B, vs_aaa.bbb.ccc.xxx_80 (same subnet as previous one) will handle the requests.

 

Customer migration from legacy virtual server to new virtual server will be based on client source address for several reasons.

 

How would an irule at LTM-A look like so that whenever a connection from a migrated customer reaches vs_aaa.bbb.ccc.ddd_80

the request is redirected to vs_aaa.bbb.ccc.xxx_80 at LTM-B?

 

 

I have tryied the following:

 

1st step: Created a new datagroup customer_migrated type subnet.

2nd step: Create migration_irule:

 

when HTTP_REQUEST {

 if { [class match [IP::client_addr] equals customer_migrated ]}{

    HTTP::redirect "http://aaa.bbb.ccc.xxx [HTTP::uri]"

    log local0. "client [IP::client_addr] successfully mgrated to [HTTP::uri] "

    event disable

   } else {

    pool pool_aaa.bbb.ccc.ddd_80

    log local0. "cliente [IP::client_addr] NO migrado "

       }    

}

 

 

But I does not work:

The If clause works fine, filtering out migrated customers or leaving them untouched.

The problem is that no traffic hits the VIP at the new appliance vs_aaa.bbb.ccc.xxx_80

 

Thanks for helping...

 

 

 

  • Hi,

     

    If I understand right both VIP uses same host name so you can try like that

    Create pool on LTM-A like LTM_B_VIP and set node IP with VIP of vs_aaa.bbb.ccc.xxx_80

     

    when CLIENT_ACCEPTED { 

    set def_pool [LB::server pool]

    if { [class match [IP::remote_addr] equals customer_migrated] } { 

      pool LTM_B_VIP

    } else { 

    pool $def_pool

    }

    }

     

     

  • Hi,

     

    If I understand right both VIP uses same host name so you can try like that

    Create pool on LTM-A like LTM_B_VIP and set node IP with VIP of vs_aaa.bbb.ccc.xxx_80

     

    when CLIENT_ACCEPTED { 

    set def_pool [LB::server pool]

    if { [class match [IP::remote_addr] equals customer_migrated] } { 

      pool LTM_B_VIP

    } else { 

    pool $def_pool

    }

    }

     

     

  • ASF's avatar
    ASF
    Icon for Altocumulus rankAltocumulus

    Thank you for your reply msenturk!

    It worked!

    In case the client matched the customer_migrated condition, I added the clause

     

    event disable

     

    to prevent other irules present at the VS to be executed.

     

    Thanks!

    • msenturk's avatar
      msenturk
      Icon for Altocumulus rankAltocumulus

      Nice to hear that.

       

      Yea if first VIP has got Irules its best to disable events after the match.