Project 1: Setup

Operating System Installation

This project has been tested to work on Linux and Mac.

If you’re on Windows, we recommend using WSL.

Python Installation

This project has been tested to work on Python 3.11. (It probably works on newer versions of Python as well, but use at your own risk.)

If you run python3 --version or python --version in your terminal and you see output of the form Python 3.11.*, you’re all set.

Starter Code

Download a copy of the starter code here.

In your terminal, use cd to navigate to the cs168-fa24-proj1-traceroute directory. All of the Python commands should be run from this directory.

To check that your setup works, in your terminal, run:

sudo python3 traceroute.py cmu.edu

If you see something like this, everything should be set up correctly:

traceroute to cmu.edu (128.2.42.10)
 1: *
 2: *
 3: *
(some lines omitted...)
26: *
27: *
28: *
29: *
30: *

You should only edit traceroute.py. There are comments clearly indicating the places where you should fill in code.

Guidelines:

  • Don’t modify any other files.
  • Don’t add any new files.
  • Don’t add any imports.
  • Don’t edit any code outside the sections indicated by the comments.
  • Don’t add any hard-coded global variables.
  • Adding helper methods is fine (and encouraged).
  • In general, if we haven’t told you to use something, you probably don’t need it. Our goal is not to trick you!

New Spec

Note: This spec has been rewritten for Fall 2024 to be clearer and provide a few extra hints. It may contain bugs.

If you would like to work off the previous version of the spec, you can find it here.

Spec changelog:

  • [Aug 29] Guide: ICMP checksum is 16 bits, not 8 bits.
  • [Sep 2] Guide: The ICMP payload contains a copy of the header of the original packet (UDP-over-IPv4) that triggered the error. It does not contain a copy of the payload of the original UDP-over-IPv4 packet.
  • [Sep 2] Guide: Added suggested reference materials.
  • [Sep 2] Test B7, Irrelevant UDP Response: The “Port Unreachable” message is ICMP-over-IP. It is not UDP-over-IP.
  • [Sep 4] Stage 1, Manual Traceroute: As seen in the starter code, there’s a range of destination port numbers you can use, not just a single one.
  • [Sep 4] Test B16, Irrelevant TTL Response: Clarified what the previous traceroute probe was doing.
  • [Sep 4] Stage 1, Manual Traceroute: Clarified some weird router behavior with endianness.
  • [Sep 19] Test B13, Duplicate Responses: Added some tips.