#bgp #information #routes #monitoring #routing #history #protocols

app bgpexplorer

This is a BGP route explorer for routing information database with ability to drill-down routes change history

10 releases

0.3.3 Jan 17, 2023
0.3.2 Jan 17, 2023
0.3.0 Oct 8, 2022
0.2.1 Aug 1, 2021
0.1.1 May 23, 2021

#502 in Network programming

Download history 3/week @ 2024-02-16 31/week @ 2024-02-23 6/week @ 2024-03-01 2/week @ 2024-03-08 82/week @ 2024-03-29

84 downloads per month





This is a BGP route explorer for RIB (routing information database) with ability to drill-down routes change history. It can be a BGP speaker (only listener exact) or BMP monitoring station. bgpexplorer supports many NLRI types and path attribute kinds and intened to be a looking glass and "show route" replacement. It is replacement for old BGPHist (https://sourceforge.net/projects/bgphist/). bgpexplorer is much more fast, beacause it store RIBs with history in the RAM. RIB can be accessed via http protocol in JSON format. For your convinience bgpexplorer serves bundled files to provide basic web service, which can be used as backend for front web server (nginx or apache for example) with AAA. All json endpoints located under /api/ URI.

Quick start

At first you will need at least a BGP router to monitor :-). And some PC with Linux/FreeBSD (although Windows or Mac will work too, I hope).

At second you should configure your router to accept bgp connections from your PC. For example, router you have has IP, AS 65535. PC with bgpexplorer has IP In Cisco dialect it will be something like:

router bgp 65535
 ! create a neighbor with your own AS, so it will be IBGP
 neighbor remote-as 65535
 ! specify source IP
 neighbor update-source Loopback0
 ! do not attempt to connect from router to PC, only from PC to router
 neighbor transport connection-mode passive
 address-family ipv4
 ! it has ipv4 unicast address family
  neighbor activate
 ! send all routing information to PC
  neighbor route-reflector-client
 ! activate ipv4 labeled-unicast address family
  neighbor send-label
 address-family vpnv4
 ! activate vpnv4 unicast address family
  neighbor activate
  neighbor send-community extended

Now on PC with Linux or FreeBSD:

$ git clone https://github.com/wladwm/bgpexplorer
... git messages
$ cd bgpexplorer
$ cargo build
... cargo messages
$ cat > bgpexplorer.ini <<EOF


$ cargo run

After this you should see something like:

Listening on
BGP trying
Connected to

After this you can open your favorite browser and point to - you should see bgpexplorer basic interface.

For example view for ipv4 unicast: alt text

Or vpnv4 unicast: alt text


bgpexplorer looks for configuration in file bgpexplorer.ini in current directory. This file should have [main] section and peer sections with any other names Main section parameters:

  • httplisten - bind address and port for inner http server, default
  • httproot - path for http server files serving root, default "./contrib/".
  • whoisjsonconfig - json config for whois service, default is whois.json.
  • whoisdb - path to store whois cache db, whoiscache.db by default.
  • historydepth - how many history records should be kept for each route. 10 by default.
  • historymode - differ/every. differ - record history event only if some attributes changed. every - anyway record history event.
  • purge_after_withdraws - garbage collect after specified number of withdraws. 0 - turned off, this setting is by default.
  • purge_every - garbage collect every N seconds. Default setting is 5 minutes.

Service section parameters:

  • mode - protocol mode, can be bgpactive,bgppassive,bmpactive or bmppassive. bgp or bmp means protocol, active or passive determines which side will initiate session.
  • bgppeer - bgp peer address for bgp active mode. Can be just IP address or IP:port. bgpexplorer will attempt to connect to specified BGP speaker.
  • bmppeer - bmp peer address for bgp active mode. Can be IP:port or just IP address - then default port 632 will be used. bgpexplorer will attempt to connect to specified BMP-capable router.
  • protolisten - TCP endpoint for bgp/bmp passived mode. Should be IP:port form. Please note that you will not be able to run process listening port number below 1024 in *nix OS if you are not root without special tricks.
  • routerid - BGP router ID, if not specified, default value will be used.
  • peeras - BGP AS number for bgpactive.
  • filter_rd - With BMP session this parametr will filter watching BGP session matching this RD. Default is 0:0 (global vrf).

BTW, builtin whois proxy allows you to see some info about AS and hosts: alt text

API endpoints

  • /api/statistics
    • Parameters: None
    • Returns: RIB statistics object Example: { // attributes stores usage "stores":{"clusters":0,"pathes":20,"comms":7,"attrs":25,"lcomms":1,"extcomms":1}, // routes count for each RIB "ribs":{"ipv4m":0,"fs4u":0,"l2vpls":0,"vpnv4u":0,"ipv4u":70,"vpnv4m":0,"mvpn":0,"ipv6u":0,"vpnv6m":0,"ipv6lu":0,"vpnv6u":0,"ipv4lu":0,"evpn":0}, // counters for updates/withdraws "counters":{"updates":70,"withdraws":0} }
  • /api/json/?...
    • RIB - ipv4u, ipv4m ... URL parameters:
    • limit - maximum items count in response
    • skip - how many items to skip for paging
    • filter - textual filter
  • /api/whois/?query= Whois public service query
    • ObjectType - object type to query from public whois:
    • as - Autonomous system number
    • route - route object
    • route6 - route6 object
  • /api/dns/ Reverse DNS lookup






MIT OR Apache-2.0


~447K SLoC