**[&laquo; Back to the main CSCI1680 website](https://cs.brown.edu/courses/csci1680/f22/)** # Homework 3 **Due Monday, October 31, 2022 at 11:59PM EST** ## Meta-note - You are welcome (and encouraged!) to collaborate with your peers, though the answers you write down must be your own - When you are done, please upload a PDF of your work to [Gradescope](https://www.gradescope.com/courses/437277) under the assignment labeled "Homework 3". If you have issues accessing Gradescope, please contact the course staff ## Problem 1: FTP vs NAT Network Address Translation (NAT) allows multiple clients in a private network to share a single public IP address (on the NAT gateway). Suppose a router performing NAT with public address `205.10.2.5` is operating on behalf of the nodes in your home, which are part of the internal network `192.168.100.0/24`. ### Part A When a client with address `192.168.100.2` sends a TCP packet to an outside server at `134.21.4.10` (as shown in the table below), **how does NAT modify the packet**? To express your answer, fill in the table with the translated version of the packet header and explain your reasoning below. When writing the packet fields, be as specific as you can—if there are multiple options for certain fields, just choose an arbitrary value. Original packet (before NAT): | | Source | Destination | | -------- | ----------- | ----------- | | IP | 192.168.100.2 | 134.21.4.10 | | TCP Port | 5555 | 20 | After NAT: | | Source | Destination | | -------- | ------ | ----------- | | IP | | | | TCP Port | | | ### Part B What information does the router need to keep internally in order to properly translate and forward the server’s response? Assume that the response packet has the same IPs and ports as the server receives, with the roles of source and destination reversed. You don’t need to precisely describe what data structures the router is using—just specify what information it will need to store to forward the response. ### Part C FTP (File Transfer Protocol) is a protocol that runs on top of TCP, and needs two parallel connections: one for commands, and one for data. The relevant parts of the protocol work as follows: * First, a client opens an FTP control connection to a server on port `20`. * Then, the client sends a `PORT` command to the server, which includes the client’s IP address (**as known by the client**) and the port the client is listening on (say, port `7000`). * The server then opens a data connection to the client on that IP and port. In our example, the client would open a connection to `134.21.4.10` on port `20` and would send a command `PORT 192.168.100.2,7000` to the server. Since our client is behind a NAT gateway, the data connection does not work. **Why not?** ### Part D Suppose the FTP client is smart and is able to determine NAT’s outside IP address. Thus, it instead sends the command `PORT 205.10.2.5, 7000` to the server, but this still does not work. **Why not?** ### Part E Based on its description in this problem, why does FTP’s `PORT` command violate good principles of layering in network protocols? ### **Bonus** If you can change the router’s NAT implementation (including understanding the FTP protocol and potentially modifying the the FTP messages), how could you make the data connection work? ## Problem 2: Distance Vector Consider the following topology in a distance vector routing protocol, such as RIP, that **does not** use poison reverse or split horizon. ![](https://hackmd.io/_uploads/HJR3f8-Vj.png) ### Part a **Suppose the A-B link is disconnected.** Describe a sequence of events (eg. A announces a distance of X, B adds route for A with cost X+1, etc.) that leads to a count-to-infinity scenario. ### Part b In this topology, does using split horizon (ie, when you don't advertise routes learned from some neighbor router X back to X) prevent count to infinity to happening? Why or why not? ### Part c Why **can't** count-to-infinity happen in a link state routing protocol? ### Part d Why **can't** count-to-infinity happen in a path vector protocol (like BGP)? ## Problem 3: BGP - AS relationships and Gao-Rexford principles Consider the figure below, where nodes represent ASes and arrows represent customer-provider AS relationships. Note that the arrows do not constrain the direction of traffic--they only relate to the BGP announcements! ![](https://hackmd.io/_uploads/rkcThPlEo.png) For this problem, assume that ASes follow the Gao-Rexford model we discussed in class, and that ASes A and B eventually learn all of the advertisments that the other one makes via their respective providers. ### Part a What is the largest prefix that A can advertise to its providers, given that it has two customers X and Y, with prefixes as shown in the figure? ### Part b **True or False**: If B and A decide to become peers, B will start advertising Y's prefix. **Explain your reasoning.** ### Part c If X decides to also become a customer of B (creating the dashed line in the figure), what new prefix will B advertise to its providers? ### Part d Normally, X receives BGP announcements about Y from A, which allows nodes in X to know how to reach nodes in Y. If X becomes a customer of B (ie, when the dashed line is created), **does B receive a route to reach Y via X?** **Why or why not?** ### Part e Say the administrators of X were considering becoming a customer of B, but then decided not to do so (ie, no dashed line). B's administrators get mad and advertise X's prefix anyway, even though they have no link to X. **What happens to traffic sent to or from X?** <!-- ## Problem 4: Thinking about sockets The table below lists several packets as received by a single host, with one packet listed on each line. For each packet, --> <!-- ## Problem 2: BGP - Gao-Rexford Principles Consider the Gao-Rexford model of BGP route propagation. In the following graph, nodes represent ASes, directed edges go from customers to providers, and bidirectional edges represent peering relationships. For example, node A is a customer of node X, and node Y peers with node Z. ![](https://hackmd.io/_uploads/S1I8oW8Qo.png) Hosts in A are upset: they cannot communicate with any hosts in C. ### Part A Why not? In the current topology, who would be in a disadvantage if this communication were to happen, and how so? ### Part B List **four distinct** modifications to the graph (changing the type or direction of edges, adding or removing edges) that would allow nodes at A, B, and C to all talk to each other (e.g., have AS *i* become a customer of AS *j*, etc). In other words, list 4 alternative topologies where nodes in A, B, and C could all mutually communicate. ## Problem 3: Split Horizon and Poison Reverse ## Problem 4: ? -->