For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

baekbu07_154640's avatar
baekbu07_154640
Icon for Nimbostratus rankNimbostratus
Aug 12, 2014

[iRule, URLSLB] How to change destination ip address(VIP).

I have been using the URI as below.

 

URI_1 : http://www.aaa.com, This IP(VIP) is "1.1.1.1". This VIP have two pool member(M1, M2).

 

URI_2 : http://www.bbb.com, This IP(VIP) is "2.2.2.2". This VIP have two pool member(M3, M4).

 

I want to do LB as below when client asks "http://www.aaa.com/test".

 

The destination ip address must be changed to "2.2.2.2". Therefore, traffic will flow into pool member(M3, M4).

 

The key here is that the destination ip address in header must be changed to 2.2.2.2.

 

I could change the pool using iRule, but I couldn't change the destination ip address(VIP).

 

Please show me how. or Do you know other methods?

 

2 Replies

  • Not sure why you would want to do that? Why don't you make a L7 decision on the URI and when you see /test/ send it to a pool with members M3 and M4) You can send to a virtual using a iRule (Vip to vip routing) but what your describing would be a better fit as a straight L7 load balance decision.

     

  • To answer your question as you asked it - assume you have.....

    a virtual vs_www.aaa.com_http with pool pl_www.aaa.com_http, and a virtual vs_www.bbb.com_http with pool pl_www.bbb.com_http

    when HTTP_REQUEST {
         This iRule is applied to vs_www.aaa.com_http
        if {[HTTP::path] eq "/test"} {
             Divert to other virtual
            virtual vs_www.bbb.com_http
        }
    }
    

    Note that once the destination is NATed to 2.2.2.2, sent to the 2nd VIP, and a pool member chosen, the destination address will again be NATed to either M3 or M4, so I'd agree with afedden that you are better off selecting the final pool directly from the first VIP ie

    when HTTP_REQUEST {
         This iRule is applied to vs_www.aaa.com_http
        if {[HTTP::path] eq "/test"} {
            pool pl_www.bbb.com_http
        }
    }