This exercise uses command-line tools to investigate the physical and logical structure of the internet.
Use the Terminal app on Mac (Applications → Utilities → Terminal).
If you live off campus, try each command from both on-campus (via VPN or in class) and off-campus. The results will differ, and that difference is itself interesting.
* * *, this does not mean the route has failed, it means a router along the way is silently ignoring the probe. Section 2 below covers the TCP traceroute and web-based alternatives.
ping sends a small request to a host asking for a response ("are you there?"). It uses ICMP echo request/reply messages. It is commonly used to check if a host is reachable and to measure latency.
% ping www.mit.edu
Hit Control-C to stop. ping will print statistics when you quit.
% ping www.mit.edu
PING www.mit.edu (92.122.15.121): 56 data bytes
64 bytes from 92.122.15.121: icmp_seq=0 ttl=58 time=91.203 ms
64 bytes from 92.122.15.121: icmp_seq=1 ttl=58 time=88.417 ms
64 bytes from 92.122.15.121: icmp_seq=2 ttl=58 time=89.552 ms
^C
--- www.mit.edu ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 88.417/89.724/91.203/1.146 ms
For the man pages: % man ping
oregonstate.edu www.pdx.edu www.mit.edu www.sfc.keio.ac.jp www.nmmu.ac.za www.nast.gov.np cuni.cz www.uni-heidelberg.de www.unifiji.ac.fj www.amazon.com www.apple.comWhat do the differences in minimum round-trip time tell you about where these servers are physically located? Why might a server with a geographically close name have a surprisingly high latency?
traceroute shows each router ("hop") a packet passes through on its way to a destination. It works by sending packets with increasing TTL values and collecting the ICMP "time exceeded" messages sent back by routers along the way.
% traceroute www.mit.edu
You will likely see * * * at some point, this means a router is dropping the probe
without replying. That is normal and expected today.
% traceroute www.mit.edu traceroute to www.mit.edu (92.122.15.121), 64 hops max, 52 byte packets 1 router.local (10.0.0.1) 1.2 ms 1.1 ms 1.0 ms 2 isp-gateway (96.120.61.1) 9.4 ms 9.2 ms 9.1 ms 3 * * * 4 * * * ...Even partial results are informative. The first few hops show your local network; named hops often include geography in the hostname (eg. seattle.wa, san-jose).
-T flag for this, use tcptraceroute instead (requires sudo):
% sudo tcptraceroute www.mit.edu # requires: brew install tcptraceroute
TCP uses port 80, which servers must accept for ordinary web traffic, so it can get a reply from
the destination even when plain traceroute gets nothing back. This isn't hypothetical, here is a
real side-by-side run against amazon.com:
% traceroute www.amazon.com traceroute to e15316.dsca.akamaiedge.net (2.18.102.138), 64 hops max, 40 byte packets 1 10.0.0.1 (10.0.0.1) 13.893 ms 4.476 ms 4.232 ms ... 8 50.222.131.142 (50.222.131.142) 25.716 ms * 76.173 ms 9 * * * 10 * * * 11 * * * 12 *^C
% sudo tcptraceroute www.amazon.com Tracing the path to www.amazon.com (3.163.152.189) on TCP port 80 (http), 30 hops max 1 10.0.0.1 4.637 ms 5.521 ms 3.935 ms ... 7 be-36221-cs02.seattle.wa.ibone.comcast.net (68.86.93.53) 21.109 ms * * 8 be-2211-pe11.seattle.wa.ibone.comcast.net (96.110.32.230) 23.483 ms * 22.540 ms 9 * * * 10 * * * 11 * * * 12 * * * 13 * * * 14 server-3-163-152-189.sea90.r.cloudfront.net (3.163.152.189) [open] 20.288 ms 22.731 ms 25.910 ms
sudo tcptraceroute -m 64 hostname to rule out the hop limit, and try again in a few minutes, backbone routing hiccups like this are often transient.
* * * begin.
Using the hostname labels in the output, try to reconstruct the geographic path.
The tools above work directly on hostnames, so none of sections 1-3 require this. These two commands
let you dig deeper: dig resolves a hostname to the IP address(es) behind it, and
whois tells you who owns that IP range. Useful if you want to know exactly which
network or organization you're actually talking to.
dig (Domain Information Groper) queries the DNS system to find out what IP address
a hostname resolves to, and which servers are authoritative for that domain. Unlike traceroute,
dig is almost never blocked and gives reliable results.
% dig www.reed.edu
Look for the ANSWER SECTION, it shows the IP address the hostname resolves to.
% dig www.reed.edu
; <<>> DiG 9.10.6 <<>> www.reed.edu
;; ANSWER SECTION:
www.reed.edu. 300 IN A 134.10.2.252
;; Query time: 12 msec
;; SERVER: 134.10.8.8#53(134.10.8.8)
Try with a CDN-backed site to see multiple IPs returned:
% dig www.amazon.com
To see the full DNS chain (which servers are authoritative):
% dig +trace www.reed.edu
For the man pages: % man dig
dig www.amazon.com or dig www.google.com multiple times.
Do you always get the same IP address? What does it mean if you get different addresses each time?
(Hint: look up "content delivery network" or "anycast routing".)
whois looks up the organization registered to a domain name or IP address in public NIC (Network Information Center) databases.
% whois reed.edu
% whois 134.10.2.252
(Use the IP addresses you found with dig above.)