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

Multiple server with one VS

Abdou76
Cirrus
Cirrus

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

 

 

2 ACCEPTED SOLUTIONS

@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 

_______________________
Regards
Mohamed Kansoh

View solution in original post

Hi mohamedT

hank you for your great help

 

View solution in original post

31 REPLIES 31

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 : 
rule1.PNGRule2.PNG

Do not Forget to Publish your Policy to be able to assign it in virtual servers , find below : 
publish.PNG

> 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

_______________________
Regards
Mohamed Kansoh

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

_______________________
Regards
Mohamed Kansoh

Abdou76
Cirrus
Cirrus
Thanks you for feedback, but thé availability of m'y VS still unknown (blue color) 

 

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

_______________________
Regards
Mohamed Kansoh

Hi Mohamed

Bellow are my captures : 

Capture1.JPGCapture2.JPGCapture3.JPGCapture4.JPG

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. 

_______________________
Regards
Mohamed Kansoh

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 ? 

_______________________
Regards
Mohamed Kansoh

No it doesn't mork, the VS still blue.

@Abdou76 , 
Okay , 
this iRule is wrong : 
Capture2.JPG

 

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

_______________________
Regards
Mohamed Kansoh

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

_______________________
Regards
Mohamed Kansoh

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 🙂

_______________________
Regards
Mohamed Kansoh

Hi Mohamed

error when i assigne irule to VS.

CaptureF5Dev2.JPGCaptureF5Dev.JPG

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.

_______________________
Regards
Mohamed Kansoh

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. 

_______________________
Regards
Mohamed Kansoh

 

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)

 

do not worry about that, 
Could you please try the LTM policy that I attached in the first reply. 

_______________________
Regards
Mohamed Kansoh

 

CaptureF5Dev3.JPGCaptureF5Dev4.JPGCaptureF5Dev5.JPGmy VS is always Blue.

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. 

_______________________
Regards
Mohamed Kansoh

Hi mohamed 

Thank you verry much for your follow-up, i'll leave the rest for Tomorrow.

Okay , if you need any help you can mention me 

_______________________
Regards
Mohamed Kansoh

Hi @Mohamed_Ahmed_Kansoh

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

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 

_______________________
Regards
Mohamed Kansoh

Hi mohamed

I mean, what will become syntaxe of irule in this case of:

abc.com pool1

xyz.com pool2

ghi.com pool3

Regards

 

 

 

 

@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 

_______________________
Regards
Mohamed Kansoh

Hi mohamedT

hank you for your great help

 

@Abdou76 , 
I’m happy for you. 
Most welcom brother ! 

_______________________
Regards
Mohamed Kansoh