IP Network Parser (18 of 30)

Assuming you have all of your configs in one directory, here is a simple script that goes through Cisco configs, parses them and outputs the network id, and netmask. Which in itself isn’t that useful, but now that you have it in a hash, there are a lot of things you can do with it. Like verify it against your routing table or IPAM, etc.. It also does two other simple checks, if the file name does not match the hostname it notifies, and it also checks to see if the interface is shutdown in order to assume it is up.

The only thing you have to do is make sure it is executable and point it to your config directory, like this:

1
2
#fill in your directory here
my $rtr_directory = '/tmp/configs';

Here is a sample output:

ip_scrub

 

I published it to a new generic Scripts repository on my Github.

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>