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
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 :
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
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.
Hi @CA_Valli ,
I am grateful for your advise ,
I do add this in my Notes , when implementing iRules.
Thanks alot
<span>Thanks you for feedback, but thé availability of m'y VS still unknown (blue color) </span>
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
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.
The VS works fine if i remove the irule and make the default pool to pool1 or pool2.
Thank you.
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 ?
No it doesn’t mork, the VS still blue.
@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
I have 2 pool; membre of pool1 is 10.10.10.10. membre of pool2 is 10.10.10.11.
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
Ok Mohamed
I will test with a new irule, and i will inform you.
Thank you.
yes do that , I am waiting .
most welcome @Abdou76 🙂
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.
I did exactly your recommendation copy and past !!
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.