Forum Discussion
client connections share load 50:50 to two websites.
i want irule for load balancing two websites I have created three VS , one for http://abc1.com and second for http://abc2.com and third one for http://abc.com the user access only the URL http://abc.com but the first user have to get http://abc1.com and second user access http://abc.com it must to be http://abc2.com ; So load should share to two websites 50:50
- nitass_89166
Noctilucent
if you want to share information among connections, you may consider using "table" command.
The table Command: Basics by spark
https://devcentral.f5.com/articles/v101-the-table-command-the-basicsanother tricky way is to use global static variable since each tmm has its own value.
my big-ip has 2 tmm. "bar" is front-end virtual server. "one" and "two" are back-end virtual servers. users always connect to "bar" virtual server.
// config root@(ve13a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm virtual ltm virtual bar { destination 172.28.24.10:80 ip-protocol tcp mask 255.255.255.255 profiles { http { } tcp { } } rules { qux } source 0.0.0.0/0 translate-address enabled translate-port enabled vs-index 10 } ltm virtual one { destination 0.0.0.0:80 ip-protocol tcp mask any profiles { http { } tcp { } } rules { three } source 0.0.0.0/0 translate-address disabled translate-port disabled vlans-enabled vs-index 8 } ltm virtual two { destination 0.0.0.0:8080 ip-protocol tcp mask any profiles { http { } tcp { } } rules { three } source 0.0.0.0/0 translate-address disabled translate-port enabled vlans-enabled vs-index 9 } root@(ve13a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm rule qux ltm rule qux { when RULE_INIT { set static::rr 0 } when HTTP_REQUEST { if { $static::rr } { set dest "one" } else { set dest "two" } log local0. "s[TMM::cmp_group]/tmm[TMM::cmp_unit]\ client=[IP::client_addr]:[TCP::client_port]\ destination=$dest\ rr=$static::rr" set static::rr [expr {($static::rr + 1) % 2}] virtual $dest } } // test ab -n 10 http://172.28.24.10/ // log [root@ve13a:Active:In Sync] config grep tmm0 /var/log/ltm Dec 31 11:53:38 ve13a info tmm[17969]: Rule /Common/qux : s0/tmm0 client=172.28.72.16:34772 destination=one rr=1 Dec 31 11:53:38 ve13a info tmm[17969]: Rule /Common/qux : s0/tmm0 client=172.28.72.16:34774 destination=two rr=0 Dec 31 11:53:38 ve13a info tmm[17969]: Rule /Common/qux : s0/tmm0 client=172.28.72.16:34776 destination=one rr=1 Dec 31 11:53:38 ve13a info tmm[17969]: Rule /Common/qux : s0/tmm0 client=172.28.72.16:34778 destination=two rr=0 Dec 31 11:53:38 ve13a info tmm[17969]: Rule /Common/qux : s0/tmm0 client=172.28.72.16:34781 destination=one rr=1 [root@ve13a:Active:In Sync] config grep tmm1 /var/log/ltm Dec 31 11:53:38 ve13a info tmm1[17969]: Rule /Common/qux : s0/tmm1 client=172.28.72.16:34773 destination=one rr=1 Dec 31 11:53:38 ve13a info tmm1[17969]: Rule /Common/qux : s0/tmm1 client=172.28.72.16:34775 destination=two rr=0 Dec 31 11:53:38 ve13a info tmm1[17969]: Rule /Common/qux : s0/tmm1 client=172.28.72.16:34777 destination=one rr=1 Dec 31 11:53:38 ve13a info tmm1[17969]: Rule /Common/qux : s0/tmm1 client=172.28.72.16:34779 destination=two rr=0 Dec 31 11:53:38 ve13a info tmm1[17969]: Rule /Common/qux : s0/tmm1 client=172.28.72.16:34780 destination=one rr=1
- lakshmianrayana
Altostratus
Thanks for your update, how i call URL(http://abc1.com) instead of VS
- nitass_89166
Noctilucent
you can send http redirection instead of calling virtual.
HTTP::redirect
- nitass
Employee
if you want to share information among connections, you may consider using "table" command.
The table Command: Basics by spark
https://devcentral.f5.com/articles/v101-the-table-command-the-basicsanother tricky way is to use global static variable since each tmm has its own value.
my big-ip has 2 tmm. "bar" is front-end virtual server. "one" and "two" are back-end virtual servers. users always connect to "bar" virtual server.
// config root@(ve13a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm virtual ltm virtual bar { destination 172.28.24.10:80 ip-protocol tcp mask 255.255.255.255 profiles { http { } tcp { } } rules { qux } source 0.0.0.0/0 translate-address enabled translate-port enabled vs-index 10 } ltm virtual one { destination 0.0.0.0:80 ip-protocol tcp mask any profiles { http { } tcp { } } rules { three } source 0.0.0.0/0 translate-address disabled translate-port disabled vlans-enabled vs-index 8 } ltm virtual two { destination 0.0.0.0:8080 ip-protocol tcp mask any profiles { http { } tcp { } } rules { three } source 0.0.0.0/0 translate-address disabled translate-port enabled vlans-enabled vs-index 9 } root@(ve13a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm rule qux ltm rule qux { when RULE_INIT { set static::rr 0 } when HTTP_REQUEST { if { $static::rr } { set dest "one" } else { set dest "two" } log local0. "s[TMM::cmp_group]/tmm[TMM::cmp_unit]\ client=[IP::client_addr]:[TCP::client_port]\ destination=$dest\ rr=$static::rr" set static::rr [expr {($static::rr + 1) % 2}] virtual $dest } } // test ab -n 10 http://172.28.24.10/ // log [root@ve13a:Active:In Sync] config grep tmm0 /var/log/ltm Dec 31 11:53:38 ve13a info tmm[17969]: Rule /Common/qux : s0/tmm0 client=172.28.72.16:34772 destination=one rr=1 Dec 31 11:53:38 ve13a info tmm[17969]: Rule /Common/qux : s0/tmm0 client=172.28.72.16:34774 destination=two rr=0 Dec 31 11:53:38 ve13a info tmm[17969]: Rule /Common/qux : s0/tmm0 client=172.28.72.16:34776 destination=one rr=1 Dec 31 11:53:38 ve13a info tmm[17969]: Rule /Common/qux : s0/tmm0 client=172.28.72.16:34778 destination=two rr=0 Dec 31 11:53:38 ve13a info tmm[17969]: Rule /Common/qux : s0/tmm0 client=172.28.72.16:34781 destination=one rr=1 [root@ve13a:Active:In Sync] config grep tmm1 /var/log/ltm Dec 31 11:53:38 ve13a info tmm1[17969]: Rule /Common/qux : s0/tmm1 client=172.28.72.16:34773 destination=one rr=1 Dec 31 11:53:38 ve13a info tmm1[17969]: Rule /Common/qux : s0/tmm1 client=172.28.72.16:34775 destination=two rr=0 Dec 31 11:53:38 ve13a info tmm1[17969]: Rule /Common/qux : s0/tmm1 client=172.28.72.16:34777 destination=one rr=1 Dec 31 11:53:38 ve13a info tmm1[17969]: Rule /Common/qux : s0/tmm1 client=172.28.72.16:34779 destination=two rr=0 Dec 31 11:53:38 ve13a info tmm1[17969]: Rule /Common/qux : s0/tmm1 client=172.28.72.16:34780 destination=one rr=1
- lakshmianrayana
Altostratus
Thanks for your update, how i call URL(http://abc1.com) instead of VS
- nitass
Employee
you can send http redirection instead of calling virtual.
HTTP::redirect
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com