Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Does someone know how to setup Source hashing with regex?

What I want is the follwing: I have 3 ubuntu servers. 1 Loadbalancer, the second is transparent and the third has a caching mechanism (Apache TrafficServer). The second and third are connected to a webserver and the loadbalancer is the first hop for a connection.

When someone has a IP-address with a even last number, we will be send to the second server that will serve the webpage. When someone has a IP-address with a uneven number, will be send to the first server server that will send cache to the user.

The main reason is that I can proof that the one with a caching-mechanism is faster. A client wants to see that... It's kind of a A-B testing.

I do have to use SOURCE HASHING, which is supported by IPVSADM, but I cannot find a way to use some kind of regex so I can configure that the even IP-addresses will go to the first server, and people with an uneven number, they will go to the second server....

Does someone have an idea to create this? It's no problem to build a script. The only thing is how I use that in IPVSADM.

Hope that someone has an idea....

share|improve this question
Actually the regex for odd numbers is "^\d*[13579]$", for even numbers: "^\d*[02468]$". I hope that it will be a start. –  Frantique Nov 23 '12 at 16:38
Thanks, but actually I already figure that out. but I need to know how I can use that because a hash-table in IPVSADM should be static, but I use a variable. –  Dave Greebe Nov 23 '12 at 17:13
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.