cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
11388
Views
23
Helpful
7
Replies

How ping works in each layer

srikanth ath
Level 4
Level 4

Hi,

In a given below situation can someone say me how exactly ping goes from each layer to reach HostB from HostA

.

From hostA to HostB ping is working fine but how the packets are moved at each level.

HostA<PC>-------------Switch<L2>--------------RouterA<---------------------->RouterB---------------------------Switch<L2>---------------HostB<PC>

Thanks in advance

Regards,

Srikanth

7 Replies 7

acampbell
VIP Alumni
VIP Alumni

Srikanth

May be this will help

http://www.cisco.com/en/US/products/sw/iosswrel/ps1831/products_tech_note09186a00800a6057.shtml

Regards,
Alex.
Please rate useful posts.

Regards, Alex. Please rate useful posts.

cadet alain
VIP Alumni
VIP Alumni

Hi,

1) on Host A:

- first PC must know if destination is in same network as it is and to do so it will perform a logil bitwise AND between it IP address and its subnet mask, it will do the same between the destination IP and its subnet mask and will compare both results.

- if  the destination is in same subnet then  will send an arp request for the MAC address of the Host B and will cache the result.

- if they are on different subnet( which is the case here) then it will send an ARP request for the MAC address of its default-gateway( which should be RouterA) and cache the result.

-With this info it will construct a L2 frame in which it will encapsulate the IP packet( which contains the upper protocol and payload)

2) on SWITCH1:

- it looks at source MAC and ingress port and inputs the mapping into its CAM table

- it looks for an entry for Router A MAC address and if it finds one it will forward the frame untouched out the corresponding port

- if it has no entry for routerA then it will flood out the frame out each port except the one it was received on that are in the same vlan

3) on Router A:

- it will receive a frame destined for its mac address and for its ip address so it will accept it and look for the dst ip inside the header

- it will search for a longest match in its routing table and once it has one  it will forward the frame out the appropriate interface( rewriting the L2  src MAC as its outgoing interface MAC( if it's an ethernet)

4) from router A to router B:

  same as 3

5) from router B to switch 2:

  same as 3

6) from switch2 to PC B:

   same as 2

Now host B replies and the process is the same in the inverse path

Regards.

Alain

Don't forget to rate helpful posts.

Don't forget to rate helpful posts.

To add, if I may, to the OP question....

on the OSI model, is ping a layer 4 feature or layer 7 feature, or layer 3?


When I think of ping.exe, its an exe file so its an exectablae so I would figure its Layer 7.

Thank you

Hi,

ICMP is  a Layer 3 protocol.

Regards.

Alain

Don't forget to rate helpful posts.

Don't forget to rate helpful posts.

So when we say 'ping' that command is irrelevant, we could rename this command to be say, leolaohoo.exe....lol, but the command even though its a .exe in windows, uses ICMP which is layer 3.

I guess what confuses me is telnet, this is a layer 7 application.  What differentiates ping vs. telnet since to me both are exe files in windows. 

Thank you again, 

Hi,

yes ping.exe is an application but which uses icmp protocol which is a L3 protocol vs telnet.exe which is using tcp as transport.

Regards.

Alain

Don't forget to rate helpful posts.

Don't forget to rate helpful posts.

That mades sense, thank you.

Review Cisco Networking products for a $25 gift card