The Stupid Engineer

I ask those questions you're too clever to.

Check PFC Mode on A Supervisor Card

Have to do this occasionally so I’m writing the show command for it down.


Switch1#show platform hardware pfc mode
PFC operating mode : PFC3CXL

3 Useful Juniper Commands

wildcard delete
Deletes all configuration associated with a level.

show system commit
Shows any annotations performed during the previous commit. Requires that the previous commit used a “commit comment” when committing the configuration.

clear system commit
Removes any pending commits.

Quick ACL Entry Comparison Script

The ACL_compare function takes two lists of strings and compares the first to the second and returns a list comprising strings that are present in the first that are not in the second.

The listconvert function converts a file read into memory into a list of strings. Handy for when you use filenames as arguments when you run the script.

Essentially it’s all just string comparison really.


#Simple Python script to print absent ACL entries absent in a new rulebase when compared with an existing rulebase

import sys

def ACL_compare(fwsm_ACL,asa_ACL):
comparison=[]
for line in fwsm_ACL:
if line in asa_ACL:
pass
else:
comparison.append(line)
return comparison

def listconvert(file):
newlist=file.readlines()
return newlist

def listprint(somelist):
for line in somelist:
print line

def main():
print("usage: ACL_compare.py fwsm_rulebase_file asa_rulebase_file")
fwsm_rulebase=open(sys.argv[1],'r')
asa_rulebase=open(sys.argv[2],'r')
fwsm_rulebase_list=listconvert(fwsm_rulebase)
asa_rulebase_list=listconvert(asa_rulebase)
difference=ACL_compare(fwsm_rulebase_list,asa_rulebase_list)
print ("differing entries are")
listprint(difference)

if __name__=="__main__":
main()

VRF Race Condition

A while ago I observed an interesting problem due to a routing misconfiguration. An asymmetric route was introduced across two discrete switches/routing instances. The route was then imported in a separate location.

Quick and dirty network diagram

Quick and dirty network diagram

When I began troubleshooting I was under the impression that the importer preferred one route over another because of admin distance or some other metric, or perhaps it was some sort of BGP esoterica you’d only encounter if you were using VRFs and MP-BGP to learn routes. However, the truth was probably something more prosaic.

Both routes were static routes. This meant their learning mechanism across importers was the same. The reason the importer preferred one route over another was probably due to one entering the routing table before the other.

Simple Bash Ping Script

Been looking for something like this for a while:

http://etherealmind.com/tech-notes-ping-sweep-ip-subnet/

for i in `seq 1 255`; do ping -c 1 192.168.1.$i | tr \\n ‘ ‘ | awk ‘/1 received/ {print $2}'; done

I usually use nMAP for this, but in some instances you may not have access to it. For those times, Bash should work really well.

Android Bugs

I have a little Samsung Galaxy S2 which is a perfectly adequate phone. I use the Google Apps on it to keep some semblance of order in my life. However, I run into some occasional bugs which require a bit of work to solve. So I’m putting in the fixes here so they’re easily available.

1. Weather widget displays an incorrect location. Documentation date 03.11.2014
This is fixed by going to Settings->Application Manager and performing a forced stop on the TouchWiz Home application.

2. Lockscreen displaying an incorrect location. Documentation date 03.11.2014
First I thought this was related to the first problem. However, this can be fixed by going to Applications->Security and changing the location detection to refresh automatically. It looks like adding a new city in the weather widget updates the location in the lockscreen, but removing it doesn’t force an update to the lockscreen.

More bugs will be documented here as they’re found.

Fun With Optics

I recently had a deployment where we needed to connect Cisco 6500s to Juniper MX960s.

There was a lot of confusion surrounding what fibre and optic modules needed to be used, so I’m documenting the initial state and the successful state here.

Initially, the Junipers had the following model numbers used for the optics:

XFP-10G-LR (identified using a “show chassis hardware”)

The 6500s:

10Gbase-SR

Interestingly, one of the links came up between the devices, while one did not. I tried swapping the cable (Single Mode) for Multimode for the non-working link, and that did not fix the issue. We then swapped the Cisco optic for an LR optic and used Single Mode fibre which did the trick.

Confusingly for someone from a Cisco background like me, the Juniper optic was labelled  XFP-10G-L-OC192-SR1. I assumed the SR stood for short reach/range (it does) and tried to use Multimode fibre, as you would with Cisco SR optics. However, it turns out that the Juniper SR optic in this case used Single Mode fibre as its interface.

It is documented in this handy link here, which turned up with some Googling.

The confusion stems due to the reference to Short Reach differing between Cisco and Juniper. I need to figure out a simpler way to ID the type of fibre to be used. Perhaps using the core:cladding ratio is the best way? 9:125 micro meters seems to be what is used for SM fibre.

Follow

Get every new post delivered to your Inbox.