Author Archives: 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 <device> <vendor>Cisco</vendor> <model>7600</model> <version>IOS 15.6</version> </device>
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
<device> <vendor>Cisco</vendor> <model>9600</model> <version>IOS 15.6</version> </device>
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”.
<root> <a:device xmlns:c="http://example.org/7600devices"> <a:vendor>Cisco</a:vendor> <a:model>7600</a:model> <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
--- IOS: CISCO JNOS: JUNIPER CISCO: - 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
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 https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
What is Git Version Control , Lets understand it in more simple way .. As per https://stackoverflow.com/questions/1408450/why-should-i-use-version-control/1408464#1408464
Have you ever:
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:
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
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
|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 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:
2) GNS3 VM(.ovo file)èhttps://www.gns3.com/software
3)Vmware workstation Player èhttps://filehippo.com/download_vmware-workstation-pro/68880/4) VIX APi èhttps://www.vmware.com/support/developer/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 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 :-
So lets start with basics of Linux which can help us in our day to day task:-
Change current directory to parent directory
Back to home directory
Back two directory
Moves back to previous working directory
makes new director
makes all Continue reading
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 :
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 :-
Its done.. Enjoy automating tasks !!!!
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 : ip
In : out= re.findall(r'(10.10.10.\d+)’ ,ip)
In : out
Out: [‘10,10.10.1’, ‘10.10.10.121’]
#Above example help us to find out all the IP’s of subnet 10.10.10.0/24 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 : text
Out: ‘Cisco IOS Software, 7200 Software (C7200-SPSERVICESK9-M), Version 12.2(33)SRE, RELEASE SOFTWARE (fc1)’
In : out = re.match(r”Cisco”,text)
In : out
Out: <_sre.SRE_Match object; span=(0, 5), match=’Cisco’>
In : out = re.match(r” Software”,text)
In : out
In : out = re.search(r” Software”,text)
In : out
Out: <_sre.SRE_Match object; span=(9, 18), Continue reading
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 .
. – Period character ,use for matching any single charcter
In : ip =’10.20.30.40′
In : re.search(r”.”,ip)
Out:<_sre.SRE_Match object; span=(0, 1), match=’1’_>
In : re.search(r”.”,ip).group(0)