IT代考 COMP 3331/9331 Computer Networks and Applications

COMP 3331/9331 Computer Networks and Applications
Network Data Plane – Answers
Q1) The only entries in a certain route table are (128.59.28.0/22, port 0), (128.59.28.0/23, port 1) and (128.59.28.0/24, port 2). These entries indicate CIDR network number, the prefix and the corresponding port to which a packet should be forwarded. If a packet arrives with a destination IP address equal to 128.59.29.18, which port will this router forward the packet to?
Answer: The address of the IP packet matches 128.59.28.0 in the first 23 bits. The 24th bit is different. Since we use the longest prefix match, the router will use the port corresponding to 128.59.28.0/23 in its route table, and forward the packet to port 1.
Copyright By https://powcoder.com 加微信 powcoder

Q2. A Router R1 has received a datagram with destination IP = 199.20.30.30. The current routing table at R1 has got four entries as follows:
199.20.30.0/28 199.20.30.16/29 199.20.30.24/30 0.0.0.0/0 (Default)
Interface 1 Interface 2 Interface 3 Interface 4
Which interface would be selected by R1 to forward this packet? Show your working.
Answer: IP address ranges
199.20.30.0 to 199.20.30.15 for Interface 1 199.20.30.16 to 199.20.30.23 for Interface 2 199.20.30.24 to 199.20.30.27 for Interface 3
199.20.30.30 does not match any of the above and will thus be forwarded to interface 4, which is the default and matches any IP address.
Q3. Suppose an ISP owns the block of addresses of the form 101.101.128/17.
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?
Answer: Four equal size subnets, borrow 2 bits, mask becomes 19, host bits remaining 13, each subnet can have 8192 IPs.
The prefixes are: 101.101.128/19, 101.101.160/19, 101.101.192/19, 101.101.224/19.
Q4. Suppose a peer with user name Arnold discovers through querying that a peer with user name Bernard has a file it wants to download. Also suppose that Bernard is behind a NAT whereas Arnold isn’t. Let 138.76.29.7 be the WAN-side address of the NAT and let 10.0.0.1 be the internal IP address for Bernard. Assume that the NAT is not specifically configured for the P2P application.

COMP 3331/9331 Computer Networks and Applications
(a) Discuss why Arnold’s peer cannot initiate a TCP connection to Bernard’s peer, even if Arnold knows the WAN-side address of the NAT, 138.76.29.7.
Answer: NAT will not have an entry for a connection initiated from the WAN side, hence will drop incoming packets from Arnold.
(b) Now, suppose that Bernard has established an ongoing TCP connection to another peer, Cindy who is not behind a NAT. Also suppose that Arnold learned from Cindy that Bernard has the desired file and that Arnold can establish (or already has established) a TCP connection with Cindy. Describe how Arnold can use these two TCP connections (one from Bernard to Cindy and the other from Arnold to Cindy) to instruct Bernard to initiate a direct TCP connection (that is, not passing through Cindy) back to Arnold. This technique is sometimes called connection reversal. Note that even though Bernard is behind a NAT, Arnold can use this direct TCP connection to request the file, and Bernard can use the connection to deliver the file.
Answer: Bernard can know the IP address of Arnold through Cindy. Then, the
p2p application can initiate a connection through NAT to Arnold and upload the file.
Q5. Suppose you purchase a wireless router/ADSL modem and connect it to your telephone socket. Also suppose that your ISP dynamically assigns one IP address to your connecting device (i.e. your router/modem). Also suppose that you have five PCs at home that use 802.11 to wirelessly connect to your wireless router. How are IP addresses assigned to five PCs? Does the wireless router use NAT? Why or why not?
Answer: Typically, the wireless router includes a DHCP server. DHCP is used to assign
IP addresses to the 5 PCs and to the router interface. Yes, the wireless router also uses NAT as it obtains only one IP address from the ISP.
Q6. List all the changes a NAPT box makes in TCP and IP headers when it receives a packet from inside node (private IP address) destined to a global IP address say 8.8.8.8.
The changes the following fields in IP header: Source IP address and IP header Checksum
In TCP Header: Source Port No and TCP Checksum
Q7). IP Packets on a certain network can carry a maximum of only 500 Bytes in the data portion. An application using TCP/IP on a node on this network generates a TCP

COMP 3331/9331 Computer Networks and Applications
segment with 1,000 Bytes in the data portion. How many IP packets are transmitted to carry this TCP segment, and what are their sizes (including the header)?
Answer: TCP segment size = Payload + Header = 1020 Bytes. IP packet can carry a maximum of 500 bytes in the data portion. 500 is not exactly divisible by 8 (500/8 = 62.5). We use the lower value 62*8 = 496 bytes. The 3 IP packets will have the following sizes (including the IP headers).
F1: 496 + 20 = 516 Bytes :: Offset=0, MF=1 F2: 496 + 20 = 516 Bytes:: Offset=62, MF=1
F3: 28 + 20 = 48 Bytes :: Offset=124, MF=0
Q8). Suppose datagrams are limited to 1,500 Bytes including the headers (based on an MSS of 1460 bytes) between source Host A and destination Host B. Assuming a 20- byte IP header, how many datagrams would be required to send a file consisting of 4 million Bytes.
Answer: File size = 4 million Bytes. Each datagram can carry 1500-40(headers)=1460 Bytes of the file.
Number of datagrams required = 4* 106 /1460 = 2739.72 , We thus have 2739 datagrams each of size 1460+40 =1500 Bytes and the last datagram of size 1060 + 40 = 1100 Bytes.