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:
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!):
You may make the following simplifying assumptions:
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_solutionOR
./router/sr
This assignment is worth seven points.
./sr -l logname.pcap
mininet> server1 sudo tcpdump -n -i server1-eth0or you can bring up a terminal inside server1 with:
mininet> xterm server1and then run whatever you like (e.g., wireshark) inside the newly popped-up xterm.
print_hdrs(uint8_t *buf, uint32_t length)- Prints out all possible headers starting from the Ethernet header in the packet.
print_addr_ip_int(uint32_t ip)- Prints out a formatted IP address from a uint32_t. Make sure you are passing the IP address in the correct byte ordering.
If you have any questions about the lab requirements or specification, please post on Piazza.
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.