Tag Archives: Scripting

Interface DNS (26 of 30)

When creating traceroutes, it is always nice to have the interfaces reflected in dns, you can see that most interfaces are seen via the internet like so:

dns2

It’s even more meaningful when you can do the same on your internal network. I created a script, which is an extension of a previous post, parses your configs from a directory you specify, creates a list of networks, and then also outputs entries to be added to your dns. You can see a quick output here:

dns1

As always, you can follow this on my Github.Read more

OUI Finder (24 of 30)

I have been looking into doing some simple scripts based on a a post on reddit, this the first one. The idea is simple, query a switch and alert if you find an oui you don’t want (e.g. netgear, linksys, etc.) I wanted to write the code a bit cleaner, but ran into a few issues, and didn’t have the time. It is functional (on cisco at least) and the alert is only set to print for now, but it is in a function and can be easily changed to do what you want with it.… Read more

Route View Script (20 of 30)

I created a script that logs into route servers ( I used the ones found here routeserver) and checks for networks that you define. All you have to do is define the networks with edge ASN, this way it can tell you which last hop ASN it took from that route server, and you can match that to your peer’s ASN.

There is basically two files, the configs file, which comes pre-populated with the route servers from the server above, and the script itself named routeserver.pl.… Read more

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.… Read more

Configs Templates Take 2 (17 of 30)

This is the second part of a series of post’s on developing a Config Template tool, click this link to follow the whole series of post’s. This tutorial will go over two attributes of HTML::Template cpan module. The ability to “include” other config templates and the ability to make simple if statements.

Let’s say you have regional configs, in this example, it will be NTP servers, but it could easily be tacacs, radius, syslog, etc… You want to be able to have the user declare one option (the region,) and it correctly declare the regional configs.… Read more

Configs Templates Take 1 (15 of 30)

I have developed several config template systems over the years, so I wanted to write a tutorial on some of the things I have done. This first tutorial is not much more than going over HTML::Template cpan module, and having an input form, with a short demo and providing the script. As I build on each one, it will get more and more complicated. You can see a much more in depth coverage at packetlife, but this is meant to be much more step-by-step.… Read more

Cisco Symmetrical Script (14 of 30)

A while ago I had written a script that would logon to Cisco devices, run a traceroute from IP-A to IP-B then do the same for IP-B to IP-A. It would then query each hop with snmp and see if they worked out to be the same path. If it wasn’t, it would show you the differences.

I have put it up on github.

Update the below with your personal configurations

my $snmp = ‘snmp_read’;

my $ios_username = ‘ios_username’;
my $ios_password = ‘ios_password’;
my $ios_enable_password = ‘enable_password’;

Then you can run the script via cli, or send an html form to the script.… Read more