Geoip filtering for IPv6


I was able to setup up geofiltering using the tool and info from here

Might be other ways of doing it, but that was what I was able to find.

But that only covers IPv4 and I need IPv6 filtering also, since now all IPv6 traffic is blocked.

Is there a similar tool to the iprange that can create lists for v6 also? Or must I write my own?

Any hints on where to look is greatly appreciated

Btw using Haproxy 1.7 on Debian 8.10.


Ended up with having an intern write up a python script to create the files we needed.
The script works, but YMMV.

#This only works with Python 3, due to the reliance on ipaddress module

import csv
import ipaddress

with open('geoipv6.csv') as csvfile:
    filereader = csv.reader(csvfile, delimiter = ',')

    for row in filereader:
       start = str(row[0])
       end = str(row[1])
       end = end[2:-1]
       ipaddr2 = [ipaddr for ipaddr in ipaddress.summarize_address_range(ipaddress.IPv6Address(start), ipaddress.IPv6Address(end))]
       printRow = row[2][2:-1]
       print(ipaddr2[0], printRow)