SYLLABUS
Concept of layering: OSI and TCP/IP Protocol Stacks; Basics of packet,circuit and virtual circuitswitching; Data link layer: framing, error detection, Medium Access Control, Ethernet bridging; Routing protocols: shortest path, flooding, distance vector and link state routing; Fragmentation and IP addressing, IPv4, CIDR notation, Basics of IP support protocols (ARP, DHCP, ICMP), Network Address Translation (NAT); Transport layer: flow control and congestion control, UDP, TCP, sockets; Application layer protocols: DNS, SMTP, HTTP, FTP, Email
Q1 – A user starts browsing a webpage hosted at a remote server. The browser opens a single TCP connection to fetch the entire webpage from the server. The webpage consists of a top-level index page with multiple embedded image objects. Assume that all caches (e.g., DNS cache, browser cache) are all initially empty.
The following packets leave the user’s computer in some order.
(i) HTTP GET request for the index page
(ii) DNS request to resolve the web server’s name to its IP address
(iii) HTTP GET request for an image object
(iv) TCP SYN to open a connection to the web server
Which one of the following is the CORRECT chronological order (earliest in time to latest) of the packets leaving the computer ?
(A) (iv), (ii), (iii), (i)
(B) (ii), (iv), (iii), (i)
(C) (ii), (iv), (i), (iii)
(D) (iv), (ii), (i), (iii)
Ans – (C)
Explanation – The sequence of steps that a user goes through when he or she loads a web page on a remote server is similar to the following. All caches (e.g., the DNS cache and the browser cache) start out empty. Therefore, the first step is to resolve the domain name of the web server to an IP address. That is done by sending a DNS request (step ii).
Once the IP address has been resolved, the next step is to establish a connection with the web server using TCP (step iv). In order to establish that connection, the user’s device sends a TCP SYN packet for the three-way handshake.
Upon completion of the TCP process, the browser sends an HTTP GET request for the index page of the web site (step i).
Then, after the browser receives the index page, it looks at the page to find other objects, like images, which it will then send the HTTP GET requests again for the images (step iii).
Q2 – TCP client P successfully establishes a connection to TCP server Q. Let 𝑁P denote the sequence number in the SYN sent from P to Q. Let 𝑁Q denote the acknowledgement number in the SYN ACK from Q to P.
Which of the following statements is/are CORRECT?
(A) The sequence number 𝑁P is chosen randomly by P
(B) The sequence number 𝑁P is always 0 for a new connection
(C) The acknowledgement number 𝑁Q is equal to 𝑁p
(D) The acknowledgement number 𝑁Q is equal to 𝑁P + 1
Ans – (A, D)
Explanation – To establish a TCP connection, the client and server must first perform a three-way handshake.
In the first stage of the handshake, the client (P) initiates the connection with the server (Q) by sending a SYN message to the server with a sequence number of 𝑁p.
Like any sequence number, this sequence number is always random, which adds a slight security aspect and helps mitigate certain attack types. Therefore, option (A) is correct.
The sequence number 𝑁P is always 0 for a new connection is false, so option (B) is incorrect.
After the server receives the SYN from the client, it sends a SYN-ACK response to the client. In this response, the server includes its own randomly generated sequence number and an acknowledgment number 𝑁Q, which acknowledges receipt of the client’s SYN. The acknowledgment number 𝑁Q is equal to 𝑁p + 1, meaning that the server is ready to receive the next byte. Therefore, option (C) must be incorrect, and option (D) must be correct.
Q3 – Which of the following fields is/are modified in the IP header of a packet going out of a network address translation (NAT) device from an internal network to an external network?
(A) Source IP
(B) Destination IP
(C) Header Checksum
(D) Total Length
Ans – (A, C)
Explanation – When a packet travels out of a Network Address Translation (NAT) device from an internal network to an external network, some fields in the IP header are changed to give the appropriate routing and response handling.
Option (A) – The Source IP is modified by the NAT device. The NAT device modifies the internal private IP address (i.e. 192.168.x.x.) to the public IP address of the NAT device so that the response from the external server is routed back correctly. This is true.
Option (B) – The Destination IP would not require any modification as the packet is still being sent to the same external server. The NAT device does not need to modify this field. This is false.
Option (C) – The Header Checksum would logically be modified. Since the IP header was modified (because of the new source IP), the header checksum will need recalculation. This is true.
Option (D) – The Total Length would not be modified as the NAT process has not changed the size of the IP packet. This is false.
Q4 – Consider a network path P—Q—R between nodes P and R via router Q. Node P sends a file of size 106 bytes to R via this path by splitting the file into chunks of 103 bytes each. Node P sends these chunks one after the other without any wait time between the successive chunk transmissions.
Assume that the size of extra headers added to these chunks is negligible, and that the chunk size is less than the MTU.
Each of the links P—Q and Q—R has a bandwidth of 106 bits/sec, and negligible propagation latency. Router Q immediately transmits every packet it receives from P to R, with negligible processing and queueing delays. Router Q can simultaneously receive on link P—Q and transmit on link Q—R.
Assume P starts transmitting the chunks at time 𝑡 = 0.
Which one of the following options gives the time (in seconds, rounded off to 3 decimal places) at which R receives all the chunks of the file?
(A) 8.000
(B) 8.008
(C) 15.992
(D) 16.000
Ans – (B)
Explanation – A file size of 10⁶ bytes is transmitted from node P to a node R through router Q. The file is broken into chunks of size 10³ bytes and therefore, there are 1000 chunks. Chunks are of size 8000 bits.
The bandwidth of the links P–Q and Q–R are both 10⁶ bits/sec, and there are no propagation, processing, or queuing delays. Router Q, can receive and transmit packets at the same time. This means that when P sends, it does so continuously, with no idle time, and it takes 8000 bits/106 bits/sec = 0.008 sec.
Since Q can immediately pass each chunk onto the next chunk, the first chunk arrives after 0.008 seconds.
The transmitting of the chunks follows the pipelining nature, and because router Q also forwards at the same time, every subsequent chunk will reach R after an additional 0.008 seconds. The last chunk, the 1000th chunk, begins transmitting from P at 7.992 seconds and finishes transmitting at 8.000 seconds. It is forwarded by Q immediately and reaches R at 8.008 seconds. Therefore, R received its last chunk of the file at 8.008 seconds.
Q5 – Consider the entries shown below in the forwarding table of an IP router. Each entry consists of an IP prefix and the corresponding next hop router for packets whose destination IP address matches the prefix. The notation “/N” in a prefix indicates a subnet mask with the most significant N bits set to 1.
Prefix | Next hop router |
10.1.1.0/24 | R1 |
10.1.1.128/25 | R2 |
10.1.1.64/26 | R3 |
10.1.1.192/26 | R4 |
This router forwards 20 packets each to 5 hosts. The IP addresses of the hosts are 10.1.1.16, 10.1.1.72, 10.1.1.132, 10.1.1.191, and 10.1.1.205 . The number of packets forwarded via the next hop router R2 is _________.
Ans – (40)
Explanation – There are four routers R1, R2, R3, and R4. Each router has some prefixes defined. These prefixes tell us which IP address ranges the router can send packets to. So, based on the prefixes, we know which hosts (devices) each router can reach.
R1 prefix is 10.1.1.0/24
/24 → 32 – 24 = 8 bits for hosts → 28 = 256 addresses
IP block starts at: 10.1.1.0
Total 256 addresses: 10.1.1.0 to 10.1.1.255
R2 prefix is 10.1.1.128/25
/25 → 32 – 25 = 7 bits for hosts → 27 = 128 addresses
IP block starts at: 10.1.1.128
Total 128 addresses: 10.1.1.128 to 10.1.1.255
R3 prefix is 10.1.1.64/26
/26 → 32 – 26 = 6 bits for hosts → 26 = 64 addresses
IP block starts at: 10.1.1.64
Total 64 addresses: 10.1.1.64 to 10.1.1.127
R4 prefix is 10.1.1.192/26
/26 → 32 – 26 = 6 bits for hosts → 26 = 64 addresses
IP block starts at: 10.1.1.192
Total 64 addresses: 10.1.1.192 to 10.1.1.255
The router forwards 20 packets each to 5 hosts. The IP addresses of the hosts are given.
Router | Can send to IP address | Packets | Hosts |
R1 | 10.1.1.0 – 10.1.1.255 | 20 | 10.1.1.16 |
R2 | 10.1.1.128 – 10.1.1.255 | 20 | 10.1.1.132 |
20 | 10.1.1.191 | ||
R3 | 10.1.1.64 – 10.1.1.127 | 20 | 10.1.1.72 |
R4 | 10.1.1.192 – 10.1.1.255 | 20 | 10.1.1.205 |
Note – Can R1 send to all the hosts, because it can send from 10.1.1.0 to 10.1.1.255. Means every host is in their IP address.
The answer is NO, because routers follow the Longest Prefix Match rule.
That means the router checks all matching entries for an IP and selects the one with the longest (most specific) prefix.
For example – Host with IP address 10.1.1.205 matches with 10.1.1.192/26 (Longest prefix).
Q6 – Consider sending an IP datagram of size 1420 bytes (including 20 bytes of IP header) from a sender to a receiver over a path of two links with a router between them.
The first link (sender to router) has an MTU (Maximum Transmission Unit) size of 542 bytes, while the second link (router to receiver) has an MTU size of 360 bytes.
The number of fragments that would be delivered at the receiver is ________.
Ans – (6)
Explanation –
From sender to router, IP datagram = 1420 bytes
Including IP header = 20 bytes
Payload = 1420 – 20 = 1400 bytes
Next, MTU = 542 bytes
Each fragment without payload= 542 – 20 = 522 bytes
Number of fragments = ⎾1400/522⏋ = 3 fragments
From router to receiver, MTU = 360 bytes
Each fragment without payload = 360 – 20 = 340 bytes
First fragments = ⎾522/340⏋ = 2
Second fragments = ⎾522/340⏋ = 2
Third fragment = ⎾356/340⏋ = 2 why?
Because sender to router, payload is 1400 bytes and it equal to 522 bytes + 522 bytes + 356 bytes.
Total number of fragments from router to receiver is 6.