ip_hash clarification

Ryan Malayter malayter at gmail.com
Thu Feb 25 21:57:28 MSK 2010

On Thu, Feb 25, 2010 at 11:40 AM, J M <jerome.m at gmail.com> wrote:
> Hi,
>    i need details regarding ip_hash...
>   if i have client IP1: and client IP2:
> and I have 2 servers on the upstream.. s1 and s1.. with IP_Hash configured
> if client IP1 accesses the site it will go to lets say S1 would it actually
> mean that the next request coming from a new client IP Client2.. will it go
> to s2?

I believe ip_hash uses only the "Class C" part of the address. This is
so people with firewalls that have them "hop" IP addressess still get
directed to the same back-end. So since both clients are coming from
192.168.1.XXX, nginx will direct them to the same back-end server.

I was actually considering a patch to make this configurable a few
moths ago, but we decided to go with session replication on our
back-ends instead, so I stopped looking into it.

For testing, you could put a client on 192.168.2.XXX to see the
desired behavior.


More information about the nginx mailing list