Archive

Category Archives for "CrazyRouters"

Passed AWS Associate Exam

I took the exam on 8th May 2021 and was able to crack it .Now you can call me AWS certified Associate .

I started thinking of giving the AWS associate exam more than a year back when my company provided us the free license of cloud Guru. We started a group of individuals who were interested in learning and taking the AWS associate exam. Our plan was to go through the cloud guru videos twice in a week during office hrs ( Allocated 1 hrs for learning ) and discuss any doubts related to topics. It all went very well for few weeks and suddenly people started missing sessions due to different reasons such as office meeting and workload. The group which started with 30 people reduced to 10 now and unfortunately I too dropped due to timing clash and office workload.

Almost after 6 months, again I started going through cloud Guru Videos and this time I was able to complete it and at that time i can easily rate myself 6 out of 10.

I went through AWS FAQ’s , I must say that they are must if you are preparing to take AWS exam.

I didn’t stop, Continue reading

TCP Transport control Protocol -PART 1

There was a need of protocol which can sent the data over a medium that is lossy . In simple term lossy is medium where data can be lost or alter.If an error occurs, there are 2 ways it can be taken care:

  • Error correction code
  • Resent the data again until its properly received

Resent the data need to fulfill 2 condition to make it worth , first whether the receiver has received the packet and and second whether the packet it received was the same one the sender sent.

This method to sent signal by receiver to sender that pack is received is known as Acknowledgement (ACK). So the sender should send a packet , stop and wait until ACK arrives from receiver.Once Ack is received by sender, it sent another packet and wait for Ack and this process continues.

But this process of stop and wait gives us 2 problem to taken care

  • How long should the sender wait for an ACK?
  • How to recognize duplicate Packets

Lets take each problem one by one starting with second one i.e recognize duplicate packets .

  • Question is how do i Recognize duplicate packet

Python String-Mutable Data Type

We all know that there are two types of Data types in Python ,i.e Mutable and other is immutable. In simple words, Mutable object can be change after its created whereas immutable object can’t

String,tuple,int,float,bool is example of immutable whereas list,dict and set are example of mutable data type.

Lets take an example of string data type :

We have string S=’Sujil’ and we need to change char ‘j’ to ‘n’ to make S=’Sunil’

>>> S ='Sunil'
>>> S ='Sujil'
>>> S=[2] = 'n'
  File "<input>", line 1
SyntaxError: can't assign to literal

We will get the SyntaxError , means we cannot change the defined string as string is Mutable data type .

Is there any way to change the Mutable data type string S=’Sujil’ to S=’Sunil’.

Yes , we can so the same . There is 3 way to do as below , choose the best way for urself.

Way 1:

>>> S ='Sujil'
>>> S
'Sujil'
>>> S = S[:2]+'n' +S[3:]
>>> S
'Sunil'
>>> type(S)
<class 'str'>

Way 2:

>>> S = 'Sujil'
>>> S
'Sujil'
>>> type(S)
<class 'str'>
>>> S =S.replace('j','n')
>>> S
'Sunil'

Way 3:

>>> S = 'Sujil'
>>> type(S)
<class 'str'>
>>>  Continue reading

JSON

JSON(Java Script Object Notification) is another data type apart from XML and YAML ,It’s easy for human and machine to understand than XML.

As usual, lets start with json example:

anurudh@anurudh:~/newfolder$ cat ex1_js.json
{
  "hostname": "Router1",
  "vendor": "cisco",
  "users": {
      "admin": 15,
      "storage": 10
},
  "vlans": [
     { 
       "vlan_name": "VLAN10",
       "vlan_id": 10
     },
     {
      "vlan_name": "VLAN20",
      "vlan_id": 20
     }
   ]
}

We like to put few point :

  • The whole thing is wrapped in curly braces {}.
  • JSON  use string values when describing the keys in these constructs.

Working with JSON in Python

anurudh@anurudh:~/newfolder$ cat ex1_js.py 
# Module need to be imported to use json 
import json

# File is open and stored in varible dat 
with open("ex1_js.json") as f:
     data = f.read()

# json.loads places json data into json_out (dictionary)
json_out = json.loads(data)

# print output
print(json_out)

# Lets check the data type 'json_out'
print("The Json document loaded as type {0}\n".format(type(json_out)))

# Method json.dumps will  convert python object back json string
json_out1 = json.dumps(json_out)

#print output
print(json_out1)

# Lets check the data type 'json_out1'
print("The Json document loaded as type {0}\n".format(type(json_out1)))

anurudh@anurudh:~/newfolder$ 

OUTPUT

anurudh@anurudh:~/newfolder$ python3 ex1_js.py 
{'hostname': 'Router1',  Continue reading

XML

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

anurudh@anurudh:~/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- 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

ex1_ya.yaml

---
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 .

anurudh@anurudh:~/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 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:

  • 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 FOR NETWORK ENGINEERS

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  èhttps://www.gns3.com/software 

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 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:-

 

Sudo 

  • “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.

Pwd

  • Print working directory.

ls

  • List content of directory.

Man  <Command>

  • List manual pages of command

Cd..

  • Change current directory to parent directory

cd

  • Back to home directory

Cd ../..

  • Back two directory

Cd..

  • Moves back to previous working directory

Mkdir

  • 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.

topology

 

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

import_netmiko.PNG

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 :- Steps: Install Anaconda ( https://www.anaconda.com/download/) From the Anaconda […]

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 :-

Steps:

  • Install Anaconda ( https://www.anaconda.com/download/)
  • From the Anaconda shell, run “conda install paramiko”.a
  • From the Anaconda shell, run “pip install scp”.b
  • Install git for windows (https://www.git-scm.com/downloads)
  • Clone Netmiko from Git Bash Window (https://github.com/ktbyers/netmiko).1
  • Change directory to netmiko.2
  • Run  python setup.py 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

  • EXAMPLE

[code language = “Python”]

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

In [118]: ip
Out[118]: ‘10.10.1.10,29.10.1.10,10.10.1.20,192.168.1.0,172.16.10.1,10.10.10.121’

In [119]: out= re.findall(r'(10.10.10.\d+)’ ,ip)
In [120]: out
Out[120]: [‘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.

[/code]

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

  • EXAMPLE

[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 = re.search(r” Software”,text)
In [195]: out
Out[195]: <_sre.SRE_Match object; span=(9, 18), Continue reading

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 EXAMPLE   Match()-return a match object when pattern is found at the […]
1 2 3