Monitor your BGP Advertised Routes with Paramiko

This post moves back to the basics and covers how to perform screen scraping using python and a helpful SSH library called Paramiko. Although the example below is about a specific task of checking the BGP outbound advertised routes of a device, the script can be reused to perform screen scraping for any output that the device offers. This example is for a Cisco IOS device, but it should work on many devices with a few tweaks in the commands sent and regex strings.

I’ve used inline comments for the explanations in the example below, but feel free to ask questions about this example or screen scraping other specific data. Here’s the GitHub Gist version if you want to fork and make your own changes. Continue reading

Control BGP Advertisements to eBGP peers with ExaBGP

This entry is part 5 of 6 in the series Influence Routing Decisions with python and ExaBGP

We know that ExaBGP can be used to inject BGP routes into an AS that you control. It’s a very helpful feature that allows you to automate reachability and traffic flows within your network. But what if you want to you ExaBGP to influence what is advertised, or in this case, not advertised to external peers that are not willing to peer with your ExaBGP service?

BGP PeeringsOur scenario is this: We have a 100.10.10.0/24 prefix attached to our SW. The CE router learns about this prefix from SW via OSPF, and then advertises the prefix out to the Internet via the PE router. This 100.10.10.0/24 prefix is anycasted so it is also advertised out of a different location. In order to withdraw the prefix from the PE and therefore the Internet we would need to manually filter the prefix outbound via route-map, or stop the advertisement from the SW which would also remove the resource from local resources. Continue reading

TFTP copy from a non-global VRF

I’ve been running a Cisco CSR-1000v box on my Mac in Parallels for a bit now. I love the convenience of being able to test on a real IOS XE device anywhere I am (airplane, coffee shop, maybe even my office)! I’ve been running the CSR-1000v since version 3.09 and I wanted to upgrade to 3.12.0S since it’s got some new features, bug fixes, and most importantly (for me) a lower memory footprint. I downloaded the new .bin file and proceeded to try and upgrade the image as I would any physical device, with TFTP. Well, here’s how well that went:

Continue reading