ECSE 414 Fall 2014 Final Exam Solutions Question 1 a. The five main layers of the internet protocol stack, along with the service provided by each, and the place where each is implemented are as follows: i. Application layer: the service provided depends on the application implemented, but this is this interface between the end- user and the network. This layer is implemented (in software) at end- hosts (the edge). ii. iii. iv. Transport layer: the main services provided by this layer are reliable data transfer, congestion control, flow control, and multiplexing/demultiplexing. This layer is also implemented (in software) at the edge of the network. Network layer: the main services provided by this layer are routing (finding end- to- end paths, typically composed of multiple hops, between each source and destination) and forwarding (moving packets along these paths). This layer is implemented (in a combination of hardware and software) in all elements of the network, but primarily in the core (routers). Link layer: the main service provided by this layer is communicating information over a single link (hop); this could include some form of reliable data transfer or error detection/correction depending on the link characteristics. This layer is implemented (typically in hardware) in the network adapters of all devices (edge and core) in the network. v. Physical layer: the main service provided by this layer is the physical transmission of bits over a channel (e.g., wired, wireless, optical), including line coding (how bits are translated to the signal sent over the channel). This layer is also implemented (primarily in hardware) in the network adapters of all devices (edge and core) in the network. b. Benefits of the layered Internet architecture include that: i. Each layer only needs to be aware of the services offered by the layer immediately below it. ii. iii. Higher layers do not need to be aware/concerned with how lower layers are implemented. (For example, the application layer doesn t need to worry about whether data is being transmitted over wired or wireless links.) One can change the implementation of any layer as long as it provides the same services and interface to the layers above and below. c. The count to infinity problem in distance vector occurs when a node A advertises a path (say, to destination D) to its neighbor B which involves routing through that neighbor. If a link costs changes it can cause B to try routing to D through A, and this will create a routing loop in the network as A and B update the costs of their path to destination D until they find the new actual shortest path to D. Poisoned reverse ameliorates this by having A not advertise the paths to B if they involve routing through B as the next hop 1
to the destination. This is accomplished by having A advertise the cost to these destinations as infinity, rather than putting the actual cost, in the message that A sends to B. d. The information about the new fragments is as follows: IP Identifier Length Flag Offset 123 404 1 185 123 404 1 233 123 404 1 281 123 348 1 329 e. Not having fields for fragmentation makes IPv6 datagrams more efficient for routers to process because this means the router will never have to dedicate additional cycles to perform fragmentation, as it does for IPv4 datagrams. Not having a checksum field makes IPv6 datagrams more efficient for routers to process because the checksum doesn t need to be verified and recalculated at every hop. For IPv4 packets, the checksum is verified to make sure that there were not any bit errors, and then the checksum must be recalculated after the TTL field is decremented. Both of these operations cause overhead at routers. f. The hidden terminal problem arises when hosts A and B can communicate directly, and hosts B and C can communicate directly (in particular, B can receive from both A and C), but hosts A and C are not able to communicate directly. The hidden terminal problem arises in wireless networks because the power of wireless RF signals decays rapidly (as a function of the distance between the transmitter and receiver). The hidden terminal problem does not arise in wired networks because signal power does not decay rapidly over typical wired channels (e.g., copper wire). g. The longest prefix matching rules for this problem are: 1000 0100 1101 1000 0000 10 à Interface 0 1000 0100 1101 1000 0000 11 à Interface 1 1000 0100 1101 1000 1 à Interface 2 Otherwise à Interface 3 2
Question 2 a. The table formed while executing Dijkstra s algorithm is: Step N A B C D E F G H 1 A 0 (A) 4 (A) 5 (A) Inf Inf Inf Inf 4 (A) 2 A,B - 5 (A) Inf Inf Inf 7 (B) 4 (A) 3 A,B,H 5 (A) Inf Inf 7 (H) 7 (B) - 4 A,B,C,H - 7 (C) Inf 7 (H) 7 (B) 5 A,B,C,D,H - 8 (D) 7 (H) 7 (B) 6 A,B,C,D,F,H 8 (D) - 7 (B) 7 A,B,C,D,F,G,H 8 (D) - 8 A,B,C,D,E,F,G,H - The paths, and their costs, to every destination are: Destination Path Cost B A à B 4 C A à C 5 D A à C à D 7 E A à C à D à E 8 F A à H à F 7 G A à B à G 7 H A à H 4 The forwarding table at node A is: Destination Next hop B B C C D C E C F H G B A H 3
b. In this example, the shortest path spanning tree obtained in part (a) is not a minimum spanning tree. To see this, consider finding a minimum spanning tree using Kruskal s algorithm. The first links that would be added to the spanning tree are D- E, C- D, G- F, and F- E. However, the links G- F and F- E do not appear in the shortest path spanning tree, and therefore it cannot be a minimum spanning tree. c. The order in which links are added to the centre- based spanning tree is as follows: B joins: B- G added D joins: D- G added A joins: A- B added C joins: C- D added E joins: either E- D added or E- F and F- G added (both routes have cost 4) d. If A transmits a broadcast packet and the network uses reverse path forwarding, G will receive a copy from all of its neighbors: B, D, F, and H. It will only forward the copy from B, since B is the next hop on G s shortest cost path to the originator of the broadcast, A. e. Assuming that node A has stored all of the information used when computing the shortest paths in part (a) (i.e., the table and the full paths to all destinations), then node A does not need to perform any additional calculations if the cost of the link G- D increases from 3 to 5. This is because, with all of the information, we can immediately see that G- D is not in any shortest path. Hence, if its cost increased, it could only be more expensive to use and so it will still not appear in any shortest paths. If node A did not store all of the information and only kept the forwarding table, then it will need to recomputed all paths since the forwarding table alone doesn t contain enough info to realize that the change doesn t effect the shortest paths. 4
Question 3 a. Polling is more efficient than time division multiple access when the network load (the number of nodes that actually have information to transmit) is low. Time division multiple access will allocate one time slot for each node, and those slots corresponding to nodes with nothing to transmit are wasted/empty. In polling, on the other hand, the master will poll each node and if a node has nothing to transmit then the master will immediately move on to the next node. Thus, the only overhead is the time for polling and receiving a response, rather than having the entire channel time go wasted during an empty slot (as in TDMA). b. The channel is being shared by 20 nodes. Let s consider one round, in which each node is polled once and may or may not transmit. The maximum efficiency will be achieved when all nodes have data to transmit (otherwise, we are wasting some time polling nodes that do not transmit data, and so they only contribute to the overhead). The time to poll all nodes, receive a response, and transmit the data in one round is 1500 bits t! = 20 2μs + = 340 μs. 100 Mbps The amount of actual data transmitted during that time (not counting control messages), is 20 1500 = 30,000 bits, and so the effective bitrate for polling is R! = 30,000 bits / 340 μs 88.24 Mbps. Therefore, the efficiency of polling in this scenario is η =!! = 88.24%.! c. The advantage of taking turns protocols over random access protocols is that there are no collisions and no empty slots. This is especially important when the load is high (when many nodes have information to transmit). The disadvantage of taking turns protocols over random access protocols is that taking turn protocols involve overhead (for polling or for passing the token), and there is a single point of failure (the master, or the token). The overhead is especially pronounced when the network has a light load (relatively few nodes have information to transmit), in which case there is very little contention for the channel. It is advantageous to use random access protocols when the network has a light load. d. Slotted ALOHA is more efficient because nodes only collide with other nodes that are transmitting during the same slot. In pure (unslotted) ALOHA, a node may collide with others transmitting before/after it, and the efficiency is half that of slotted ALOHA. On the other hand, slotted ALOHA is more complicated to implement because it requires synchronizing all of the nodes (so that they agree on when slots begin and end), and synchronization is challenging to achieve in large distributed systems. e. Wired Ethernet uses an exponential backoff mechanism to adjust the probability of retransmitting after a collision occurs (rather than following the slotted ALOHA protocol which uses a fixed, predefined retransmission policy), because the optimal retransmission policy depends on the number of nodes simultaneously trying to access the channel. The exponential backoff mechanism implicitly aims to estimate the number of nodes competing for the channel (based on how many collisions have occurred). 5
Question 4 a. A cumulative acknowledgement in a reliable data transfer protocol is a packet sent from the receiver back to the transmitter to indicate that a collection of packets have been successfully received. For example, in Go- Back- N, a cumulative acknowledgement for sequence number 10 means that packet number 10 and all packets with sequence numbers up to 10 have been successfully received. b. Two transport protocols discussed in class that use cumulative ACKs are Go- Back- N and TCP. c. In Go- Back- N, after a timeout, the number of packets that is retransmitted is equal to the number of packets that have been transmitted and have not yet been acknowledged. This is at most equal to the window size N, and in general it is equal to nextseqnum send_base, where nextseqnum is the next sequence number that could be transmitted and send_base is the smallest sequence number of a packet that has been transmitted but hasn t yet been acknowledged. d. The time t! it takes to send one segment and receive the acknowledgement is t! =!!"# + t!!"#! +!!"# + t!!"#!. The first two terms are the time it takes to send the segment from the transmitter to the receiver (transmission delay and propagation delay), and the second two terms are the time it takes to send the acknowledgement back to the sender (again, transmission delay and propagation delay). e. Following on the previous part, the amount of data actually sent during this time t! is equal to n!"# n!!"#!$ ; note that we don t count the header bits since they are overhead. Thus, the effective bitrate is n!"# n!!"#!$ R! = n!"# R + t!"#! + n!"# R + t!"#! The efficiency η! is found by taking the ratio of R! to R. After dividing the numerator and denominator by n!"#, we get the desired expression η! = R! n!"# R n!"# = 1 n!!"#!$ n!"# 1 + n!"# n + 2 R t.!"#!!"# n!"# 6
Question 5 a. The devices that receive each message are: Message from Received by B to G The entire network (all four switches, and all hosts) G to B Only received by S3, S4, S1, and B E to B Only received by S2, S4, S1, and B B to F The entire network (all four switches, and all hosts) b. After the messages in part (a) have been exchanged, the switching tables at each switch are as follows. Table at S1: Host Interface B 2 G 4 E 4 Table at S2: Host Interface B 4 E 2 Table at S3: Host Interface B 4 G 1 Table at S4: Host Interface B 1 E 2 G 3 7
c. In general, for every switch to have an entry in its switching table for every end host in the local area network, each end host must transmit a message that is received by every host (i.e., either the end host transmits a message that is broadcast, or the end host transmits a message to a destination which involves being forwarded through that switch). d. Since both hosts are on the same local area network, the IP header will include G s IP address and the Ethernet header will also include G s MAC address. The MAC address is needed so that G s Ethernet adapter knows to receive the frame and pass it up to the IP layer, and the IP address is needed for the IP stack to know that this datagram is destined for G. e. Switching topologies must be trees. This is because switches use self- learning, which involves flooding when a frame is received and there is no entry for the destination in the forwarding table. If the topology is not a tree and packets are flooded, it could cause a flooding storm, and could also lead to inconsistent forwarding rules. Routers do not have the same constraints because they use routing algorithms to determine how packets are forwarded; they don t involve flooding and as long as the routing algorithms are executed properly they shouldn t lead to inconsistent forwarding rules. The drawbacks of using routers instead of switches are that routers require configuration (setting of link costs), and they require additional overhead in terms of network traffic to execute routing algorithms over the network. 8
Question 6 a. In order to correct all 1- bit errors we need the generator to be 2 bits long (since this will lead to a r = 1 bit remainder, and hence 1 bit of protection). In general, if the generator G of a CRC code has r + 1 bits, then we get r bits of protection. b. If our goal is to detect all 1- bit errors, then the CRC code is more efficient. This is because the CRC code will only involve appending a single bit to the message, and so the overhead is only this 1 extra bit to be transmitted. On the other hand, the internet checksum requires transmitting 16 additional bits (if the same implementation is used as in TCP and UDP). Thus, there are 16 additional bits transmitted, which is more overhead. c. In this scenario, the generator G is seven bits long, so there are six CRC bits in the message and the rest are data bits. data bits = 1101001010 error detection bits = 101001 d. To see if the receiver detects a bit error, we perform the CRC calculation: 1111010100 1101001010101001 1100100 1111111 1001000 0100111 0000000 1001110 0101011 0000000 1010110 0011010 0000000 0110101 0000000 110101 ß non- zero remainder! Since the remainder of the calculation is non- zero, the receiver does detect a bit error. 9
e. For this example there are 17 parity bits transmitted (one for each row, one for each column, and one extra parity bit on the parity bits [in the bottom right corner]). f. Here is an example illustrating how a single bit error can be detected and corrected. In this example we use an even parity check (so the number of ones in any row or column should be even; i.e., the parity bit is 1 if the number of 1 s in the data is odd, and it is 0 if the number of 1 s in the data is even). Here are the original data and parity bits: 10100010 1 00100010 0 00101010 1 10001010 1 10101001 0 01000010 0 11111001 0 00100100 0 00010110 1 Now suppose that the parity bit in row 4 gets flipped from a 1 to a 0: 10100010 1 00100010 0 00101010 1 10001010 0 10101001 0 01000010 0 11111001 0 00100100 0 00010110 1 Then we see that an error is detected in the 4 th row and the last column, and so we can pin- point the location of the error (the row and column where the errors intersect). Two bit errors will be detected but they cannot be corrected because there will be some ambiguity as to where the error occurred. For example, if the bit errors occur at positions (r!, c! ) and (r!, c! ), where these values indicate the rows and columns of the error, then if the two errors occur in different rows and columns (r! r! and c! c! ), then we can see that there were two errors but we can t tell the difference from the case where the errors occurred at positions (r!, c! ) and (r!, c! ); and if the two errors occur in the same row, then we can tell in which columns they occurred but we can t tell in which row the errors occurred, since the two parity errors cancel each other out; the same logic applies if the errors occur in the same column. 10