Varnish on Linux

Dag-Erling Smørgrav des at linpro.no
Tue Aug 8 17:25:08 CEST 2006


Varnish now runs on Linux, with one known issue.  When Varnish starts,
open_tcp() tries to bind and listen to four addresses:

 - [::1]:80
 - 127.0.0.1:80
 - [::]:80
 - 0.0.0.0:80

The first two are redundant on any system; FreeBSD doesn't mind, but
Linux balks.  I don't see the point, and suggest killing off
heritage.sock_local.

Linux also balks at the last one, because apparently an IPv6 socket
gets both IPv4 and IPv6 connections in Linux, so you can't listen on
an IPv4 socket if someone is already listening on the same port on an
IPv6 socket.

The best way to do this is what I did in varnish-proto six months ago:
create only an IPv6 socket, and zero the IPV6_V6ONLY sockopt on it,
and it will get both IPv4 and IPv6 connections (as is the default on
Linux, but AFAIK not on FreeBSD).  See here for a working example:

http://varnish.projects.linpro.no/browser/trunk/varnish-proto/listener.c


DES
-- 
Dag-Erling Smørgrav
Senior Software Developer
Linpro AS - www.linpro.no



More information about the varnish-dev mailing list