Ping is used to check the network connectivity with destination IP. when we type ping 192.168.5.10[destination Network], that particular router
checks that IP on routing table to reach and sends ICMP packets. In ICMP(Internet Control Message Protocol) packets the type is echo request.
Default ping is of 100 byteswhere 20 bytes is of ip header and 8 bytes is of ICMP header and rest 72 bytes is of data.
Ping usages l-3 protocol i.e ICMP, ICMP packeta are encapsulated with IP. icmp usages protocol number 1. Whenever a router will send ping for ICMP packet TTl(Time To Live) will be 255 in that packet and in every hop it will be decreased. By default router will send 5 ICMP packets size of every ICMP packet will be 100 bytes.
Round Trip Timer : It is the time taken by ICMP packet to reach destination and come back
When ever traceroute command is run it sends UDp packet encapsulated with IP header. first time default TTL will be 1. It will send 3 packet with
TTL 1, which will get first next hop address.
When R1 sends UDP with TTl 1, R2 receive the packet with TTL 0an dit will reply R1 TTl dead/Exceed and next hop address will received.
Next time it will send another 3 packet with TTL 2 and receives next hop address and this process is followed till destination is reached.
when router has destination route then in destination router it will send reply with port unreachable.
When there is destination route in router, it will look for L-3 and upper data inside packet and it will see UDP port number but there is no service running on that port number so it will reply with port unreachable then router knows the destination hop and it will stop sending packets.
For Traceroute 30 ports are reserved from 33434 to 33464
So, it ca only support for 30 hops.
Note: Want to stop traceroute? Try CLTR+shift+6+X