10-Nov-2022 13:54
Hello,
Can i use two différents servers with one virtual server, for example :
1/ abc.com :
Vs 172.16.250.100 -----> server1 : 10.10.10.10
2/ xyz.com :
Vs 172.16.250.100 -----> server2 : 10.10.10.11.
Thanks you
Solved! Go to Solution.
20-Nov-2022 07:00
@Abdou76 ,
sure you can do this ,
try this :
when HTTP_REQUEST {
if {[HTTP::host] eq "abc.com"}{
pool pool_1
} elseif {[HTTP::host] eq "xyz.com"}{
pool pool_2
} elseif {[HTTP::host] eq "ghl.com"}{
pool pool_3
}
}
Hope it works with you.
Regards
20-Nov-2022 07:06
10-Nov-2022 14:45
Hi @Abdou76 ,
Yes , it is doable on F5 by two methods LTM Policies or iRule :
First :
> create two pools , and Put " 10.10.10.10 in pool_1" and "10.10.10.11 in Pool_2".
> then , Go to ( Local traffic , Policies ) and follow the below Article , steps to construct you LTM policy :
https://techdocs.f5.com/kb/en-us/products/big-ip_ltm/manuals/product/local-traffic-policies-getting-...
its quite Long but it is helpful 😀
- you need to perform such below snap shots :
Create two rules in LTM policy :
Do not Forget to Publish your Policy to be able to assign it in virtual servers , find below :
> assign your LTM policy to your virtual server " 172.16.250.100"
> you can do this Task By iRule :
when HTTP_REQUEST {
if { [HTTP::host] eq "abc.com" }
{ pool_1} elseif
{ [HTTP::host] eq "xyz.com" }
{ pool_2}
}
> I recommend LTM policy as it is simpe and light on F5 appliance.
I hope this helps you.
Regards
11-Nov-2022 00:31 - edited 11-Nov-2022 00:36
Correct answer, just be careful with iRule syntax because putting parenthesis on new lines like that can result in issues - expecially on the elseif statement. Also, pool command is pool <pool_name>
when HTTP_REQUEST {
if {[HTTP::host] eq "abc.com"}{
pool pool_1
} elseif {[HTTP::host] eq "xyz.com"}{ pool pool_2 }
}
I would suggest using LTM policies too, since it uses a configuration template that is better supported during software upgrades, and also typically performs 20% faster.
11-Nov-2022 01:09
Hi @CA_Valli ,
I am grateful for your advise ,
I do add this in my Notes , when implementing iRules.
Thanks alot
18-Nov-2022 02:28
Thanks you for feedback, but thé availability of m'y VS still unknown (blue color)
18-Nov-2022 02:43
Okay @Abdou76 ,
make sure to assign a monitor to your pools until make them available.
Then apply your iRule to your Virtual server.
The best way to make it available is assigning a default pool directly , but I Tested it on my lab and I see the virtual server available when " all pools that have been used in irule UP and Available by their health monitor "
Try it
Regards
18-Nov-2022 04:48
Hi Mohamed
Bellow are my captures :
18-Nov-2022 05:20
okay ,
did you test this virtual server and worked well with you after assigning iRule.
it should work as blue squire means it recieves traffic and process it same as available green circle.
test it first please.
18-Nov-2022 06:18
The VS works fine if i remove the irule and make the default pool to pool1 or pool2.
Thank you.
18-Nov-2022 06:24 - edited 18-Nov-2022 06:24
No @Abdou76 ,
I mean when you assign the iRule to your virtual server , and removing and pool1 or pool 2 from " default pool resouces.
did my iRule worke with you or not ?
18-Nov-2022 06:36
No it doesn't mork, the VS still blue.
18-Nov-2022 06:54
@Abdou76 ,
Okay ,
this iRule is wrong :
it should be like this :
when HTTP_REQUEST {
if {[HTTP::host] eq "abc.com"}{
pool pool_1
} elseif {[HTTP::host] eq "xyz.com"}{
pool pool_2
}
}
_____________________________________________________________
> do you have 2 pools and each pool has 1 pool member.
or you have only one pool contains 2 members '' 10.10.10.10 , 10.10.10.11" ?
it is important question as it will need to change in iRule
18-Nov-2022 07:14
I have 2 pool; membre of pool1 is 10.10.10.10. membre of pool2 is 10.10.10.11.
18-Nov-2022 07:22
Okay @Abdou76 ,
you need to use the iRule that I send recently in last reply.
you only need to replace pool_1 to "PREDOM_APP_pool" and Pool_2 with "website_APP_pool" as well.
The Irule that you send before is wrong.
Test it and tell me.
Regards
18-Nov-2022 07:26
Ok Mohamed
I will test with a new irule, and i will inform you.
Thank you.
18-Nov-2022 07:33
yes do that , I am waiting .
most welcome @Abdou76 🙂
18-Nov-2022 09:06
Hi Mohamed
error when i assigne irule to VS.
18-Nov-2022 09:11
Hi @Abdou76 ,
you wrote the pool_names wrong inside iRule ,
try to take it "copy" From pool list and "Past" it inside iRule.
Pool name inside irules are Case sensitive , so you must respect lowercase and uppercase letters.
This error related to this.
Try again and inform me.
18-Nov-2022 09:35
I did exactly your recommendation copy and past !!
18-Nov-2022 10:25
Okay , this error isn’t relevant to irule itself , there is a mismatching wtih irule’s pool selection and the real pools that you created.
> could you please remove the gap between ( Pool ) and ( Pool_name ) in irule.
I mean ,
line 3 : you write it
pool PREDOM_APP_pool
modify it to
pool PREDOM_APP_pool
or take the script from here directly.
test it again please.
18-Nov-2022 10:57
Hi mohamed
It's a same problem, pool not found.
But if i use old irule, i will not found this error.
(Sorry for my english, because i speak french)
18-Nov-2022 11:02
do not worry about that,
Could you please try the LTM policy that I attached in the first reply.
18-Nov-2022 11:26
my VS is always Blue.
18-Nov-2022 11:35
Did it work with you ?
I mean it redirects you correctly and choose the pool correct or not.
Blue squire does not drop traffic it accepts it without issues such as green circle , so it should work with you.
until now , I do not know why the irule does not work with you.
18-Nov-2022 12:07
Hi mohamed
Thank you verry much for your follow-up, i'll leave the rest for Tomorrow.
18-Nov-2022 12:22
Okay , if you need any help you can mention me
20-Nov-2022 05:54
It worked, I created new pools.
Before I used pools that are created with iapp.
Thanks a lot for your help.
I have one last question, in the case of 3 pool what will become of the syntax of irule.
Thank you
20-Nov-2022 06:34
Hi @Abdou76 ,
Great News ,
what is the needed Condition for the third pool , as the selection of pool_1 and pool_2 is based on what is coming in hostname inside Http Requests , so what is the third condition that based on we select the third pool.
Or you need this Pool as a fallback or last resort or make it as a default pool requests directed to if neither pool_1 nor Pool_2 selected.
I am waithing your reply.
Regards
20-Nov-2022 06:43
Hi mohamed
I mean, what will become syntaxe of irule in this case of:
abc.com pool1
xyz.com pool2
ghi.com pool3
Regards
20-Nov-2022 07:00
@Abdou76 ,
sure you can do this ,
try this :
when HTTP_REQUEST {
if {[HTTP::host] eq "abc.com"}{
pool pool_1
} elseif {[HTTP::host] eq "xyz.com"}{
pool pool_2
} elseif {[HTTP::host] eq "ghl.com"}{
pool pool_3
}
}
Hope it works with you.
Regards
20-Nov-2022 07:06
Hi mohamedT
hank you for your great help
20-Nov-2022 07:07
@Abdou76 ,
I’m happy for you.
Most welcom brother !