NXOS – Bash scripting at the CLI

Every now and again you see a snippet of complex CLI syntax that gives you pause for thought. Last week I saw the command below in a change procedure. The command was being used to verify baseline BGP neighbor state and re-verify after a policy change.

show ip bgp peer-template eBGP_Peers | egrep default | sed 's/default://'  \
| tr -s '  |\n' | tr -s ' ' '\n' | sed 's/^/show ip bgp nei /' \
| sed 's/$/ adver | grep \//' | vsh

I was a little daunted by the complexity of the command at first. I was slightly embarrassed too, as I had no idea what the command did. I learned that this command finds all neighbors which use a named bgp peer-template, and lists the prefixes they advertise. In this post I’ll break down the command and share the love about NXOS CLI and bash scripting. Continue reading

OSPF – Setting MTU values for Cisco and Juniper

MTU mismatches are the primary reason an OSPF adjacency becomes stuck in the EXSTART state.  After hellos are exchanged and the routers become neighbors, each OSPF speaker advertises the IP MTU of it’s local interface in a Data Base Description (DBD) LSA.  If there is a mismatch you’ll probably just adjust the configuration to be identical on both ends of the link and be done. However, when you try to peer two OSPF routers with different network operating systems, things start to fall apart fairly quickly.

Continue reading