IPv4 NameVirtualHost, IPv6 VirtualHost

apache-2.2ipv4ipv6

Like many of us, I have an apache server (2.2.15, plus patches) with a lot of virtual hosts on it. More than I have IPv4 addresses, to be sure, which is why I use NameVirtualHost to run lots of them on the same IPv4 address.

I'm busily trying to get everything I do IPv6-enabled. This server now has a routed /64, which gives me an awful lot of v6 addresses to throw around. What I'm trying to find is a simple way to tell each v4-NameVirtualHost that it should also function as a VirtualHost on a unique ipv6 address. I really, really don't want to have to define each virtual host twice.

Does anyone know of an elegant way to do this? Or to do something comparable, in case I've embedded any dangerously-ignorant assumptions in my question?

Best Answer

I think something like this will work (disclaimer: this is from the top of my head, I haven't tested this yet):

NameVirtualHost 10.0.0.1:80

<VirtualHost 10.0.0.1:80 [2001:db8::1]:80>
   ServerName blabla
   ...
</VirtualHost>

<VirtualHost 10.0.0.1:80 [2001:db8::2]:80>
   ServerName blabla2
   ...
</VirtualHost>

etc...