skip to navigation
skip to content

Not Logged In

ipasn-redis 1.0

API to access an IP-ASN-history instance via Redis.


IP-ASN-history is a server software to store efficiently the history
of BGP announces and quickly lookup IP addresses origins. The server
is supporting bgpdump format for importing BGP announces (e.g. from RIPE RIS dump
or your own openbgpd dump file).

1. Prerequired

You will need this:

* Redis server with unix socket enabled
* Binaries:
- get the latest bgpdump from
- build it and copy bgpdump in server/bin/
* Python libraries:
- redis-py:
- dateutil:
- IPy:
- pubsublogger:
- logbook: (only if you want to log)

2. Populate the database

You can import all the dumps in bgpdump format but the original is not saved in
the database. The best way to import announcement of different sources is to use
different redis databases.

cd server
./ -f YYYY-MM-DD # date of the oldest file to download

Note: and are services, do not start them in a cron.

Optional: Run ./ if you want to log the import process.

The log files are located in the server/logs/ directory.

3. Query the database

Client software is located in the directory client.

Change the IP and the port in ip_asn_history/ if necessary.

You can query any IP addresses to get the full history:

cd client
python ip2asn_fullhistory -i
20121104 15169
20121103 15169
20121102 15169
20121101 15169

To install the library system-wide:

cd client
python install

Note: By default, if the IP is invalid, it is simply skipped. If you want
to see the exceptions, enable the debug flag (-d) or set the variable
"skip_exception" to False in the API.

Using only one TCP session while going through multiple SSH tunnels

Use case:
* redis client_s_ ---> entry point ---> destination ---> redis server
<----------------- SSH -------------->
* Multiple TCP sessions
* Very slow

Server side:
socat tcp4-listen:6380,reuseaddr,fork TCP:localhost:6379

Client side:
ssh <dest> -L 6381:<dest>:6380
socat tcp4-listen:6382,reuseaddr,fork TCP:localhost:6381

This way, we have only one single TCP session between the two hosts.


IP-ASN-history is licensed under the GNU Affero License version 3 or upper.
File Type Py Version Uploaded on Size
ipasn-redis-1.0.tar.gz (md5) Source 2014-01-16 4KB
  • Downloads (All Versions):
  • 2 downloads in the last day
  • 14 downloads in the last week
  • 32 downloads in the last month