50.005 Computer System Engineering
Information Systems Technology and Design
Singapore University of Technology and Design
Natalie Agus (Summer 2024)
Ping and Traceroute
In this lab exercise, you will learn how to use ping
and traceroute
programs to measure round trip times and find network routes.
Learning Objectives:
- Explain how ping and traceroute utilities work.
- Use the ping utility to measure network round trip times.
- Use the traceroute utility to find network routes.
- Observe and understand the effects of varying packet sizes on delays experienced.
You will need both ping and traceroute to be installed on your OS. Most Ubuntu or macOS installations should already include ping by default. You can install traceroute by running sudo apt install traceroute
from the command line.
RTT Measurement using ping
The ping
utility is one of the most widely-used network utilities. It enables you to measure the time that it takes for a packet to travel through the Internet to a remote host and back.
The ping
utility works by sending a short message, known as an echo request to a remote host using the Internet Control Message Protocol (ICMP).When a host that supports ICMP receives an echo-request message, it replies by sending an echo-response message back to the originating host.
In this first part of this lab exercise, you will use the ping
utility to send echo requests to a number of different hosts. In many of the exercises, you will be referring to hosts using their domain name rather than their IP addresses1. For more information about ping, you can look up its manual page by running man ping
from the command line.
The following info is relevant for the next few tasks:
ping netflix.com
is the easiest and simplest way to ping a server. It will continuously send packets and print out the response (if any). You may pressctrl+c
to terminate it.- It supports several options:
-c [no_of_packets]
: specify the number of packets that should be sent byping
before terminating (otherwise it will continue forever untilSIGINT
2 is sent byctrl+c
).-s [packet_size]
: set packet size. The default is 56.-i [seconds_interval]
: interval of ping packets sent to the destination
Round-Trip Time
The ping
utility can be used to measure the round-trip time (RTT).
Round-trip time (RTT) is the duration, measured in milliseconds, from when a browser sends a request to when it receives a response from a server.
RTT is one of the key performance metric for web applications.
Task 1
TASK 1:
Use ping
to send 10 packets (56 bytes each) to each of the following hosts, and there should be an interval of 5 seconds between each packet sent,
- www.csail.mit.edu
- www.berkeley.edu
- www.usyd.edu.au
- www.kyoto-u.ac.jp
The size of each packet is 56 bytes by default, but you may observe that the actual size of the packet is larger than 56 bytes. You can look up the manual for ping to understand why such a discrepancy exists.
Fill up the table below in edimension to key in your answer.
Website | Successfull % | Min RTT | Ave RTT | Max RTT |
---|---|---|---|---|
www.csail.mit.edu | ||||
www.berkeley.edu | ||||
www.usyd.edu.au | ||||
www.kyoto-u.ac.jp |
Also, go to this online ping test site and ping www.csail.mit.edu
Question
From whom do you receive replies? You can get the IP address and use the command
whois [ip_address]
Task 2
TASK 2:
Repeat the exercise from Task 1 using packet sizes of 512 and 1024 bytes. Record the minimum, average, and maximum round trip times for each of the packet sizes with a table like the previous task, and head to edimension to key in your answer.
Question
Why are the minimum round-trip times to the same hosts different when using 56, 512, and 1024–byte packets?
Unanswered pings
Task 3
TASK 3:
Use ping to send 100 packets to the following host: www.wits.ac.za
Each packet should have a size of 56 bytes, and there should be an interval of 5 seconds between each packet sent.
Record the percentage of the packets sent that resulted in a successful response for each host.
Question
What are some possible reasons why you may not have received a response? (Be sure to check the host in a web browser).
Traceroute
The traceroute
utility is another useful network utility. It enables you to trace the route taken by a packet from your machine to a remote host.
Note that if traceroute doesn’t work on your VM, you may:
- Add the
-I
option:traceroute -I [ip]
- Or, use results from
tracert
(assuming Windows is your host OS).
Here is an example of the output produced when traceroute is used to trace the route taken by a packet to www.mit.edu:
The first line of the traceroute output describes what the command is set for. It lists the destination system (e9566.dscb.akamaiedge.net), destination IP address (184.50.104.236), and the maximum number of hops that will be used in the traceroute (64).
The remainder of the output shows information on each hop, where each line is a reply from (typically) a router, in the path between the sender and the final destination.
It is important to note that the number of hops is not an important factor that affects latency.
Each of these lines begins with a host (e.g router) IP on the route from your computer to www.mit.edu, followed by the round-trip time (RTT) for 3 packets sent to that host.
For more information about traceroute
, you can look up its manual page by running man traceroute
from the command line.
Task 4
TASK 4:
Find out how traceroute
works. You will need this to answer several questions on eDimension.
Hint
traceroute
sends a UDP packet to the destination host’s (highly likely) unusable port, with increasing TTL. The routers that reduces the TTL to 0 will send an ICMP TTL Exceeded reply. The end host will send an ICMP Port unreachable reply.
Route Asymmetries
The route taken to send a packet from your machine to the remote host machine is not always the same with the route taken to send a packet from the remote machine back to you.
In this exercise, you will run traceroute in two opposite directions. First, you will run traceroute
on a remote host to see the route taken to your network. Then, you will also run traceroute
from your computer to see the route taken to that host.
Task 5
TASK 5:
Find out your computer’s public IP address. (Hint: You can use a website like this, or search for “what is my ip” using Google’s search engine.)
Task 6
TASK 6:
Visit this link using your web browser.
Then do the following:
- Enter your computer’s public IP address as shown in the site
- Enter the captcha code, then press enter to start a traceroute to your computer’s public IP
- Take a screenshot of the output
If the output shows that the packet does not reach your IP (request timed out), think about a reason or two on why this is so.
The school might block the website. You can utilise your phone hotspot instead. You’re free to use other similar sites that performs traceroute from their server to your computer’s public IP address. If you have two devices with different IPs (e.g: one uses VPN), then you can also traceroute each other’s IP addresses.
Task 7
TASK 7:
After traceroute
finishes running, you should be able to view the route taken from specified locations to your network.
Record the IP address of the first visible hop which will be used in the next step.
In the screenshot below, that will be 213.239.245.241
for example.
You can check who that remote host is using the command whois [ip address]
, for instance, 213.239.245.241
is indeed described as being in Germany (DE).
Task 8
TASK 8:
On your computer, run traceroute
using the IP address recorded in the previous step as the remote destination.
Question
Are the same routers traversed in both directions? If no, could you think of a reason why?
Summary
In this lab, we have explored two network utilities: ping and traceroute. This shall help you explain the effects of varying packet sizes on delays experienced.
-
A domain name is an easy-to-remember alias used to access websites. For example, we access netflix by typing netflix.com and not the actual netflix server’s public IP address. For more information, see here. ↩
-
In POSIX-compliant OS, the default action for
SIGINT
,SIGTERM
,SIGQUIT
, andSIGKILL
is to terminate the process. However,SIGTERM
,SIGQUIT
, andSIGKILL
are defined as signals to terminate the process, butSIGINT
is defined as an interruption requested by the user. ↩