Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 

forwarding traffic from one VIP to Another on same LTM (IRULE explanation)

Qasim
Cirrostratus
Cirrostratus

Hi,

 

I have requirement to forward to traffic from one VIP to another on same ltm. I have found an IRULE on this forum but wondering if some could could explain "Virtual name" part to me? I.e. what do I need to type in there?

when HTTP_REQUEST {
if { [HTTP::uri] contains "something" }
{
log local0. "internally routing from [virtual name] to (target VS)"
virtual (target VS)
}

 

also, if you know a better IRULE please share as well.

thanks

9 REPLIES 9

Hello Quasin,

  • [virtual name] -> gives you the name of the current VS.
  • virtual my_vs -> redirects the traffic to this VS (my_vs) 

REFhttps://clouddocs.f5.com/api/irules/virtual.html

 

Regards,
Dario.

thanks @Dario_Garrido,

 

So that name will be populated automatically or I need to type in the name of "this VS i.e. current VS"?

 

Regards,

Qasim

In link provided you have examples of usage. For example:

when HTTP_REQUEST {
  # If the current VS name is not "my_vs" 
  if {[virtual name] ne "my_vs"} {
    # Then, redirect the traffic to a new VS called "my_vs" 
    virtual my_vs
  } else {
    # If it is "my_vs", then just write a message in the log
    log local0. "endless loop avoided"
  }
}

 

Regards,
Dario.

Hi Dario,

I created the IRULE but when assigning to a VS I am getting the following error:

: Unable to find virtual_server ((test_target_vs)) referenced at line 5: [virtual (test_target_vs)]

 

the test_target_vs definitely exists on LTM and here is my IRULE:

when HTTP_REQUEST {
if { [HTTP::uri] contains "/*" }
{
log local0. "internally routing from [virtual name] to (test_target_vs)"
virtual (test_target_vs)
}}

Avoid using "(" ")". Use this instead:

virtual test_target_vs

Btw, if the VS is located in a different partition than /Common, you need to reference that partition.

virtual /my_partition/my_vs

 

Regards,
Dario.

Tried that too - unfortunately same error. also, there only a single partition.

is there any pre-requisite for the virtual to work? i.e. something I need to enable/disable perhaps?

Are you using characters different than letters and numbers?

Try with this:

virtual /Common/{my_vs_name}

Note that you have to use curly brackets and replace "my_vs_name" with the exact name of the VS.

Also, take into account that iApps are built under folders

/Common/iApp_folder/my_vs

 

Regards,
Dario.

thanks mate, really appreciate it. It has finally accepted the IRULE but the target VS is still not seeing any traffic. 

 

I can see trafic on the VS with this IRULE and I can IRULE is getting hits too.

Glad to hear this. Please @Qasim, remember to mark my answer as "resolved". Some upvotes are also appreciated. 😉

Regards,
Dario.