BGP Lookup Tool

  • I'm looking for a command line tool to make BGP Lookups such:


    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.

  • Moderator

    Would this work for you?

    Its returning more than the 30 prefixes shown on the site? Maybe needs some tweaking.

    **curl -s | grep  -o -P '(?<=">   ).(?=  <td)'< strong="">```
    curl -s | grep  -o -P '(?<=">   ).
    (?=  <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, seems to work without parameters in the URL. I don't know how to use it in scripting.

    I wrote this using and it works for me:

    # Generates IPv4 prefixes for one AS (
    # Josep Pujadas-Jubany (15-mar-2014)
    # Example for AS19679:
    # ./ 19679
    # generates as19679.txt
    echo $url
    fetch -o $out `echo $url` 
    cat $out | grep '

  • Moderator

    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.

Log in to reply