12-Jul-2022 01:49
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
12-Jul-2022 03:11
Hello Quasin,
REF - https://clouddocs.f5.com/api/irules/virtual.html
12-Jul-2022 03:15
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
12-Jul-2022 03:30
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"
}
}
12-Jul-2022 06:06
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)
}}
12-Jul-2022 06:54
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
12-Jul-2022 07:15
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?
12-Jul-2022 07:26
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
12-Jul-2022 08:16
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.
12-Jul-2022 08:35
Glad to hear this. Please @Qasim, remember to mark my answer as "resolved". Some upvotes are also appreciated. 😉