Re: [mirrorbrain] IPv6

From: Peter Pml <>
Date: Mon, 19 Mar 2012 23:38:20 +0100
Hi Tom,

Am 19.03.2012 um 21:54 schrieb Tom Albers:
> Currently KDE is investigating the possibility to switch over to MirrorBrain. We have setup a MB instance and we have a couple of questions. I hope it is ok to aggregate some in one mail.


> IPv6.
> I've got some mirrors only accessible via ipv6. Or some mirrors only have rsync and ftp available via IPv6. As the host is also IPv6 capable, indexing will be fine. But the IPv6 mirrors should only be offered to clients that have IPv6 available. Is there any solution for this planned or available?

There can be the following situations when the MirrorBrain server receives a request: 

If the server itself is IPv4-only, it will get all requests from IPv4 addresses, and it won't have any notion whether a client has also IPv6 network. Thus, there is no conceivable way how the server could decide whether an IPv6-only mirror could be usable.

I'm tempted to say: IPv6-only mirrors suck ;)

If however the server has both IPv4 and IPv6 connectivity, a request could come in from an IPv4 address or from an IPv6 address. The server will see the address (unless it is behind some kind of load balancer or so). Unfortunately, in this regard I have to say that MB sucks: it has no notion of IPv6 addresses. Okay, since it uses mod_geoip to resolve addresses to countries, I suppose that the basic function should work as with IPv4 (I haven't tested it, because I sadly lack IPv6 connectivity). I am assuming that mod_geoip is able to do lookups of IPv6 addresses, because I have seen a GeoIPv6 database floating around from MaxMind. (Actually, I see that MB's little geoip-lite-update tool will update also the IPv6 database.) But I have not used mod_geoip with multiple database files.

Searching the web, I find;topic=50.0
which first links patches for mod_geoip to support IPv6, and later mentions that a newer version (1.2.7) supports IPv6 out of the box. I have used 1.2.5 so far, so I'd need to do further checking here.

So, the bread-and-butter functionality of MB, redirecting to mirrors per country, might work already for IPv6 clients. The more sophisticated features like selection of a mirror by autonomous system or network prefix wouldn't. Regarding the former (AS-based redirection) I can only say that IPv6 ASs are not abundant yet so it's not worth the effort (the chance is probably small that a client and a mirror fall into the same AS). (The IPv4 AS selection algorithm is based on an IPv4-only solution that can not easily be ported to IPv6 addresses.) Regarding the latter (network-prefix based redirection): is probably easy to implement for IPv6 (Apache has all that's needed on board). 

Remains the question whether MB can usefully redirect to IPv6-only mirrors. MB can trivially be enhanced to know whether a client has an IPv6 or IPv4 address. But then the respective IPv6-only mirrors would need to be marked in the database for being IPv6 only, so they will be handed out exclusively to IPv6 clients. Well, I'm not sure if this is worth the effort. It might be, but it'd be an ugly kludge, wouldn't it?

Here's a potential workaround. I wonder if you could use special countries for the IPv6-only mirrors. For those in Germany, you could use "d6" instead of "de" (in the country field when editing with 'mb edit'). At the same time, you should mark the mirror with the "country_only" flag (then it won't be used for clients with country != d6). Next, you need to make MB believe that IPv6 clients come from a country named "d6", which might be possible like this:]

SetEnvIf Remote_Addr : GEOIP_COUNTRY_CODE=d6

(Match for ':' to recognize IPv6 addresses. See related recipe here: )

Unfortunately, I can't say whether the setenvif hook runs late enough - after mod_geoip has done it's work. So this might not work. Also, you will have a random mirror selection for IPv6 clients, which is not optimal.

I'm very curious now. Do you have IPv6? :-)
mirrorbrain mailing list

Note: To remove yourself from this mailing list, send a mail with the content
to the address
Received on Mon Mar 19 2012 - 22:38:29 GMT

This archive was generated by hypermail 2.3.0 : Mon Mar 19 2012 - 23:17:02 GMT