Forum Discussion

Ken_Wong_48678's avatar
Ken_Wong_48678
Historic F5 Account
Dec 21, 2007

select virtual server in iRule

Hi,

 

 

I want to the iRule to select another virtual server based on the selected memeber. The iRule shown below, I can see the log in ltm log but cannot use the vs1 or vs2...any idea? Thansk!

 

 

when LB_SELECTED {

 

if { [LB::server addr] eq "192.168.20.1" } {

 

virtual vs1

 

log local0. "vs1 selected"

 

}

 

elseif { [LB::server addr] eq "192.168.20.2" } {

 

virtual vs2

 

log local0. "vs2 selected"

 

}

 

}

 

 

Regards,

 

Ken

5 Replies

  • As nmenant hinted at, you must be on 9.4.0 or higher to use the virtual command (Click here) to specify that the request should be sent to another virtual server.

     

     

    Aaron
  • I am having problem using the virtual command in an iRule. The LTM version is BIG-IP 9.4.3.

    when HTTP_REQUEST {
    log local0. "Request received, route to vs_01"
    virtual vs_01
    }

    The ltm log shows that vs_01 received the request but the tcpdump doesn't show any request being sent out of the LTM to the node in vs_01's default pool.

    Is there any other configuration I am missing? Please help! Thank you!
  • if vs 01 receive the traffic then it should be ok.

     

     

    You should check your configuration of this VS, maybe you forgot something (SNAT or something else)
  • I checked the configuration of vs_01. Everything looks good. I also tried to hit it with traffic and it works.

     

     

    Strangely, if I hit the vs_01 first directly and then switch to the virtual server which has this rule applied to, the requests would go through for a short period of time. I tested it using both the browser and the iRule Editor generate traffic tool.

     

     

    Any idea? Thanks!