Varnish and multiple interfaces

Poul-Henning Kamp phk at
Tue Oct 4 07:29:47 CEST 2011

In message <186FEE23-3C2E-4752-A97E-E06306D96D2C at>, "Henr
y M. Umansky" writes:

>According to tcpdump, traffic from varnish is coming from eth0
>(incorrect IP) and traffic coming from nginx is coming from eth0:0
>(correct IP). Apache logs are also confirming the IP information.

This is a theoretical point I have had in my "notes" file for some
time, you are the first person to raise it in reality.

We don't bind(2) backend connections to any specific IP# in Varnish,
but let the kernel pick whatever it finds most convenient at connect(2)

The kernels I'm aware of will pick the interface IP# which has the
"best route" to the destination, which in your case is eth0 instead
of eth0.0.

The main we have not added a facility to bind backend connections
to a particular IP# is that it is a recipe for reachability problems
and kind of hard to imagine a legit case for wanting to do it in
the first place, so can I get you to describe (possibly in private
email) why you need to do this ?

Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.

More information about the varnish-misc mailing list