--- tags: Computer Network, csie, ncu author: N0-Ball title: HW02 GA: UA-208228992-1 --- # 1. :::info Consider transferring an enormous file of L bytes from Host A to Host B. Assume an MSS of 536 bytes. (10%) (a). What is the maximum value of L such that TCP sequence numbers are not exhausted? Recall that the TCP sequence number field has 4 bytes. (b). For the L you obtain in (a), find how long it takes to transmit the file. Assume that a total of 66 bytes of transport, network, and data-link header are added to each segment before the resulting packet is sent out over a 155 Mbps link. Ignore flow control and congestion control so A can pump out the segments back to back and continuously. ::: ## Ans. ### (a) $$ 2^32 = \underline{4294967296} $$ ### (b) **Header** $$ \frac{2^{32}}{536} \times 66 \approx 5.29 \times 10^8 $$ **Total** $$ 2^32 + 5.29 \times 10^8 \approx 4.82 \times 10^9 $$ **Time** $$ \frac{4.82\times 10^9 \times 8}{155 \times 10^6} \approx \underline{248.7 (sec)} $$ # 2. :::info Host A and B are communicating over a TCP connection, and Host B has already received from A all bytes up through byte 126. Suppose Host A then sends two segments to Host B back-to-back. The first and second segments contain 80 and 40 bytes of data, respectively. In the first segment, the sequence number is 127, the source port number is 302, and the destination port number is 80. Host B sends an acknowledgment whenever it receives a segment from Host A. (a). In the second segment sent from Host A to B, what are the sequence number, source port number, and destination port number? (3%) (b). If the first segment arrives before the second segment, in the acknowledgment of the first arriving segment, what is the acknowledgment number, the source port number, and the destination port number? (3%) (c\). If the second segment arrives before the first segment, in the acknowledgment of the first arriving segment, what is the acknowledgment number? (4%) ::: ## Ans. ### (a). Sequence number : 207 Source Port : 302 Destination Port : 80 ### (b). acknowledgement number : 207 Source Port : 80 Destination Port : 302 ### (c\). acknowledgement number : 127 # 3. :::info Why is it necessary for the server to use a special initial sequence number in the SYNACK? (5%) ::: ## Ans. Since a attack might use SYN FLOOD attack. The server can use a SYN cookie for checking to avoid waiting on ACK, therefore a special initial sequence number is used to make sure that the source is priviledge for connections. # 4. :::info Suppose an attacker knows that a target host uses SYN cookies. Can the attacker create half-open or fully open connections by simply sending an ACK packet to the target? Why or why not? (5%) ::: ## Ans. Since the attacker doesn't know the special initial sequence number, so it can neither open a half-open nor a fully open connection. # 5. :::info Consider sending a large file from a host to another over a TCP connection that has no loss. (10%) a. Suppose TCP uses AIMD for its congestion control without slow start. Assuming cwnd increases by 1 MSS every time a batch of ACKs is receivedand assuming approximately constant round-trip times, how long does it take for cwnd increase from 6 MSS to 12 MSS (assuming no loss events)? b. What is the average throughout (in terms of MSS and RTT) for thisconnection up through time = 6 RTT? ::: ## Ans. ### a. $$ 12 - 6 = \underline{6\ \text{RTT}} $$ ### b. $$ \frac{\sum^{i = 11}_{i = 6} i}{6} = \underline{8.5\ \frac{\text{MSS}}{\text{RTT}}} $$ # 6. :::info What is the difference between routing and forwarding? (5%) ::: ## Ans. The key different between a routing and forwarding is routing is a larger scale, which is from source to destination and forwarding is interface to interface. # 7. :::info Consider a subnet with prefix 128.119.40.128/26 a. Give an example of one IP address (of form xxx.xxx.xxx.xxx) that can be assigned to this network.(5%) b. Suppose an ISP owns the block of addresses of the form 128.119.40.64/25. Suppose it wants to create four subnets from this block, with each block having the same number of IP addresses. What are the prefixes (of form a.b.c.d/x) for the four subnets? (10%) ::: ## Ans. ### a. 128.119.40.128~128.119.40.191 ### b. 128.119.40.64/28 128.119.40.80/28 128.119.40.96/28 128.119.40.112/28 # 8. :::info Consider the network shown below. Suppose AS3 and AS2 are running OSPF for their intra-AS routing protocol. Suppose AS1 and AS4 are running RIP for their intra-AS routing protocol. Suppose eBGP and iBGP are used for the interAS routing protocol. Initially suppose there is no physical link between AS2 and AS4. a. (5%) Router 3c learns about prefix x from which routing protocol: OSPF, RIP, eBGP, or iBGP? b. (5%) Router 3a learns about x from which routing protocol? c. (5%) Router 1c learns about x from which routing protocol? d. (5%) Router 1d learns about x from which routing protocol? ::: ![](https://i.imgur.com/hINyEam.png) ## Ans. ### a. eBGP ### b. iBGP ### c. eBGP ### d. iBGP # 9. :::info Consider the network shown below, and assume that each node initially knows the costs to each of its neighbors. Consider the distance vector algorithm and show the distance table entries at node z.(20%) ::: ## Ans. ![](https://i.imgur.com/OdjK8CX.png)