Automated ways of querying us


Overview

bgp.tools attempts to ensure that data is as up to date as possible, this means that the website has to be designed in a special way that makes page generation rather expensive server side.

If at all possible, we perfer that robots do not crawl the website. To help on this request there are alternatives to using the website.

whois

bgp.tools also listens on whois, giving basic info on who owns what IP address. For the most part is this all most people need.

Assuming you are on a bash shell, you can easily add this as a macro on the cli by adding this to the .bashrc of your user:

function cwhois { whois -h bgp.tools " -v $*"; }
export -f cwhois

You can use this to query ASNs and IP addresses:

$ cwhois as206924
AS      | IP     | BGP Prefix| CC | Registry | Allocated  | AS Name
206924  |        |           | GB | RIPE     | 2017-04-11 | Ben Cartwright-Cox

whois bulkmode

Sometimes you need to lookup a large list at once. To add on to the whois interface, is a bulk interface.

You can activate the bulk mode by connecting to bgp.tools on TCP port 43, and starting the first message with “begin”

After that you can feed items into the engine, and then finish with “end”. The whois interface will spit out all of the prefixes + asn’s at once for you to check over, This is useful for scripts that output large amounts of IP addresses.

Example:

# cat test
begin
as206924
as174
1.1.1.1
2a00::
end

# cat test | nc bgp.tools 43
206924  |        |           | GB | RIPE     | 2017-04-11 | Ben Cartwright-Cox
174     |        |           | US | ARIN     | 1996-05-15 | Cogent Communications
13335   | 1.1.1.1| 1.1.1.0/24| US | ARIN     | 2010-07-14 | Cloudflare, Inc.
3209    | 2a00:: | 2a00::/22 | DE | RIPE     | 2002-09-11 | Vodafone GmbH

Last updated: August 10th, 2019