CS 43 Lab 7: Building a Router

Due: Sunday, December 17, Noon


Handy references:


Lab Audio

For this lab, you will implement a fully functional Internet router that routes real network traffic. The goal is to give you hands-on experience as to how a router really works. Your router will receive raw Ethernet frames. It will process the packets just like a real router, then forward them to the correct outgoing interface. Your job is to create the forwarding logic so packets go to the correct interface.

Your router will route real packets from a emulated host (client) to two emulated application servers (HTTP servers 1 and 2) sitting behind your router, each on a different network. The application servers are each running an HTTP server. When you have finished the forwarding path of your router, you should be able to access these servers using regular client software. Additionally, you should be able to ping and traceroute to and through a functioning Internet router. The emulated topology is depicted below:

Topology

Requirements

You will be responsible for implementing important elements of several subsystems within the router. The majority of the code which makes the router work, including the routing tables, is provided for you. The functionality should be the same as the provided sr_solution. All code must be added to sr_router.c and sr_router.h. You are responsible for implementing (not necessarily in this order!):

The following functionality should behave correctly (as the provided sr_solution does) in your submission:
  1. Pinging from the client to any of the router's interfaces (192.168.2.1, 172.64.3.1, 10.0.1.1).

  2. Tracerouting from the client to any of the router's interfaces.

  3. Pinging from the client to both of the HTTP servers (192.168.2.2, 172.64.3.10).

  4. Tracerouting from the client to both of the HTTP servers.

  5. Downloading a file using HTTP from both of the servers.

You may make the following simplifying assumptions:

Environment

For this lab, we'll be using mininet again, only this time, our topology will be a bit more complex than before. To set up a mininet virtual machine, refer to the environment section of lab 5. Rather than running mn directly, this time we'll use some scripts to make launching it easier.

ssh -Y localhost -p 22222 -l mininet

Before you get started, you'll need to run a script that will prepare your environment and install a few packages:

./config.sh

You should only need to run config.sh once for your VM, but it won't hurt to execute it multiple times.

From there, you can launch mininet using another script:

./run_mininet.sh

Keep the mininet terminal open and running in the foreground (don't do ctrl-z). This should also pop-up a terminal for executing commands at the client (10.0.1.100 in the image above). In a second terminal window, execute the router code. I've provided a reference implementation named 'sr_solution', which you can execute now. You will, of course, eventually want to execute your own version, which will be named 'sr' (built from the 'router' directory).:

./sr_solution
OR
./router/sr

Grading Rubric

This assignment is worth seven points.

Tips

If you have any questions about the lab requirements or specification, please post on Piazza.

Submitting

Please remove any debugging output prior to submitting.

To submit your code, simply commit your changes locally using git add and git commit. Then run git push while in your lab directory.