CS 53600 wireless router project
- Run
make cleanto clear object files and executable - Run
maketo create object files and executables - Run
./router(as root) orsudo ./router
- Connects to the Internet (e.g., to an ISP’s modem)
- Also acts as a Wi-Fi access point and offers Internet service to one or more hosts
- Assigns an IP address to each via DHCP --> DONE
- Forwards packets between Wi-Fi hosts and the Internet
- Handles ICMP (ping) --> DONE
- Handles UDP
- Handles TCP
- Performs NAPT translation before forwarding a packet
- When the router starts, it will receive the IP address of a default router from the ISP
- Using threads allows easy access to shared variables (e.g., the NAT translation table)
- Start with DHCP using a normal socket and the normal stack; if you decide to write your own IP/UDP modules, you can switch to the raw socket later
- You will need to figure out how to assign IP addresses
- The ISP will already use a non-routable address
- You must decide whether a Wi-Fi host can ping the ISP router (in this case, your laptop)
- Remember that changing header fields mandates recomputing checksums
- You need to obtain the IP and Ethernet address of the MyRouter VM on the NAT interface
- If you decide to use the normal stack on the Wi-Fi interface (as opposed to doing all protocols via a raw socket), you must set the interface to "UP" and assign an IP address
- NAT box
- We plan to have 2 hash tables, one to hash the internal IP address and port (expressed as a concatenated string) to the index of the combined entry, and the other hashes the external port to the index of the combined entry
- We plan to use a rolling hash function to hash a string to an integer index. Additionally, our hash table uses chaining for collision handling.
- The thread labeled “outgoing NAT" repeatedly
- Reads the next packet from a Wi-Fi host
- Ignores any packet sent to the router itself
- Performs NAPT translation for a TCP/UDP/ICMP packet
- Recompute checksums for IP header, TCP/UDP headers (new port nums, pseudo-header)
- Sends the translated packet out the raw socket to the default router
- The thread labeled “incoming NAT” repeatedly
- Reads the next packet from the Internet
- Ignores any packet that does not match NAT table entries
- Performs NAPT translation on a TCP/UDP.ICMP packet
- Recompute checksums for IP header, TCP/UDP headers (new port nums, pseudo-header)
- Sends the translated packet to the correct Wi-Fi host
- Recompute checksums (on UDP and TCP packets)
- We plan to have 2 hash tables, one to hash the internal IP address and port (expressed as a concatenated string) to the index of the combined entry, and the other hashes the external port to the index of the combined entry
- DHCP Server
- Assign IP addresses to new hosts
- Idea: for the current network, assign 192.168.1.x (leaving the other network to be 192.168.0.x)
- Management Application
- Be able to perform the following
- Dump the NAT table on the router
- TBC
- Be able to perform the following
- Leases are defined when DHCP_REQUEST packets are received.
- Existing leases are checked and cleaned out when expired only when DHCP_REQUEST packets are received because that is the only time a lease matters.
- When a DHCP_REQUEST is received, if a MAC to IP mapping exists already, the lease is renewed. This is renewed regardless of whether the lease is expired or not.