PA3: Router

22
PA3: Router Junxian (Jim) Huang [email protected] EECS 489 W11 http://www.eecs.umich.edu/courses/ eecs489/w11/

description

PA3: Router. Junxian (Jim) Huang [email protected] 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. - PowerPoint PPT Presentation

Transcript of PA3: Router

Page 1: PA3: Router

PA3: Router

Junxian (Jim) [email protected]

EECS 489 W11

http://www.eecs.umich.edu/courses/eecs489/w11/

Page 2: PA3: Router

Building your own Internet Router

• Recap lectures …– What is router?– What does router do?

Page 3: PA3: Router
Page 4: PA3: Router
Page 5: PA3: Router
Page 6: PA3: Router
Page 7: PA3: Router
Page 8: PA3: Router

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

Page 9: PA3: Router

Overview of the Virtual Network System (VNS)

• VNS server– @ Stanford

• VNS clients– Your router is one

Page 10: PA3: Router

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

Page 11: PA3: Router

VNS Server example: 1 router + 1 server

Page 12: PA3: Router

A Unique Topology You Will Get

Page 13: PA3: Router

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

Page 14: PA3: Router

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.

Page 15: PA3: Router

VNS Client

Page 16: PA3: Router

VNS Client: Step by Step• Nick runs his router from his laptop

Page 17: PA3: Router

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

Page 18: PA3: Router

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

Page 19: PA3: Router

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.

Page 20: PA3: Router

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

Page 21: PA3: Router

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

Page 22: PA3: 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.