Projects / mod_asn


mod_asn is an Apache module that uses BGP routing data to look up the autonomous system (AS) and the network prefix (subnet) which contains a given (client's) IP address. mod_asn is highly scalable. To do lookups in high-speed, it uses the PostgreSQL ip4r datatype, which is indexable with a Patricia Trie algorithm to store network prefixes. This is the most suitable algorithm, being able to search through around 250,000 existing prefixes quickly. mod_asn is usable as a standalone module, and the lookup result can be used by scripts or other Apache modules. For instance, a download redirector could base its decisions on the lookup result provided by mod_asn.

Operating Systems

Recent releases

  •  07 Jan 2014 21:35

    Release Notes: mod_asn is now compatible with the API changes in Apache 2.4. A bug in the asn_get_routeviews script has been fixed (it could fail when the BGP routing data snapshot contained bogus AS numbers). The asn_get_routeviews script now allows downloading routing data only (without processing it), by using the switch --download-only. Also, --no-download can be used if the data is distributed by other means (e.g., with distribution updates).

    •  05 Sep 2010 19:50

      Release Notes: An important bugfix regarding IPv6 connectivity. Lookups of IPv6 addresses could cause database server crashes. These lookups are now avoided. Furthermore, the compile-time check for the APR/APR-Util library version is now a runtime check.

      •  27 Mar 2010 01:04

        Release Notes: This release does not bring about significant user-visible changes, but under the hood, some optimizations were made. Database connections are now freed right after mod_asn's handler quits.

        •  30 Jul 2009 03:40

          Release Notes: Bugs in the asn_get_routeviews and asn_import scripts were fixed: the logic which decided whether to download the routing data snapshot file was fixed. Deletion of existing entries in the database is now prevented, if not at least one entry has been imported. This fixes a bug where the routing data would be deleted if the script was called with no input.

          •  28 Jul 2009 13:56

            Release Notes: The main changes are major documentation updates, and the fact that routing data snapshots are now downloaded from a mirror provided by


            Project Spotlight


            A Fluent OpenStack client API for Java.


            Project Spotlight

            TurnKey TWiki Appliance

            A TWiki appliance that is easy to use and lightweight.