Forum Discussion

mulhollandm_648's avatar
mulhollandm_648
Icon for Nimbostratus rankNimbostratus
Dec 11, 2013

can i use an irule to route traffic

folks

 

is it possible to route traffic directly to a endpoint

 

for example

 

if i have several web servers, 10.5.5.5, 10.6.6.6, 10.7.7.7, 10.4.4.4 etc

 

can i use a single irule so the ltm 1600 (11.4) will route traffic to the web servers without having to declare each individual endpoint as a node

 

thanks to anyone taking the time to reply

 

7 Replies

  • Are you averse to creating a pool? This would be the simplest approach. You could alternately specify the server in a node statement within the iRule, assuming you have some logic to what goes where. Example:

    when HTTP_REQUEST {
        switch -glob [string tolower [HTTP::uri]] {
            "/foo*" {
                node 10.5.5.5 80
            }
            "/bar*" {
                node 10.6.6.6 80
            }
            "/test*" {
                node 10.7.7.7 80
            }
        }
    }
    
  • Christian_30338's avatar
    Christian_30338
    Historic F5 Account

    Hello, yes you can use the irules "node" command to route traffic directly to a server. For example.

    when HTTP_REQUEST {
        if { [HTTP::uri] ends_with ".gif" } {
             node 10.1.2.200 80
        }
    }
    

    However this doesn't take advantage of any of the load balancing technology and you still have to define the nodes in the iRule. Another option you might want to have a look at depending on your architecture and application design is a forwarding VIP. This can be used to route traffic to an endpoint.

    Does that answer your question?

    • mulhollandm_648's avatar
      mulhollandm_648
      Icon for Nimbostratus rankNimbostratus
      christian thanks for your help would i need a forward vip for each web server? thanks again
  • Philippe_CLOUP_'s avatar
    Philippe_CLOUP_
    Historic F5 Account

    Hi mulhollandm, i am not sure i get your question.

     

    Within an iRule, the "node" command can help you target a destination IP, whatever it can be.

     

    But traffic has to be captured through a Virtual Server forthat.

     

    So if your idea is to have a Virtual Server "wildcard" for a network, and use in the iRule something like "node [IP::local_addr]", then you can do something here. But you even don't need to use an iRule if there is no default pool configured on that VS. By default, if there is no default pool on you VS, we will forward to the destination (as far as the destination IP is existing and alive).

     

    But i have porbably missed what you are looking for.

     

    • mulhollandm_648's avatar
      mulhollandm_648
      Icon for Nimbostratus rankNimbostratus
      philou many thanks i have a single pool to forward traffic to i'll try and test out your idea and see if i can sort it out many thanks to you for your help, its gretly appreciated
  • Hi mulhollandm, i am not sure i get your question.

     

    Within an iRule, the "node" command can help you target a destination IP, whatever it can be.

     

    But traffic has to be captured through a Virtual Server forthat.

     

    So if your idea is to have a Virtual Server "wildcard" for a network, and use in the iRule something like "node [IP::local_addr]", then you can do something here. But you even don't need to use an iRule if there is no default pool configured on that VS. By default, if there is no default pool on you VS, we will forward to the destination (as far as the destination IP is existing and alive).

     

    But i have porbably missed what you are looking for.

     

    • mulhollandm_648's avatar
      mulhollandm_648
      Icon for Nimbostratus rankNimbostratus
      philou many thanks i have a single pool to forward traffic to i'll try and test out your idea and see if i can sort it out many thanks to you for your help, its gretly appreciated