BGP Lookup Tool
-
I'm looking for a command line tool to make BGP Lookups such:
https://www.dan.me.uk/bgplookup
or
http://bgp.he.net/AS3352#_prefixes
The objective is to automatically build URL tables for pfSense aliases:
Enter a single URL containing a large number of IPs and/or Subnets. After saving pfSense will download the URL and create a table file containing these addresses. This will work with large numbers of addresses (30,000+) or small numbers.
I know that that BGP lookups need to query a router BGP capable. I'm doing this operation in another webserver than pfSense.
I'm wondering if Quagga OSPF or OpenBGPD packages could help about it.
-
Would this work for you?
Its returning more than the 30 prefixes shown on the site? Maybe needs some tweaking.
**curl -s https://www.dan.me.uk/bgplookup | grep -o -P '(?<="> ).(?= <td)'< strong="">```
curl -s https://www.dan.me.uk/bgplookup | grep -o -P '(?<="> ).(?= <td)'<br>108.160.101.0/24
132.225.5.0/24
135.10.96.0/24
135.10.97.0/24
135.10.98.0/24
137.15.0.0/16
138.34.0.0/22
142.114.0.0/16
142.131.100.0/23
142.131.64.0/22
142.131.76.0/22
142.131.80.0/23
142.131.85.0/24
142.131.88.0/23
142.217.0.0/16
142.247.0.0/16
142.73.170.0/24
159.206.120.0/24
161.216.0.0/16
162.218.32.0/21
174.88.0.0/16
174.88.208.0/22
174.88.248.0/22
174.89.0.0/16
174.90.0.0/16
174.91.0.0/16
174.91.56.0/22
174.92.0.0/16
174.92.16.0/22
174.93.0.0/16
174.94.0.0/16
174.95.0.0/16
184.144.0.0/16
184.144.156.0/22
184.144.248.0/22
184.145.0.0/16
184.146.0.0/16
184.146.56.0/22
184.146.60.0/22
184.147.0.0/16
184.147.104.0/22
184.147.152.0/22
184.148.0.0/16
184.148.240.0/22
184.149.0.0/16
184.150.0.0/16
184.150.128.0/23
184.150.130.0/24
184.150.138.0/23
184.150.140.0/24
184.150.141.0/24
184.150.146.0/24
184.150.147.0/24
184.150.148.0/24
184.150.149.0/24
184.150.188.0/24
184.150.189.0/24
184.150.199.0/24
184.151.0.0/16
184.24.144.0/23
184.26.176.0/22
184.28.42.0/23
184.29.112.0/20
184.84.184.0/22
184.84.32.0/20
192.139.145.0/24
192.139.231.0/24
192.219.253.0/24
192.219.32.0/19
192.252.224.0/20
192.64.100.0/24
198.168.4.0/24
198.235.103.0/24
198.235.210.0/24
198.235.211.0/24
198.235.212.0/24
198.235.213.0/24
198.235.214.0/24
198.235.215.0/24
198.235.216.0/24
198.235.217.0/24
198.235.218.0/24
198.235.219.0/24
198.235.69.0/24
198.73.142.0/24
198.73.186.0/24
198.96.114.0/24
198.96.191.0/24
199.166.252.0/24
199.185.120.0/23
199.185.122.0/24
199.185.6.0/24
199.202.113.0/24
199.202.197.0/24
199.202.224.0/21
199.243.0.0/16
199.243.128.0/18
199.243.192.0/20
199.246.100.0/24
199.246.161.0/24
199.246.162.0/24
199.246.228.0/24
199.246.229.0/24
199.246.240.0/24
199.43.210.0/24
199.60.218.0/24
199.60.219.0/24
199.60.220.0/24
199.60.221.0/24
199.71.127.0/24
199.71.136.0/23
199.71.154.0/24
199.84.138.0/24
199.84.139.0/24
199.84.154.0/24
199.84.162.0/24
199.84.178.0/24
199.85.107.0/24
2001:4958::/32
204.101.0.0/16
204.126.156.0/24
204.138.172.0/24
204.138.232.0/24
204.187.137.0/24
204.187.67.0/24
204.19.104.0/24
204.19.134.0/24
204.225.108.0/24
204.225.109.0/24
204.225.187.0/24
204.225.191.0/24
204.225.44.0/23
204.225.6.0/24
204.225.96.0/24
205.150.54.0/24
205.151.17.0/24
205.151.18.0/24
205.151.51.0/24
205.189.92.0/24
205.205.2.0/24
205.207.216.0/24
205.207.217.0/24
205.207.219.0/24
205.207.220.0/24
205.207.221.0/24
205.207.237.0/24
205.207.238.0/24
205.210.142.0/24
205.210.158.0/23
205.210.158.0/24
205.210.159.0/24
205.211.70.0/23
205.233.152.0/24
205.233.153.0/24
205.233.4.0/24
205.233.5.0/24
205.233.6.0/24
205.233.7.0/24
205.236.129.0/24
205.236.15.0/24
206.108.104.0/23
206.108.110.0/23
206.108.96.0/20
206.130.160.0/21
206.130.168.0/22
206.130.172.0/23
206.167.50.0/24
206.172.0.0/16
206.175.155.0/24
206.47.0.0/16
206.47.0.0/24
207.164.0.0/16
207.236.0.0/16
207.34.4.0/24
207.35.0.0/16
207.61.0.0/16
208.70.215.0/24
209.139.198.0/24
209.139.211.0/24
209.226.0.0/16
209.5.242.0/24
216.168.158.0/23
216.18.70.0/24
216.208.0.0/16
216.209.0.0/16
216.228.233.0/24
23.34.192.0/21
23.34.200.0/22
23.34.204.0/23
23.34.208.0/21
23.34.216.0/22
23.34.220.0/23
23.58.112.0/21
23.58.120.0/22
23.58.124.0/23
23.58.128.0/20
23.58.144.0/22
23.58.148.0/22
23.58.160.0/21
23.58.168.0/22
23.58.172.0/23
23.58.176.0/20
23.58.84.0/23
23.58.86.0/23
50.100.0.0/16
50.101.0.0/16
64.228.0.0/16
64.229.0.0/16
64.230.219.0/24
64.230.224.0/24
64.230.230.0/23
64.231.0.0/16
65.92.0.0/16
65.93.0.0/16
65.94.0.0/16
65.94.12.0/22
65.95.0.0/16
65.95.192.0/22
66.38.128.0/24
67.68.0.0/16
67.69.0.0/16
67.69.197.0/24
67.69.212.0/23
67.69.214.0/23
67.69.216.0/23
67.69.218.0/23
67.69.220.0/24
67.69.221.0/24
67.69.222.0/24
67.69.223.0/24
67.70.0.0/16
67.71.0.0/16
69.156.0.0/16
69.157.0.0/16
69.158.0.0/16
69.158.192.0/24
69.158.196.0/24
69.159.0.0/16
70.24.0.0/16
70.24.200.0/22
70.25.0.0/16
70.26.0.0/16
70.27.0.0/16
70.27.104.0/22
70.27.180.0/22
70.28.0.0/16
70.29.0.0/16
70.30.0.0/16
70.30.164.0/22
70.30.228.0/22
70.31.0.0/16
70.48.0.0/16
70.49.0.0/16
70.49.16.0/22
70.49.188.0/22
70.49.64.0/22
70.50.0.0/16
70.50.76.0/22
70.50.8.0/22
70.51.0.0/16
70.51.184.0/22
70.52.0.0/16
70.52.56.0/22
70.53.0.0/16
70.53.20.0/22
70.53.252.0/22
70.54.0.0/16
70.55.0.0/16
74.12.0.0/16
74.12.140.0/22
74.13.0.0/16
74.14.0.0/16
74.15.0.0/16
74.15.128.0/22
74.15.144.0/22
74.15.152.0/22
76.64.0.0/16
76.65.0.0/16
76.66.0.0/16
76.67.0.0/16
76.68.0.0/16
76.69.0.0/16
76.69.164.0/22
76.69.168.0/22
76.69.240.0/22
76.70.0.0/16
76.70.52.0/22
76.71.0.0/16</td)'<br> -
@ BBcan17,
Thanks for your advice!
In fact, many BGP lookups have a lot of prefixes that included others. I don't know why. It would be better to "compress" their notation by CIDR.
Until know I did manually, but it is a lot of work, I can do mistakes and is not automatic (by scripting).
Unfortunatelly, https://www.dan.me.uk/bgplookup seems to work without parameters in the URL. I don't know how to use it in scripting.
I wrote this using http://bgp.he.net/ and it works for me:
#!/bin/sh # # Generates IPv4 prefixes for one AS (http://en.wikipedia.org/wiki/Autonomous_System_%28Internet%29) # Josep Pujadas-Jubany (15-mar-2014) # # Example for AS19679: # ./as.sh 19679 # generates as19679.txt # out=as.$$ url=http://bgp.he.net/AS$1#_prefixes echo $url fetch -o $out `echo $url` cat $out | grep '
-
W3M is another tool that can download that web page. I just tried it now and it seems to download the 30 prefixes as listed on the page.