|Allen Zhong d33a24a164 fix ASN including||8 months ago|
|.gitignore||3 years ago|
|LICENSE||2 years ago|
|README.md||2 years ago|
|gen-routing-table.py||8 months ago|
This is a simple script that can generate static routing table config file in
bird format from the global BGP dump.
The propose of this script is to detect and save certain networks (IP blocks) to a special routing table for futher actions. I'm using it to hijack some specific networks to a encrypted tunnel on my gateway, to bypass a firewall on the default route.
Download data files to local.
mkdir -p data wget -O data/delegated-apnic-latest https://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest wget -O geoip.zip https://geolite.maxmind.com/download/geoip/database/GeoLite2-ASN-CSV.zip wget -O data/oix-full-snapshot-latest.dat.bz2 http://archive.routeviews.org/oix-route-views/oix-full-snapshot-latest.dat.bz2 cd data bzip2 -d oix-full-snapshot-latest.dat.bz2 unzip geoip.zip mv GeoLite2-ASN-CSV_*/GeoLite2-ASN-Blocks-IPv4.csv geoip.csv
Then run the script to generate config file, there're some arguments that controls the filters of ASes, see
-h for details.
--exclude arguments can be used multiple times, to pass more than one values. The
--exclude argument only accept two-letter country code.
Argument values are case insensitive, except
It's possible to write a wrap script to automate the update process.
This script is written for private usage, and absolutely no garentee is provided. The code and its features may be updated or changed without any notice, or may not be having any future update at all.
The project is licensed under GLWTPL and wish you a good luck.