Internet Knowledge Base | Affordable Web Hosting Plans | Cheap Domain Name Registration

Ping and Traceroute

This knowledge base discuss briefly about Ping and Traceroute. You can get more details by reading books with TCP / IP topic. Below just give you a brief idea:

PING BACKGROUND:

In the Internet's network, IP packets (information packets) pass through different Gateways, one by one, to the final destination.

In the NORMAL situation, all packets can go to the destination computer. However, when one of the Gateways DO NOT work normally (e.g. turn off, problem of routing table, or traffic jam) then the packets cannot pass to the next Gateway.

Therefore this is VERY IMPORTANT that the Gateway can use some simple protocol to inform the sender that "I am NOT perform normally now!!" The protocol that use for this purpose is called ICMP (Internet Control Message Protocol).

HOW PING WORKS:

Ping is simply send out a ICMP's echo request packet. When a computer receives an ICMP echo request, it responds with an echo reply. For example

ping www.HostOnInternet.com

The above ping will have the result:

Pinging www.HostOnInternet.com [xx.xx.x.xx] with 32 bytes of data:

Reply from xx.xxx.x.xx: Bytes=32 time=60ms TTL=50

Note:

  1. xx.xx.xx.xx is IP address.
  2. The time (60ms) is round-trip time to get a packet to the destination computer. The time is measured in milliseconds.
  3. In general situation, the round-trip times should under 200 milliseconds.
  4. A large variance in the round-trip times showing that the network may be experiencing problems.
  5. TTL = Time To Live. The original number of TTL is set to 255. When the packet pass through a node, server, gateway or routers, the number of TTL will be decreased by 1, ie. 255, 254, 253.....100, 99......50. When the number of TTL = 0, then the packets will be discard by the last router. We usually call that the packet is lost! This is very important to discard the packets that are "wandering" on the Internet, otherwise the Internet will be jammed with "wandering" packets.

TRACEROUTE BACKGROUND:

As we know each computer has a unique IP address on the Internet. Actually, only using IP address CANNOT send the packets CORRECTLY to the destination computer. The situation is similar sending a letter (packet) to a company address (IP address). There are many staff working in the company. Who the letter will be send to?

Therefore, beside the address, the name of staff should also be included in the letter. In the computer term, the name of staff is called PORT. Therefore, the content of the packet is:

(IP address - Port number)

The protocol that use to send the letter to the correct staff is called UDP (User Datagram Protocol).

In summary: IP protocol send the packet to the destination computer. Then UDP protocol send the packets correctly to the application.

HOW TRACEROUTE WORKS:

  1. Traceroute will send a packet to an open UDP port on a destination computer.
  2. The TTL of the first three packets is set to 1.
  3. When the FIRST router receive the packets, the router will decrease the TTL by one. The router then discards the packet and sends an ICMP notification packet to the original host with the message that the TTL expired from the router. This tells traceroute what the first hop is and HOW LONG it takes to get there.
  4. The traceroute repeats again - with the TTL of the next three packets increased by one. Then the second router will discard the packets and tells traceroute what the first hop is and HOW LONG it takes to get there.
  5. The traceroute repeats again and again until the packets reach the final destination computer.

e.g.

tracert www.HostOnInternet.com

The above traceroute will have the result:

Tracing route to www.linux.org [198.182.196.56]
over a maximum of 30 hops:

1 10 ms 10 ms 10 ms router-1 [xxx.xxx.xx.xx]
2 <10 ms <10 ms <10 ms co-r12-01-atm0-0-10.mo.more.net [150.199.11.1]
3 <10 ms 10 ms <10 ms kc-r12-01-atm1-0-131.mo.more.net [150.199.7.198]

This is the end of Ping and Traceroute tutorial.

Internet knowledge base