Skip to content
An Apache module to anonymize IP addresses
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


A simple Apache2 module to anonymize the IP address of any request by a specific number of bytes.

The original version of mod_anonip is based on mod_removeip, but mod_anonip just anonymizes the IP-address by removing a specified number of bytes instead of removing the IP-address completely. This - unlike mod_removeip - allows you to preserve the privacy of your visitors, while still being able to log the origin country of a request or to serve website content based on GeoIP.


First you have to clone the repository and compile the module:

$ git clone
$ cd mod_anonip/module
$ make anonip

You might have to install some kind of Apache development package (libapache2-prefork-dev or apache2-threaded-dev on Ubuntu) to have all tools required for compilation.

After the compilation has finished, you can install and activate the module:

# make install
# cd ../conf
# cp * /etc/apache2/mods-available/
# a2enmod anonip

After enabling the module you have to restart Apache (service apache2 restart on Ubuntu).


The module comes with one configuration option, which defines how many bytes should be masked:

AnonipMask = 2

The default value is 0, so mod_anonip will do nothing if no configuration exists. The configuration files shipped with the module set AnonipMask = 2. Values between 0 and 4 are valid with the following results:

AnonipMask    Anonymized address

As long, as you mask at least 2 bytes of the IP address, your website will be in accordance with the privacy recommendations of the Independent Centre for Privacy Protection in Germany (ULD).

You can’t perform that action at this time.