A little networking

Upload via Moodle as: networking.pdf or .md or .txt

Goals

Rubric

0.5 points per super-easy question 1 point per question otherwise Total: 15 points

 

The questions

Keep your answers short, write them up, and submit them as described at the top of this page. Really truly, short and simple is sufficient!

  1. Vocabulary. For each of the following terms, give a short definition of no more than 12 words.

    1. client
    2. server
    3. protocol
    4. TCP connection
    5. port
    6. well-known port
  2. Common clients, servers, and protocols.

    1. List three clients that you use regularly (for different services).
    2. For each of those clients, name one protocol it supports.
    3. Name one server (the software, not the domain name) that supports the HTTP and HTTPS protocols. (Such servers are typically called "web servers".)
  3. Simple client/server example. The daytime protocol is about as simple as internet protocols get. (1) The client establishes a TCP connection with the daytime server; (2) the server sends a string representing the current date and time back to the client; and (3) the server closes the connection.

    Try it, like so.

    • Either install nc on your own computer or login to mantis, where nc is already installed.
    • Pick an IP address from this list of daytime servers.
    • Execute the command nc IP_OF_DAYTIME_SERVER DAYTIME_PORT (where you need to fill in the two command-line arguments in question).

    Answer these questions.

    1. What is the well-known port for the daytime protocol?
    2. In the exercise described above, what software acts as the client?
  4. Using nc as both client and server.

    • On whichever computer you're working with nc (your own or mantis), open two terminals.
    • In one terminal, pick a port number between 8000 and 65000, and execute nc -l -p YOUR_PORT. Note for macOS: The syntax on macOS is different: nc -l YOUR_PORT (oh Apple, sometimes you're so annoying!).
    • In the other terminal, execute nc localhost YOUR_PORT.
    • Type something in each terminal and hit Enter.
    • When you're done playing around, hit Ctrl-C in both terminals.

    Questions:

    1. What does the -l stand for in the first nc command?
    2. Which of the two nc commands is acting as the server, and which is acting as the client, and how can you tell?
    3. What IP address does localhost correspond to?
    4. If you replace "localhost" with that IP address in the exercise above, does it still work?
  5. Talking to a web server, part 1

    1. Execute curl https://jeffondich.com/. What do you see? (a summary is sufficient)
    2. Execute curl -v https://jeffondich.com/. You get some more stuff in addition to what you saw before. Summarize the new stuff.
    3. In the previous question, you saw a "200" in the output. What is the role of that 200?
    4. Execute curl -v http://jeffondich.com/. What do you get now, and why?
    5. Execute curl -v https://jeffondich.com/blahblahblah. What do you get now, and why?
  6. Talking to a web server, part 2

    1. Execute nc cs208.jeffondich.com 80. What do you see?
    2. Now (assuming the previous command is still running), type the following:
      GET / HTTP/1.1 Host: cs208.jeffondich.com

      NOTE: you need that blank line after the "Host" line.

      What do you see now?

    3. What do you see if you do the same thing, but this time you do /moose.html instead of just / in the GET line?
    4. What does a browser do differently from curl to make sure you see a picture of a moose? (Though "curl is text-only" is one answer, I'm looking for a different answer, about a step that Firefox or Chrome or Safari would take that curl does not when visiting this web page.)

That's enough for now...

...but I encourage you to keep playing with this kind of thing. It's fun, and you can learn a lot!