Simple Router banner


Period: November 2017
Platform: Xcode
Languages: C++
Wrote a simple router with a simple routing table that receives raw Ethernet frames and processes them just like a real router would: forward them to the correct outgoing interface; create new frames; verify checksums, etc. The router runs on top of Mininet (built at Stanford), which allows for the emulation of a network topology on a single machine. This provides the needed isolation between the emulated nodes so that the router node can process and forward real Ethernet frames between the hosts like a real router.

There were three main components of this project: (1) Handle Ethernet frames -- reading of the Ethernet header in order to find the source and destination MAC addresses and properly dispatching the frame based on the protocol (i.e. Address Resolution Protocol (ARP) or Internet Protocol version 4 (IPv4)); (2) Handling ARP packets -- before the router can forward an IP packet to the next-hop specified in the routing table, it needs to first use ARP request/reply to discover a MAC address of the next-hop; and (3) Handling IPv4 packets -- for each IPv4 packet, the router does some validation (i.e. verifying checksum, and checking packet length); uses longest prefix match algorithm to find the next-hop IP address in the routing table and attempts to forward the packet there; and does some updates (i.e. decrementing TTL of the packet, and recomputing the checksum)

GitHub Source Code