**[&laquo; Back to the main CSCI1680 website](https://cs.brown.edu/courses/csci1680/f22/)** # Homework 2 (Solutions) **Due Friday, October 14, 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 2". If you have issues accessing Gradescope, please contact the course staff ## Problem 1: Ethernet and MAC Learning ### Part a Sending frames on an Ethernet network is very convenient, as you don't have to configure anything. How do hosts get unique Ethernet addresses? <span style="text-format: bold; color: #ff0000;">Each node (or network interface) has a MAC address pre-programmed into the hardware at the factory. Thus, each node (or interface) has a MAC address without any prior configuration.</span> ### Part b Consider the following Ethernet network, consisting of 5 hosts (H1--H5) and two switches (S1 and S2): ![](https://hackmd.io/_uploads/r1vnGW5fo.png) Assume that both S1 and S2 start with empty MAC address tables. What happens to the tables after each of the following events? <ol style="list-style-type: lower-roman"> <li>H1 sends a packet to H4</li> <li>H5 sends a packet to H4</li> <li>H4 sends a packet to H5</li> </ol> After each event (i)-(iii) occurs, draw the MAC address tables for each of S1 and S2. If, after an event, no entries are added/updated, you may simply copy the table from the previous update. You can use tables like the examples below: S1's MAC address table i. |MAC address | Port | |------------| ---- | |<span style="text-format: bold; color: #ff0000;">H1</span>| <span style="text-format: bold; color: #ff0000;">p1</span>| |-|-| |-|-| ii. |MAC address | Port | |------------| ---- | |<span style="text-format: bold; color: #ff0000;">H1</span>| <span style="text-format: bold; color: #ff0000;">p1</span>| |<span style="text-format: bold; color: #ff0000;">H5</span>|<span style="text-format: bold; color: #ff0000;">p4</span>| |-|-| iii. |MAC address | Port | |------------| ---- | |<span style="text-format: bold; color: #ff0000;">H1</span>| <span style="text-format: bold; color: #ff0000;">p1</span>| |<span style="text-format: bold; color: #ff0000;">H5</span>|<span style="text-format: bold; color: #ff0000;">p4</span>| |-|-| S2's MAC address table i. |MAC address | Port | |------------| ---- | |<span style="text-format: bold; color: #ff0000;">H1</span>|<span style="text-format: bold; color: #ff0000;">p5</span>| |-|-| |-|-| ii. |MAC address | Port | |------------| ---- | |<span style="text-format: bold; color: #ff0000;">H1</span>| <span style="text-format: bold; color: #ff0000;">p1</span>| |<span style="text-format: bold; color: #ff0000;">H5</span>|<span style="text-format: bold; color: #ff0000;">p6</span>| |-|-| iii. |MAC address | Port | |------------| ---- | |<span style="text-format: bold; color: #ff0000;">H1</span>| <span style="text-format: bold; color: #ff0000;">p1</span>| |<span style="text-format: bold; color: #ff0000;">H5</span>|<span style="text-format: bold; color: #ff0000;">p6</span>| |<span style="text-format: bold; color: #ff0000;">H4</span>|<span style="text-format: bold; color: #ff0000;">p7</span>| ## Problem 2: IP and Ethernet Addressing Consider the network pictured below, which has two private networks (also called "subnets") connected to router R1 via Ethernet switches S1 and S2. R1 also connects both subnets to the Internet using Network Address Translation (NAT), as the 10.0.0.0/8 prefix is not routable on the Internet. p0...p2 are the names of ports on switch S1 (not MAC addresses). Initially, all ARP tables and MAC learning caches are empty. Assume that all hosts are configured correctly with an IP address, network mask, and default gateway to match the figure. Additionally, assume that the router’s forwarding table is configured appropriately to access both private subnets and the Internet (using NAT). ![](https://hackmd.io/_uploads/BJSBEzymi.png) ### Part a First, H1 sends an IP packet to H3. (Assume that this sends an ARP request, which happens successfully.) For the IP packet, write the source and destination addresses in both the L2 (Ethernet) and L3 (IP) header when it is crossing the link labeled *A* in the figure. For MAC addresses, you can use names based on the name of the host or router interface, eg. `MAC_H1` for H1, `MAC_IF1` for R1’s IF1, etc. | | Src Address | Dst Address | | -------- | ----------- | ----------- | | Ethernet | <span style="font-family: monospace; text-format: bold; color: #ff0000;">MAC_H1</span> | <span style="font-family: monospace; text-format: bold; color: #ff0000;">MAC_IF0 (interface on R1)</span> | | IP | <span style="font-family: monospace; text-format: bold; color: #ff0000;">10.2.0.25</span> | <span style="font-family: monospace; text-format: bold; color: #ff0000;">10.100.5.4</span> | ### Part b Router R1 is a cheap model and can only hold 4 entries in its forwarding table. Given that it needs to route packets to both local subnets, and to the entire Internet (including H4), what are the entries in R1's forwarding table? (Assume a default route has already been provided, as shown). | Destination Network | Out Port/Next Hop | | ------------------- | ----------------- | | <span style="font-family: monospace; text-format: bold; color: #ff0000;">10.2.0.0/24</span> | <span style="font-family: monospace; text-format: bold; color: #ff0000;">IF0</span> | | <span style="font-family: monospace; text-format: bold; color: #ff0000;">10.100.5.0/24</span> | <span style="font-family: monospace; text-format: bold; color: #ff0000;">IF1</span> | | <span style="font-family: monospace; text-format: bold; color: #ff0000;">141.213.10.0/30</span> | <span style="font-family: monospace; text-format: bold; color: #ff0000;">IF2</span> | | Default | 141.213.10.1 | ### Part c H2 is trying to send a packet to H3. Similar to part (A), write the source and destination addresses in both the L2 (Ethernet) and the L3 (IP) header for the IP packet when it is crossing the link labeled *B* in the figure (Again, assume any relevant ARP requests are made and handled successfully). | | Src Address | Dst Address | | -------- | ----------- | ----------- | | Ethernet | <span style="font-family: monospace; text-format: bold; color: #ff0000;">MAC_IF1 (R1)</span> | <span style="font-family: monospace; text-format: bold; color: #ff0000;">MAC_H3</span> | | IP | <span style="font-family: monospace; text-format: bold; color: #ff0000;">10.2.0.6</span> | <span style="font-family: monospace; text-format: bold; color: #ff0000;">10.100.5.4</span> | ### Part d After H2's IP packet successfully reaches H3, what are the contents of H1's ARP table ? (You can fill in a table like the one below, though you may not need as many entries as shown here.) *H1 ARP cache* | IP address | MAC address | | ----------- | ---- | | <span style="font-family: monospace; text-format: bold; color: #ff0000;">10.2.0.1</span> | <span style="font-family: monospace; text-format: bold; color: #ff0000;">MAC_IF0 (R1)</span> | | . | | | . | | ### Part e > Note: Network Address Translation (NAT) will be discussed further in Lecture 10 (Tuesday, October 11). Now H1 wants to send a packet to H4, which is a server out on the Internet. Note that R1 uses NAT to send the outgoing packet, as the 10.0.0.0/8 addresses are not routable on the Internet. What are the source and destination L2 and L3 addresses for this packet when it is crossing link *C* in the figure? | | Src Address | Dst Address | | -------- | ----------- | ----------- | | Ethernet | <span style="font-family: monospace; text-format: bold; color: #ff0000;">MAC_IF2 (R1)</span> | <span style="font-family: monospace; text-format: bold; color: #ff0000;">MAC_IF3 (R2)</span> | | IP | <span style="font-family: monospace; text-format: bold; color: #ff0000;">141.213.10.2</span> | <span style="font-family: monospace; text-format: bold; color: #ff0000;">5.6.7.8</span> | ## Problem 3: Layering What do you need to do manually for a network with IP over Ethernet to work, if you don’t have the following protocols/features working? For example, your answer might be in the form of "give each X a table mapping A to B," "determine unique IDs for Z," or "nothing." * ARP: <span style="text-format: bold; color: #ff0000;">fill a table with mappings from IP addresses to MAC addresses</span> * DHCP: <span style="text-format: bold; color: #ff0000;">assign distinc IP addresses to nodes on the LAN</span> * MAC Learning (at the switches): <span style="text-format: bold; color: #ff0000;">nothing, everything will still work, but every packet will be broadcast. You could also have written to fill a table with ports per destination, but this is unnecessary. (Grading note: if answer mentions filling a table manually, it must mention that this is only an optimization for full credit.)</span> * Intra-domain routing (RIP, OSPF, etc.): <span style="text-format: bold; color: #ff0000;">manually fill the routing tables at routers</span> ## Problem 4: Speed test In lectures 3-4, we learned about how different link-layer protocols and physical layer properties about a link (bandwidth, noise, etc.) can affect a user's access to the network in terms of latency, bandwidth, etc. As we talk more about Internet Service Providers (ISPs) and IP routing on a global scale, we will learn about other factors that affect users' access to the Internet--not only due to technical reasons, but also economic, legal, and social factors as well. As a starting point for this discussion, we'd like you to measure your Internet speed from one or more locations or networks (eg. wifi on campus, cellular data, coffee shop, etc.) and submit your results. After this assignment is due, we will aggregate everyone's results and discuss them in class, as well as place them in a more global context. Here's what you need to do: * **Visit https://speed.cloudflare.com**, a site that runs various tests to measure the performance of your Internet connection in terms of bandwidth and latency * **Enter some of the test results into** **[this form](https://forms.gle/NC8gMc9L3dnKnStQA)**. To fill out the form, you will need to sign in with your Brown account (though the results are anonymous). * If possible, repeat this process on a different network than you tried previously, or on the same network under different test conditions. Some examples could include: * The campus wireless network * A wired connection on campus * Cellular data on a phone (eg. 4G, 5G) * A wired or wireless connection off-campus * Public wifi (from a coffee shop, train station, etc.) * A different vantage point on the campus wireless network (ie. a crowded vs. empty area) * Note that the form is anonymous--you can submit to it as many times as you want with different test results. Please try to submit two different results if possible, but **only one is required** to get full credit. * **For credit on this problem: in your homework submission, include a screenshot of at least one of your test results.** If you have thoughts on any comparisions between your rest results, feel free to add them--we'll aggregate all the results and your notes for a larger discussion in class! <span style="text-format: bold; color: #ff0000;">Full credit if screenshot of results is included.</span>