220 likes | 327 Views
PA3: Router. Junxian (Jim) Huang hjx@eecs.umich.edu EECS 489 W11 http://www.eecs.umich.edu/courses/eecs489/w11/. Building your own Internet Router. Recap lectures … What is router? What does router do?. Goal of PA3.
E N D
PA3: Router Junxian (Jim) Huang hjx@eecs.umich.edu EECS 489 W11 http://www.eecs.umich.edu/courses/eecs489/w11/
Building your own Internet Router • Recap lectures … • What is router? • What does router do?
Goal of PA3 • Implement a fully functional Internet router that routes real network traffic • Hands-on experience on how a router really works • Your router will run as a user process locally • Route real packets flowing across the Internet to application servers at Stanford • A skeleton, incomplete router (the “sr” or simple router) is given to complete • Demonstrate that it works by • traceroutes, pings and downloading some files from a web server via your router
Overview of the Virtual Network System (VNS) • VNS server • @ Stanford • VNS clients • Your router is one
VNS Server • A user level process @ Stanford • Host machine connected to two applications servers via a hub • Simulates a network topology (multiple links and VNS Clients) • Application servers sit on the other side of the network topology
Routing Table • Router finds the "most specific match” • The network with the longest subnet mask that matches the destination IP address wins • 0.0.0.0/0 default route • A route lookup that doesn't match anything will naturally fall back onto this route
VNS Server Example • A client connects to the server via a normal TCP socket • The client requests the traffic seen on links in the topology • The server accepts the request and sends the traffic on the link to the client over the TCP socket • The client would then inspect the packet, determine where the next hop in the network and send the packet back to the server • The server inject the packet back into the network. • The VNS Server can handle multiple (2^16) topologies simultaneously • Each student have his or her own topology to connect to and route over • The VNS Server ensures that clients are only sent traffic belonging to their topology.
VNS Client: Step by Step • Nick runs his router from his laptop
VNS Client: Step by Step 1 • Nick opens his browser and type in the IP of the application server of his topology XXX • A SYN packet leaves Nick’s machine destined to the web server’s IP and is routed to the VNS server • Server decides to deliver the packet to topology XXX, starting with the IP address of eth0 on Nick’s client • The hop before Nick’s router sends an ARP packet requesting the hardware address of the interface with IP of eth0 on Nick’s client
VNS Client: Step by Step 2 • The VNS Server sends the raw Ethernet, ARP packet over the socket to Nick’s VNS Client which responds with an ARP reply • On receipt of the ARP reply, the hop before Nick’s router, then forwards the packet to the Nick’s router • The VNS Server intercepts the packet and sends the raw Ethernet IP packet over the socket to Nick’s VNS Client for his to route • Nick’s router decrements the TTL field in the IP header and recalculates the checksum • Nick’s router consults its routing table and determines the next hop is the IP for the web server
VNS Client: Step by Step 3 • When Nick’s router has made its routing decision, it must send back to the VNS Server a properly formatted Ethernet packet • This means that the client must find the Ethernet address of the next hop • To do this, the client sends an ARP, in the usual way, to find out the Ethernet address belonging to the next hop IP address • The next hop, which could be another client or an application server, responds to the ARP, and Nick’s client completes the Ethernet packet and sends it back to the VNS server. (The client also caches the ARP reply for future use) • The VNS Server sends the packet out of the correct interface, and to the next hop in the topology • .…. etc.
Required Functionality • Route packets between the firewall and the application servers • Handle ARP requests and replies • Handles traceroutes through it and to it • Responds to ICMP echo requests • Handles TCP/UDP packets sent to one of its interfaces (ICMP port unreachable) • Maintains an ARP cache whose entries are invalidated after a timeout period
Required Functionality • The router queues all packets waiting for outstanding ARP replies • If a host does not respond to 5 ARP requests, the queued packet is dropped and an ICMP host unreachable message is sent back to the source of the queued packet • The router does not needlessly drop packets • E.g. when waiting for an ARP reply • The router enforces guarantees on timeouts • If an ARP request is not responded to within a fixed period of time, the ICMP host unreachable message is generated even if no more packets arrive at the router
What to Submit? • The source code for your router. You may add files to those provided with the stub code; be sure to update your Makefile if you do • Your README file describing design decisions that you made, and any trade offs that you encountered in the design.