# Ip\_hash load balancer incompatible with IPv6 compat. sockets

**URL:** <https://www.ruby-forum.com/t/ip-hash-load-balancer-incompatible-with-ipv6-compat-sockets/216269>\
**Category:** NGINX\
**Created:** [January 31, 2012, 1:47pm UTC](https://www.ruby-forum.com/t/ip-hash-load-balancer-incompatible-with-ipv6-compat-sockets/216269 "2012-01-31T13:47:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [January 31, 2012, 1:47pm UTC](https://www.ruby-forum.com/t/ip-hash-load-balancer-incompatible-with-ipv6-compat-sockets/216269/1 "2012-01-31T13:47:31Z")

</div>

I’m using nginx to distribute the load over 3 webservers using the  
ip\_hash method.  
When the listening socket is IPv4/IPv6 compatible ( listen [::]:443; )  
only one of the backend servers are used.  
With the socket in IPv4 only mode ( listen 0.0.0.0:443; ) the module  
correctly distributes the load.  
It seems the hash isn’t taking in account the size of the addresses and  
because the first 32bits of the struct in this mode doesn’t seem to vary  
much the load balacing isn’t working.

Keep up with the good work with this excelent proxy!  
Regards.

Posted at Nginx Forum:

> **[ip\_hash load balancer incompatible with IPv6 compat. sockets](https://forum.nginx.org/read.php?2,221827,221827#msg-221827)**
>
> I'm using nginx to distribute the load over 3 webservers using the ip\_hash method. When the listening socket is IPv4/IPv6 compatible ( listen \[::\]:443; ) only one of the backend servers are used. With the socket in IPv4 only mode ( listen...

---

<div class="post-metadata">

**Author:** ![pamribeirox](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/cc9497/32.png) [@pamribeirox](https://www.ruby-forum.com/u/pamribeirox)\
**Post date:** [January 31, 2012, 4:19pm UTC](https://www.ruby-forum.com/t/ip-hash-load-balancer-incompatible-with-ipv6-compat-sockets/216269/2 "2012-01-31T16:19:50Z")

</div>

Hello!

On Tue, Jan 31, 2012 at 07:46:46AM -0500, pamribeirox wrote:

> I’m using nginx to distribute the load over 3 webservers using the  
> ip\_hash method.  
> When the listening socket is IPv4/IPv6 compatible ( listen [::]:443; )  
> only one of the backend servers are used.  
> With the socket in IPv4 only mode ( listen 0.0.0.0:443; ) the module  
> correctly distributes the load.  
> It seems the hash isn’t taking in account the size of the addresses and  
> because the first 32bits of the struct in this mode doesn’t seem to vary  
> much the load balacing isn’t working.

Yes, ip\_hash only works with ipv4 addresses, it’s not currently  
able to handle ipv6 addresses (including v4-mapped ones).

Maxim D.
