Forum Discussion

sukraf_88722's avatar
sukraf_88722
Icon for Nimbostratus rankNimbostratus
Jan 30, 2008

Help with Irule to forward traffic

What I am needing to do is forwaard http traffic to the internet that matches a IRule instead of our internal pool members. Understand how to match a URI but not how to forward it backout.

 

 

Example: any http uri containing yahoo forward.

 

 

I have tried default_gw pool, wich I cant get to work and have tried to forward to a Ip_forward VIP 0.0.0.0 but in 9.3.0 cant use virtual (poolname}.

 

 

Any thoughts are appreciated.

4 Replies

  • In order to answer your question there are several assumptions that need to be made.

    1. The default route on the LTM points towards the firewall or router that points you our to the internet.

    2. Your client has to be able to route towards the VIP somehow either through your network.

    3. VIP 0.0.0.0:80 at the minimum.

    4. You may need may need SNAT or AUTOSNAT if the clients gateway isn't the LB.

    Your IRULE could look like this, applied on the VIP 0.0.0.0:80

    
    when HTTP_REQUEST {
      if { [HTTP::uri] equals something]} {
        forward
      } else {
        pool pool_name
      }
    }

    You could also use the SWITCH Command, references can be found on the following link so Click here

    I have never tried this particular way of forwarding but that may be the logic you want to go with.
  • the irule written by: cmbhatt is ok, but you did not mention what happens if it does not match the uri, because if the else reffers to pool that has one of your default gateways you will be routed anyway.

     

    doing an irule on the 0.0.0.0 vs will affect all your traffic maybe you can add spesific VS on Performance L4 and add the iRule there.

     

    Shay
  • There are different ways to handle when the URI doesn't match, that the original poster didn't mention. The original poster seemed to only be be interested in how to match the URI and forward it.

     

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    If you're concerned about effecting all traffic, you could always just have the "else" clause of the if statement in that example rule do nothing. That way only traffic that matches the desired pattern is effected at all.

     

     

    Colin