Python for Network Engineers

Perform an Arp Poisoning Attack Using Scapy

By George El. • November 2019 • Reading time: 3 minutes

In this post I will show you how to perform an arp poisoning attack on local network using a python package called scapy. Scapy is a package that allows us to craft our own packets specifying all layers from layer2 to layer7. In my local network I have two pcs, with addresses 192.

Using TextFSM to Parse Cli Output

By George El. • July 2019 • Reading time: 4 minutes

Many times we connect to a router or switch usually with netmiko and we want to parse the output of a command. TextFSM is a Python module for parsing semi-structured text into python tables. It uses templates that use regular expressions in order to parse the output. The good thing is that there are already hundreds of templates for many devices and commands.

Using CiscoConfParse to Parse Cisco Configurations

By George El. • June 2019 • Reading time: 3 minutes

In this post I will present a python module that makes the parsing of cisco configuration files easy. The module is called CiscoConfParse Lets start by installing it pip install ciscoconfparse I will use the following cisco file which is taken from the documentation site, but I have added a few lines in the beginning

Configuring Dhcp Snooping and Arp Inspection on Cisco Switches

By George El. • January 2019 • Reading time: 4 minutes

Dhcp snooping is a feature that protects against rogue DHCP agents. This happens by characterising links as trusted and untrusted. Untrusted ports can only forward requests, while trusted can forward all dhcp messages. steps to to configure dhcp 1. characterize uplink interfaces as trusted I assume your dhcp server is on the distribution or core layer.

Remote Span Quick Configuration

By George El. • January 2019 • Reading time: 1 minute

remote span quick tip lets say you want to capture some packets from switch A that is connected to switch B and you have your packet capture device on the swB You have to specify a vlan on all switches as remote-span vlan 400 remote-span On switch A where your host is connected to gi1/0/1

To VTP or Not to VTP

By George El. • December 2018 • Reading time: 3 minutes

VTP is the cisco Vlan Trunking Protocol. It allows the automatic configuration of vlans by setting one or more switches as VTP servers and other switches as VTP clients. Changes are allowed only in the Servers. There is another mode, called transparent, which allows the propagation of vtp advertisements but does not participate in the vtp domain.