Random SP Lab Notes

During the course of doing all of the INE labs I end up breaking a LOT of things… like a LOT. That’s all part of the “fun” though! As fun as it is I can’t say that I enjoy making the same mistake more than once. So when I come across a config that I can’t seem to remember, or a concept that I seem to continually forget, or even just a point that I think may be relevant for the lab or real life, I make a point to write it down. I write down, in my own words, a quick blurb that makes sense to me to help describe whats going on. Often these notepads end up with some colorful language (as is standard for me), but I think it really helps to commit things to memory for me. It also is usually way easier for me to go back and read a quick blurb in my own words to help jog my memory. So anyway, I figured I’d post up a link, maybe my silly notes will be helpful for somebody!

Heres my favorite… because I’m not too proud to admit that I’ve probably done this ten times, and spent hours of time troubleshooting why a VPN wouldn’t work — all because I couldn’t seem to remember that “AS Override” is a thing!

For the love of god man — remember that AS Fracking Override is a thing!!

Linky to the rest: https://www.dropbox.com/s/yr6kg8alk333i0r/Notes.rtf

Dabbling in the Dark Arts

It seems to me that learning a bit of Python would probably be a really stinkin’ good idea right about now. Don’t get me wrong, I am NOT one of those folks who thinks that if you are a network engineer who does not learn to program you are going to be obsolete by the end of the month… and I don’t think that (from what I can tell) network engineers are going to need super deep programming skills… BUT I do think that network engineers need to evolve a bit and learn some other cool stuff. Worst case, you learn a bit, never have to use that skill, and are no worse for wear.

Anywho, this post doesn’t really have anything to do with routing or Cisco or Juniper and how Python can interact with their respective gear (although hopefully this will lead down that road eventually), but instead is just a blurb about my first little foray into playing with Python.

Many moons ago a friend at an old job gave me a teraterm macro that called on a list of devices and a list of commands. The macro would load up and ask you for some credentials, then go out to poke all the devices and record the output of the commands you asked it to do. This was a great tool, I used it all the time to bulk update stuff like a new NTP server for a bunch of access switches or something along those lines. One big problem with the tool was that teraterm kinda sucked! Also for some reason it never seemed to want to work with SSH which is obviously an issue (hopefully everybody’s devices have telnet disabled!).

So, I was bored over the holidays and saw some stuff about Python and saw some scripts some server guys did to go out and touch servers and do xyz tasks. I figured if server guys can do it, then I can probably do it (like way better too) :)!

From zero Python experience, in two afternoons, here is my creation thus far. I have of course relied HEAVILY on my dear friend the Googles, and the posts of far smarter people than me, but other than checking out some examples this monstrosity is my own little creation. I know that Python supposedly favors flat instead of nested (funny/awesome Zen of Python: http://www.python.org/dev/peps/pep-0020/), but I ended up with a decent amount of nested loops… perhaps from the one semester of C++ I took way back when?

Here she is, anybody who actually knows Python feel free to comment and tell me how wrong I’m doing it 🙂 I’ll keep this link as the ‘master’ script if I make any changes.

Linky: https://www.dropbox.com/s/qvks9e4g9kn24sg/SSH.py

To run it, just cd to the directory and run ‘python [scriptname].py’ make sure that your device list, credentials list, and commands list are in txt files named per the script in the same directory. Those files should just have one entry per line — for credentials, line 1 = username, line 2 = password, and line 3 = enable password.

I’ve only tested it out on a few devices at my house, so play with it and let me know if it works or fails miserably and any other things that would be cool to have in there. That would give me a cool little side project to keep on playing with Python.

Also note that I built this on a mac and have not tested any other platforms. I used the default Python install but did have to install IPy and perhaps another package, can’t recall at the moment.