How to check if an iRule is active

PLEASE HELP. I am trying to apply an iRule to a virtual server. So I am using the below code for testing if the iRule is active. All the below code suppose to do is to redirect all traffic to google. However, nothing seems to happen. I am not even sure if the iRule is called. I can see the iRule via the network map under the virtual server (the circle next to it is white though, should it be?).

when HTTP_REQUEST {

HTTP::redirect “http:://www.google.com”

}

PLEASE HELP. I am trying to apply an iRule to a virtual server. So I am using the below code for testing if the iRule is active. All the below code suppose to do is to redirect all traffic to google. However, nothing seems to happen. I am not even sure if the iRule is called. I can see the iRule via the network map under the virtual server (the circle next to it is white though, should it be?). when HTTP_REQUEST { HTTP::redirect “http://www.google.com” }

Does the Virtual Server have a HTTP profile assigned? An iRule HTTP event work trigger without one.

Yes, I am using the default http profile.

Is your virtual server using https or http? If https, are you offloading the SSL at the F5? If not, I don’t think you’ll be able to do anything with the request.

These are parameters I used and the rest I left the defaults.

Type: Performance (Layer 4)

Source address: 0.0.0.0/0 Destination Address: 0.0.0.0 All ports

Protocol: ALL protocols Protocol Profile (Client): fastL4 HTTP Profile: http

disabled address and port translation using a default pool

I am not sure what you mean about the offloading the SSL at the F5

If you were using port 443 (https), you would need to specify a clientssl profile Does it work if you use tcp for protocol profile (client)?

It turns that I am using TCP protocol profile instead and if I try and use ALL protocols, it doesn’t allow the http profile to be selected (none).

Ver 11.0.6

Is your destination address actually

0.0.0.0

or is that just replacing the actual ip?

If you change your config to

  • Protocol:

    TCP
    
  • Protocol Profile (Client):

    tcp
    
  • HTTP Profile:

    http
    

and then look at the statistics tab in the config UI for that virtual server… if you open the web site (the VIP) and refresh the statistics, do those stats change as you would expect?

Yes my destination IP is 0.0.0.0 and I only have one profile on the dropdown of protocol profile (for the performance (Layer 4)VS), it is the fastL4.

Is there some module that I need to provision or some configuration that I missed.

i will check the statistics as you suggested. Thanks

I may be wrong (not really a networking guy), but I don’t think you can access a vip at 0.0.0.0. You probably can’t ping it can you? Can you update the destination vip to something different (like other vips you may have) and try that?

Yes you are right, I can’t ping that.

This VS listens to my internal VLAN traffic, I guess I can use the network ID of this VLAN as source for the VS. However, I can’t specify a particular destination IP,I have more than ONE ISP router from different networks configured, that are LB by this VS.

If you are using FastL4 (as you have to, if you have the 0.0.0.0 wildcard IP forwarding virtual server), I think it does not allow L7 processing, and in your iRule the HTTP_REQUEST event is Layer7 processing.

Its a performance (Layer 4) virtual server. The other types do not show an option to select a HTTP profile (after selecting advance). Accordingly, I have to attach a http profile so I can have access to the HTTP_REQUEST event, otherwise One can’t add the iRule.

Sorry, should have read more carefully about the vs type. I think I came across a similar problem quite a while ago. The performance L4 vs is meant for L4 processing and FastL4 is using hw PVA acceleration if possible. I believe the PVA acceleration mode should be set to none to allow HTTP processing with iRules. Not sure if it helps. What if you used additional standard vs or performance (HTTP) virtual server for 0.0.0.0:80 with the iRule instead of the 0.0.0.0:0? You can leave the full wildcard one without the iRule to serve all other ports if needed.

Or change the vs type to standard instead of performance L4? You can also add logging line(s) to the iRule to see whether it fires and does the logic you want.

Thanks. I’ll try that.

I checked the statistics and the iRule doesn’t fire, i.e. The event (HTTP_REQUEST) in the rule does not fire.

I’ll try and boot from an older version of the firmware 11.0.5 and see if that can’t fix the problem.

Try this and see if the irule is hit when CLIENT_ACCEPTED { log local0 " IP::addr [IP::client_addr] client accepted" } Check the ltm logs tail /var/log/ltm

Hi Linda01,

in case you want to redirect a client with your virtual server it has to be of type “Standard” and needs an HTTP-profile assigned. The type “Performance-HTTP” is very limited in capabilities (supports just cookie insert and XFF insert, afaik).

If you change the configuration of your virtual server it will be necessary to close all connections from the client you are testing with because existing connections are not affected by the change.

In case of using i.e. Firefox it really means to close all firefox instances!

You can also temporarily add a log statement to your iRule to check the event is triggered:

when HTTP_REQUEST {
   log local0. "New http request from client <[IP::client_addr]> received <[HTTP::method] [HTTP::uri] [HTTP::version]>, will be redirected"
   HTTP::redirect "http:://www.google.com"
}

From bash please run the following to track the new log events for /var/log/ltm facility:

tail -f /var/log/ltm

Thanks, Stephan