/bgpview.sh

View global BGP information in bash

Primary LanguageShell

bgpview.sh

View global BGP information in bash

Leverage bgpview.io in the CLI via API to view BGP information

Requirements

  • A UNIX environment (e.g. Linux, BSD, MacOS, or Windows Subsystem for Linux)

  • bash

  • jq

  • curl

  • sed

  • awk

Network Requirements

  • dns & internet connectivity (https tcp/443)

Installation

 sudo curl https://raw.githubusercontent.com/fsecuritynz/bgpview.sh/main/bgpview.sh >> /usr/bin/bgpview.sh
 sudo chmod +x /usr/bin/bgpview.sh

Operation

Help Dialogue

bgpview.sh -h

Show downstream peers

bgpview.sh -d $asn

Show upstream peers

bgpview.sh -u $asn

Show IP info

bgpview.sh -i $ip-address

Show my ip info

bgpview.sh -m

Show prefixes in an ASN

bgpview.sh -p $asn

Example

➜  ~ ./bgpview.sh -u 32787 

######################################
Reference ASN: 32787

Upstream, ASN
TWELVE99,1299
AS6453,6453
CW,1273
NTT-LTD-2914,2914
ZAYO-6461,6461
IIJ,2497
VOCUS-BACKBONE-AS,4826
INTERNEXA,BRASIL
ASN-TELSTRA-GLOBAL,4637
LEVEL3,3356
ALGAR,TELECOM
######################################


➜  ~ ./bgpview.sh -p 32787

######################################
Reference ASN: 32787

Prefix
2.17.192.0/24
2.17.192.0/22
2.17.193.0/24
2.17.194.0/24
2.17.195.0/24
...


➜  ~ ./bgpview.sh -d 32787

######################################
Reference ASN: 32787

Downstream, ASN
FITC-AS,7726
THE-BANK-OF-NEW-YORK-MELLON-CORPORATION-AS11911,11911
THE-BANK-OF-NEW-YORK-MELLON-CORPORATION-AS22260,22260
HUM-19510,19510
...