Know Network Packets – Crazyrouters

Author Archives: Know Network Packets – Crazyrouters


XML – Extensible Markup Langauage

Its more suitable as data representation choice when software element need to communicate with each other.

Let review the XML basics with an example

[email protected]:~/newfolder$ cat ex1_xm.xml 
  <version>IOS 15.6</version>

Here <device>  is root , which is present in outermost XML tag of document , also referred as parent of the element <vendor>,<mode> and <version> , whereas <vendor>,<mode> and <version>  is known as children of the parent element <device>.

Namespace : Its part of XML Specification to differentiate between different XML blocks having same names

  let’s take an example  , if I have one more xml document as below

  <version>IOS 15.6</version>

Here , the only difference between earlier XML doc and this one  is one element i.e  model  number changed from 7600 to 9600 ,but parent element is same in both XML doc i.e <device> So there should be method to avoid conflict , there comes NAMESPACE which prevent element naming conflict

The namespace can be defined by an xmlns attribute in the start tag of an element.

The namespace declaration has the following syntax. xmlns:prefix=”URI”.

  <a:device xmlns:c="">
      <a:version>IOS 15. Continue reading


Yaml- YAML Ain’t markup langauge

The devices need a standard  protocol to communicate between each other , similarly there  is requirement of specific standard data format to communicate between application .YAML is one of the data format and is best known to be human friendly  means it’s easier to understand and write  for human compare to other well know data format such as JSON and XML

YAML document starts with 3 hyphen ‘—‘ at top ,it indicate beginning of YAML  document .

We can have mix data types in YAML, let’s see with an yaml example


  - Router
  - 7600
  - True
  - ['interface','ip address']

 First and second item i.e IOS: CISCO  and JNOS: JUNIPER is dictionary where ‘IOS’ and ‘JNOS’ is key and ‘CISCO’ and ‘JUNIPER’ is respective values

Third Item too is dictionary which comprises of list having different data type as below:

    ‘Router’ is string type.

     ‘7600’  is integer type

    ‘True’ is Boolean type

    Fourth item [‘interface’,’ip address’] is list  containing strings

Working with YAML using Python

The first and foremost thing to use YAML is to install PyYAML  , it’s  a YAML parser .

[email protected]:~/newfolder$  Continue reading

GIT – Version Control for Network Engineers

Is GIT any way related to Network Guys ?  What is GIT and how a network engineers can benefit from It. Most of the network engineer might have not came across GIT and even not used in their work environment,But as mentioned in  earlier posts that inclusion of DevOps in Networking has made network engineer to learn about automation and related technologies.

GIT is a distributed version control software that keeps track of every modification to the code. If any change or mistake is made , we can look back and compare with  earlier version of code and find for any mistake.

So how GIT can be useful for Network Engineers ? Network Engineer can use GIT to see the config,how and when it got changed and who made the change ,all the changes in a file  can be  tracked easily.

Git can be easily installed by following the steps provided in link

What is Git Version Control , Lets understand it in more simple way .. As per

Have you ever:

  • Made a change to code, realized it was a mistake and wanted to revert back?
  • Lost code or had a backup that was too old?
  • Had Continue reading


Vagrant is an alien word for network engineers ,we as network engineer are more close to windows environment than Linux and always try to avoid linux . But time has changed now and with introduction of automation ,SDN ,Devops  in networks professional  life has made him to come out of windows environment and  try Linux for multiple reasons as below:

  • Mostly open source projects (open stack, Docker etc. )tools are based on Linux which we as network engineers have to use.
  • Network devices are now having Linux as underlying shell.
  • Most of the software which are directly or indirectly related to networks are using development environment as Linux.

So when ever we plan to work on linux environment , we just start downloading ubantu on our windows laptop with VM box ..install both and start working.

But there is an environment known as Vagrant that will not help you do all the Linux related task but also provide an environment that helps reduce setup time and allows you to virtualize configurations for various projects.We can set up  up a virtual network environment for testing purposes, or setting up a lab,  work with python , ansible ,devops tools and much more .

You Continue reading

Technology often thought of as SDN !!!

What is SDN ? SDN Definition varies  from Vendor to vendor ,commonly  the architecture of SDN defined by each vendor includes use of different technology to make  network automate, flexible, agile, dynamic ,scalable and most importantly cost effective.

I was going through Network automation article and found the different technology/trends which are some or other way often thought of  a SDN, or are important  part of SDN discussion .It’s good to go through it  :-

OpenFlow : Its low level protocol used to decouple the control plane from the data plane.

NFV Network function Virtualization: It refers to taking functions that have traditionally have been deployed as hardware ,instead deploy them as software.

Virtual Switching :They are software based  switches VDS(VMware Distributed switch ) ,AVS(cisco application virtual switch ),VSS(VMware Std. switch) etc.  that resides in hypervisor kernel providing local network connectivity b/w virtual  machines.

Network Virtualization: It refers to software-only overlay-based solution. A key characteristic of these solutions is that an overlay-based protocol such as Virtual eXtensible LAN (VxLAN) is used to build connectivity between hypervisor-based virtual switches.  This connectivity and tunneling approach provides Layer 2 adjacency between virtual machines that exist on different physical hosts independent of Continue reading

AWS Cloud – Part 1

Cloud networking has become buzz now days, Cloud networking is term use to define the group of network resources and services available which can be shared among various client and customers.This can be a private cloud or a public cloud .
The entire network is on cloud, which can be used to provide connectivity between application ,resources ,services deployed in the cloud.
There are multiple cloud provider in market today, some of the well known cloud provider are Amazon AWS,Microsoft  Azure,Google cloud Platform,IBM and multiple other vendors.
According to a recent Cloud Security Alliance (CSA) report ,Amazon Web Services is the most popular public cloud platform (41.5% ) .

Here we will go through the basics Amazon Virtual Private Cloud or VPC :Its virtually isolated networks ,they cannot communicate to each other ,to external world,internet ,to a VPN without explicitly granting that ability.we create VPC per account per region basis.Lets first understand about the few terms related to AWS  .

Amazon EC2 : :Amazon Elastic Compute Cloud (Amazon EC2) provides scalable computing capacity in the Amazon Web Services (AWS) cloud. Using Amazon EC2 eliminates your need to invest in hardware up front, so you can develop and deploy applications Continue reading

Integration of GNS3 with VMWare Workstation

Integration Of GNS3 with VM

There has been multiple query regarding the integration of GNS3 with VMWare  , the  goal of this Post is to help to get the users know the easy steps to integrate GNS3 with VM  .  This will not only help the user to practice  CCNA,CCNP  lab in GNS  but also work with  with network automation scenarios.

Lets start with downloading the  GNS3 and corresponding GNS3 VM from GNS site.

Now you need to install VMWare Player ,  download the Vmware workstation Player 12 which i found to be compatible with GNS3 .The last item to download is VIX API , so in total we have downloaded 4 items as mentioned below with required links:

1)GNS3  è 

2) GNS3 VM(.ovo file)è 

3)Vmware workstation Player è

4) VIX APi è

Once VM Player is downloaded , need to open the GNS3 VM .ovo  file and import it.

You can see GNS3 VM  on Workstation player page as below

If You want to tweek the VM Memory, cpu that can too be done .   

You can see the  IP address obtained Continue reading

Linux Must for Network Engineers !!!!

Linux once used to be strict NO for Network engineer, we as network engineer always preferred to be comfortable with windows. But time has changed now ,Linux is everywhere starting from mobile device ,computers, servers, Hypervisor, network switches . Most of the network devices operating system is based on Linux.

Few important reason for network engineers to Learns Linux :-

  • Mostly open source projects (open stack, Docker etc. )tools are based on Linux which we as network engineers have to use.
  • Network devices are now having Linux as underlying shell.
  • Most of the software which are directly or indirectly related to networks are using development environment as Linux.

So lets start with basics of Linux which can help us in our day to day task:-



  • “Super user do” command is used to gain root privilege.Dollar sign($) signifies user does not have root privilege.Hash sign(#) signifies user have root privilege.


  • Print working directory.


  • List content of directory.

Man  <Command>

  • List manual pages of command


  • Change current directory to parent directory


  • Back to home directory

Cd ../..

  • Back two directory


  • Moves back to previous working directory


  • makes new director

Mkdir -p

First Python App-Read and Configure Cisco Devices -Test Enviornment GNS

It’s first version of python app where we have number of devices loopback0 ip address stored in device.txt file.Program will read the file ,fatch  loopback0 address and ssh into the respective device.

Program will  push the command “sh ip int brief”   in second step and  display output on screen .We have taken example of 3 devices to test the code.If there are more number of devices ,just need to add the loopback0 of additional device in device.txt file

Python code is written to  configure the loopback10 with IP addresss into each respective devices (mentioned in devices.txt file)  by reading the required device config file stored as respective device Loopback0.txt file.( if need to add more configuration ,just need to add the config in that respective device loopback0.txt file.)

I have used GNS environment  to test the python program.



We have Used Netmiko Library to access cisco devices to get the required output and also configure the device


Below are the functions defined in Python code :

  • Function get_devices_info() will read the file and get the device loopback0 detailsget_devices_info.PNG
  •  Function connect() will connect the devices using ssh (ConnectHandler used from library Netmiko)connect.PNG
  • Continue reading

Install Netmiko on Windows

Netmiko develop by kirk Byers is open source python library  based on Paramiko which simplifies SSH management to network devices .

Netmiko library  makes task to automate . Its very tedious to find out the procedure to install Netmiko in Windows enviornment.Let’s make out task simple :-


  • Install Anaconda (
  • From the Anaconda shell, run “conda install paramiko”.a
  • From the Anaconda shell, run “pip install scp”.b
  • Install git for windows (
  • Clone Netmiko from Git Bash Window (
  • Change directory to netmiko.2
  • Run  python install from Git Bash Window3
  • Check on Python console to confirm the availabilty of paramiko and netmiko libraryresult

Its done.. Enjoy automating tasks !!!!



Regular Expression for Network Engineer Part-2

This post is continuation of the  Regular Expression for Network Engineer Part-1 , here  we  have a look for the different methods to find out the pattern in string.

Findall() – returns  list of all the  matches the pattern in a string  without overlapping


[code language = “Python”]

re.findall(pattern, string[, flags])

In [118]: ip
Out[118]: ‘,,,,,’

In [119]: out= re.findall(r'(10.10.10.\d+)’ ,ip)
In [120]: out
Out[120]: [‘10,10.10.1’, ‘’]

#Above example help us to find out all the IP’s of subnet from group of ip’s.


Match()-return a match object when pattern is found at the beginning of string, if no pattern is found ,result in None.


[code language = “Python”]

In [189]: text
Out[189]: ‘Cisco IOS Software, 7200 Software (C7200-SPSERVICESK9-M), Version 12.2(33)SRE, RELEASE SOFTWARE (fc1)’

In [190]: out = re.match(r”Cisco”,text)
In [191]: out
Out[191]: <_sre.SRE_Match object; span=(0, 5), match=’Cisco’>
In [192]: out = re.match(r” Software”,text)
In [193]: out
In [194]: out =” Software”,text)
In [195]: out
Out[195]: <_sre.SRE_Match object; span=(9, 18), Continue reading

Regular Expression for Network Engineer Part-1

A regular expression is set of pattern used to define certain amount of text. An powerful  tool in any scripting language to match any pattern.

Lets have a look , how regular expression can be used in Python to solves the problem. Module “re’ is imported in python to support regular expression .

<< import re >>

[  ] – its for specifying character class, individual char or range of character can be mached .


  • [123] will match any of the character ‘1’,’2′,’3′
  • [1-3] will match any of the character  ‘1’,’2′,’3′
  • [a-d] will match any of the character a,b,c,d
  • [a-z] will match lowercase
  • [A-Z] will match uppercase
  • [^6] will match any character except 6
  • [a-zA-Z0-9] will match any alphanumeric character
  • [^a-zA-Z0-9] will not match any alphanumeric character
  •  [a-zA-Z0-9] is equivalent to \w
  •  [^a-zA-Z0-9] is equivalent to \W
  • [0-9] is equivalent to \d
  • [^0-9] is equivalent to \D
  • [  \t\n\r\f\v] is equivalent to \s
  • [ ^ \t\n\r\f\v] is equivalent to \S


. – Period character ,use for matching any single charcter



[code language=”python”]

In [225]: ip =’′
In [226]:”.”,ip)
Out[226]:&lt;_sre.SRE_Match object; span=(0, 1), match=’1’_>
In [227]:”.”,ip).group(0)
Out[227]: ‘1’

Continue reading