ARP – Address Resolution Protocol

December 9, 2016 Leave a comment

When ever Network Engineer thinks  of ARP , first thing which comes in his mind is MAC address and layer 2.

MAC  Address is unique identity provided to NIC card for communication at layer 2. It’s also sometime referred as Burned-in-address or hardware Address.

Every network engineer should have good understanding of ARP. ARP is used to map  IP address to MAC-address used by data link protocol.

How ARP works , we will take a simple scenario to explain the concept of ARP

 

1

PC1 (IP 192.168.1.10) wants to communicate with PC2 (192.168.2.10).

Lets first have a look at ARP header to have clear understanding of ARP fields.

2.png

Hardware type is of 2 byte which is network protocol type: in this case , it’s Ethernet which is 1.

Protocol type field is the internetwork protocol for which the ARP request is intended. In this case it’s IP, this has the value 0x0800.

Hardware Address length indicates length of hardware address, in this case Its Ethernet so hardware size is 6 bytes.

Protocol Address length indicates length of protocol address, In this case, its IP so protocol address length is 4 bytes.

Opcode is operation code that the sender is performing: 1 for request, 2 for reply, 3 and 4 in case of RARP(reverse ARP)

Sender protocol and Target protocol address is source and destination IP address.

Source hardware and Target hardware address is source Mac-Address and Destination Mac- address.

Initially, there is no ARP entry present on either of the PC, means that neither of the PC  or R1 is having any information of destination MAC address which is necessary for each other communication.

ARP entry of PC1 ,PC2 and R1 at initial phase

PC1

3

PC2

4.png

R1

61.PNG5.png

 

Now lets  initiate a ping request to PC2 from PC1 , as PC1  does not know the MAC address of router so , so first frame is broadcast asking  Who has 192.168.1.1 ? Tell 192.168.1.10 (PC1) . If you sees the first ping packet , its generally dropped ,it’s because of same reason.

6.png

Let’s have a look at detailed ARP capture

PC1 – Broadcast Frame

7

In this capture , we can see that ARP packet with Opcode =1(request) , with sender MAC, target MAC and Sender IP address, but as PC 1 is not aware of Target MAC address, so it puts broadcast address (ff:ff:ff:ff:ff:ff) for Target Mac address and broadcast the frame.

First frame is broadcast asking  Who has 192.168.1.1 ? Tell 192.168.1.10

Router R1 configured with the IP address 192.168.1.1 sends a reply which is unicast to source PC1 . Let’s have a look of the ARP capture for unicast frame

PC1 – Unicast Frame

8.png

Above ARP frame  capture is having Opcode as 2  i.e reply. The sender IP is now 192.168.1.1 (R1 ) and destination IP is 192.168.1.10 (PC1) ,accordingly R1 unicast the frame with source MAC  of itself and destination MAC of PC1.

R1 also saves the source MAC address in its ARP cache.

Thus overall process makes PC1 aware of the destination MAC of gateway IP (R1)

 

Similarly same processs is done at PC2 end to get the IP address resolve to MaC address. ARP  request is broadcast from PC2 for destination Mac address of 10.10.2.1 and unicast packet with required details is received from R1 .

Below is Wireshark capture for PC2 for ARP frame (for broadcast and unicast ) for reference.

PC2 – Broadcast Frame

9.png

PC2- Unicast Frame

10.png

Thus  PC1 and PC2 are now  aware of the respective gateway hardware address. R1 now being too aware of PC1 and PC2 MAC address thus makes communication possible between PC1 and PC2

 

ARP entry of PC1 ,PC2 and R1 after successful ping.

12.png

13.png

14.png

 

Hope this post have cleared your any doubts regarding ARP  🙂 .comments are Welcome !!!

==========================================================================

Be updated about the Telecom news and new Technology .

Like : https://www.facebook.com/crazyrouters/?hc_ref=PAGES_TIMELINE&fref=nf

Python Loops – Basics

December 7, 2016 Leave a comment

 

The if, while and for statements implement traditional control flow and provide the output depending upon the condition.

 

IF /ELSE

 

An if statement consists of a  condition followed by one or more statements.An if statement can be followed by an optional else statement.

Else statments is used with for loop to give the result when loop has exhausted  iterating the list.

If else stament is used with a while loop,the else  statment is executed when the condition becomes false.

CODE:

if

 

OUTPUT:

if_out

 

While Loop

It’s an indefinite loop which keep iterating until some condition is met. There is no                guarantee regarding how many times the loop will go round .

While <condition >

<Body>

 

while1

CODE :

while

OUTPUT :

whileoutput

Good use of indefinite loop is to have interactive loop. This loop help us to go through file data.We will have program using all the above mentioned terms in future posts

 

For Loop

Its iterate over the items of any sequence as a list or string.

for-loop

 

CODE:

for

OUTPUT:

for_output

Use of range with for loop 

CODE:

for1

 

OUTPUT

for1_output.png

 

Get Trained on the AWS Cloud

December 2, 2016 Leave a comment

Get Trained on the AWS Cloud

AWSome Day Online Conference is a free, online training event that will provide a step-by-step introduction to the core AWS services for compute, storage, database and networking. AWS technical experts will explain key features and use cases, share best practices, walk through technical demos, and be available to answer your questions one-on-one.

Based on the AWS Essentials Course, AWSome Day is ideal for IT managers, business leaders, system engineers, system administrators, developers and architects who are eager to learn more about cloud computing and how to get started on the AWS Cloud.

Why you should attend:

 

  • Gain a deeper understanding of AWS core and application services
  • Learn how to deploy and automate your infrastructure on the AWS Cloud
  • Get your questions answered by our AWS experts
  • Receive a Certificate of Attendance when you complete the all modules

Register on below mentioned link:

https://aws.amazon.com/events/awsome-day/awsome-day-online/

 

Date: 6 December 2016
Time: 10am – 1.30pm IST
Location: Online

Categories: Cloud, Uncategorized Tags: , , ,

Python Basics – Part 2 cont…

November 30, 2016 Leave a comment

4.Tuples

A tuple is similar to a list. The difference between the two is that we cannot change the elements of a tuple once it is assigned whereas in a list, elements can be changed. A tuple is created by placing all the items (elements) inside a parentheses ()

  • We generally use tuple for different datatypes and list for homogeneous similar datatypes.
  • Since tuple are immutable, means value can not be changed.
  • Tuples that contain immutable elements can be used as key for a dictionary. With list, this is not possible.
  • If you have data that doesn’t change, implementing it as tuple will guarantee that it remains write-protected.

Empty tuples are constructed by an empty pair of parentheses; a tuple with one item is constructed by following a value with a comma (it is not sufficient to enclose a single value in parentheses)

CODE:

tuple1

OUTPUT:

tuple1out

 

 

5 .Dictionary

Python dictionary is an unordered set of key:value pairs , with the requirement that the keys are unique (within one dictionary). A pair of braces creates an empty dictionary: {}.Dictionary have no concept of order among elements.

Keys are unique within a dictionary while values may not be.The values of dictionary can be any type ,but the keys must be of an immutable such as strings,numbers or tuples.

CODE:

dict.PNG

 

OUTPUT:

dictout

Python Basics – Part 1

November 27, 2016 Leave a comment

Let’s start with Python basics, with the help of program .Theory part in posts is just enough to understand the program.

Python Data Type:

  • Numbers
  • Strings
  • List
  • Tuple
  • Dictionary
  1. Numbers :  
    1.  Int                  1 ,10,-145, 22
    2. Float               1.1,0.9,-29.9
    3. Complex        1.4j, 4e+6j
  1. Strings

Way to remember how slices work in string  is to think of the indices as pointing between characters, with the left edge of the first character numbered 0. Then the right edge of the last character of a string of n characters has index n, for example:

“Crazyouters ”  represented in indices form

0 1 2 3 4 5 6 7 8 9 10 11
C r a z y r o u t e r s
-11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0

Program Code : Str.py

str.PNG

Output

str_out

 

There are special operators in strings

Program Code : str1.py

str1

Output

str1out

 

3. List

The list is a most versatile datatype available in Python which can be written as a list of comma-separated values (items) between square brackets. Important thing about a list is that items in a list need not be of the same type. Unlike string  ,List is mutable type means its content can be changed.

Program Code : list.py

list1

output :

list1out.png

 

 

 

Categories: Uncategorized

Python – Must for Network Engineer

November 27, 2016 Leave a comment

Automation is need of Time.We as network engineers have to go with automation to simplify major chunk of the work done by us.We can not escape from automation.I will be having series of Python posts starting from basics.I  will try to put all  learning  in post in most easiest way.

Let’s start with Basics.What is Python ? As per Wiki ,Python is a widely used high-level, general-purpose, interpreted, dynamic programming language.

In layman terms , it’s one of the coding  language much simpler, easy to understand and most importantly reduces number of code lines in C++ to fewer lines.

It was created by Guido van Rossum during 1985-1990.

Installation:

Note:We will be doing coding in Python 3.

Windows:  can be installed from Site :http://www.python.org

Linux: run below mentioned  command

$ sudo apt-get install python 3.5

1

Categories: Python, Uncategorized

Failover Mechanism Part- 3

April 17, 2016 Leave a comment

How should Fail over need to be implemented if CPE router is common for
primary and secondary link ? Answer for the same can be found in this post.
This scenario may be refer as DPDLSC (DUAL POP DUAL LAST MILE SINGLE CPE)
Just to mention that traffic control is being done from CPE,ISP is very
much transparent and is not influencing traffic in this scenario.

 

failover mechanism3

 

Considering the above Topology.

FAILOVER MECHANISM —-
1. Outgoing Traffic from CPE is controlled using Local Preference (Higher local Preference, better path)
2. Incoming Traffic to CE is controlled using As Path Prepend ( lower as path count , better path)

 

NORMAL SCENERIO
Primary link is up ,Local preference is high for primary link than secondry and also there is no as-prepend as in secondry

OUTGOING TRAFFIC >>> LAN>CPE>PE1
INCOMING TRAFFIC >>> PE1>CPE>LAN

PRIMARY WAN LINK DOWN(PE1-CPE link down)
OUTGOING TRAFFIC  >>> LAN>CPE>PE2
INCOMING TRAFFIC >>> PE2>CPE>LAN

RELATED CPE CONFIGURATION

router bgp 64520
bgp log-neighbor-changes
network 10.0.0.0 mask 255.255.0.0
neighbor 172.10.1.1 remote-as 9730
neighbor 172.10.1.1 description PRIMARTY
neighbor 172.10.2.1 remote-as 9730
neighbor 172.10.2.1 description SECONDRY
neighbor 172.10.1.1 activate
neighbor 172.10.1.1 allowas-in 10
neighbor 172.10.1.1 soft-reconfiguration inbound
neighbor 172.10.2.1 activate
neighbor 172.10.2.1 allowas-in 10
neighbor 172.10.2.1 route-map SECONDARY in
neighbor 172.10.2.1 route-map ASPATH out
no auto-summary
no synchronization

exit-address-family
!
route-map SECONDARY permit 10
set local-preference 50

route-map SECONDARY-ASPATH permit 40
set as-path prepend 64520 64520 64520 64520 64520 64520 64520

%d bloggers like this: