A perl script to find IP and network addresses in a text file (config, ACL, etc) and annotate them with various bits of information

Mel Beckman mel at beckman.org
Tue Aug 18 17:09:31 UTC 2015


Sweet! Ill try this out this week for a similar router migration project I have.

________________________________________
From: NANOG <nanog-bounces at nanog.org> on behalf of Jesse McGraw <jlmcgraw at gmail.com>
Sent: Tuesday, August 18, 2015 10:04 AM
To: nanog at nanog.org
Subject: A perl script to find IP and network addresses in a text file (config,  ACL, etc) and annotate them with various bits of information

(This is me scratching an itch of my own and hoping that it might be
useful to others on this list.  Apologies if it isn't)

All,
    I was working my way through a very long ACL, trying to clean out
old cruft, and I found myself thinking that surely I could make this
somewhat easier.

So, I wrote a small script that will go through a text file(or files),
find anything that looks like a host IP or subnet (with subnet mask,
wildcard mask, or mask length), dig up information about them (DNS name,
ping responsiveness, host count etc) and then spit out an HTML version
of the input file with color coded info.

General info is blue
Hosts that are reachable and networks that have a specific route are
GREEN (see networks note below)
Hosts that are non-responsive and networks that use default route are RED

Individual script is:
https://github.com/jlmcgraw/networkUtilities/blob/master/annotate_hosts_and_networks_in_file.pl
Repository is:  https://github.com/jlmcgraw/networkUtilities

To get the whole repository:

     git clone https://github.com/jlmcgraw/networkUtilities.git

This repository includes the necessary modules for this script and some
other small utilities that network folks might be interested in

(If for some reason included modules don't work for you see setup.sh for
easy ways to install them under Debian-derived Linux. I've tested the
script under Linux and Windows, but not OS X)

Please let me know if you use this utility and encounter anything that
doesn't work right.  I'm also interested in incorporating any
changes/improvements so feel free to send a pull request!

-Jesse


Note:
     If you've got a BGP speaking router that you can query via SNMP,
you should be able to use bgp_asn_path_via_snmp.pl
<https://github.com/jlmcgraw/networkUtilities/blob/master/bgp_asn_path_via_snmp.pl>
to create a table of known routes to use along with this utility



More information about the NANOG mailing list