Internet and Security - Mock Exam 1
Questa pagina non ha ancora la versione ripasso: qui sotto c'è il testo completo.
In questa pagina 13
Mock exam built on the model of the written exams of the Internet course of Padova: the four exams of 2019-20 and the official simulations of 2024-25 (numerical exercises of 12 and 8 points: queues and TCP, addressing and forwarding). The official exam of Internet and Security has a written test in two modules, theory (questions on the course) and practice (network exercises like the ones done in class), plus a laboratory test. The theory module of the real exams is not public and the laboratory test is not simulated here: the questions below are written on the notes of this course, and the numbers of questions, the points and the duration are our proposal, not an official rule.
- Theory module: 10 points. Ten questions with four options and exactly one correct answer, 1 point each, at least four on Network Security (here five: Quiz 6 to Quiz 10).
- Practical module: 20 points. Exercise 1 (12 points) and Exercise 2 (8 points).
- Total 30 points, duration 2 hours. For the practical module we propose books, notes and a calculator; for the theory module nothing.
Every result was checked with a program: the quiz computations (bit stuffing, delays, SHA-256 blocks, Diffie-Hellman), an event-by-event simulation of the queues (UDP, with and without TCP), the round model of TCP Reno and its first events, and the Python module ipaddress for subnets (disjoint, aligned, capacities, aggregation) and the longest prefix match.
Theory module
Quiz 1
Four hosts download files from four different servers at the same time through a common link of capacity Mbit/s. Each server has an access link of Mbit/s and each client an access link of Mbit/s. All other links are much faster. What is the throughput of each download, if the common link is shared equally?
- A) Mbit/s
- B) Mbit/s
- C) Mbit/s
- D) Mbit/s
Show the result
Answer C.
Show the full solution
The throughput of a path is the minimum bitrate along it, but a shared link splits its capacity among the flows (Network Performance AnalysisNetwork performance is measured by traffic metrics (bitrate R0, the link maximum; throughput S <= R0, data delivered successfully; goodput at the application layer), delay (end-to-end d = d_proc + d_queue + d_trans + d_prop with d_trans = L/R and d_prop = d/v; jitter; RTT), pipe capacity (BDP = rate times delay) and reliability (PER, PDR, PLR). The throughput of a path is that of its bottleneck link, the minimum bitrate, remembering that shared links split their capacity.Network Performance Analysis →). Here the common link gives Mbit/s to each of the four downloads. Comparing Mbit/s with the access links ( Mbit/s for the servers, Mbit/s for the clients), the smallest value is Mbit/s: the shared link is the bottleneck and each download runs at Mbit/s.
The other options: A takes the client access as the bottleneck, forgetting that the common link is shared; B is the capacity of the common link as if it were used by one flow; D would be right for two downloads ().
Quiz 2
A packet of bytes crosses three links in series with store-and-forward routers. The links have bitrates , and Mbit/s and propagation delays , and ms. Neglecting processing and queueing, what is the delay from the first bit sent to the last bit received?
- A) ms
- B) ms
- C) ms
- D) ms
Show the result
Answer A: ms.
Show the full solution
With store-and-forward each router receives the whole packet before forwarding it, so every link adds its own (Circuit Switching and Packet SwitchingA switching node can connect input to output in three ways. Circuit switching sets up a dedicated physical connection first (telephone network), delivery time T = 3N t_p + N t_s + M/R. Datagram packet switching splits the message into K packets with a header, each routed independently with store-and-forward, T = N t_p + (N+K-1)(M/K+H)/R, with optimal K = sqrt((N-1)M/H). Virtual circuit has three phases (setup, data, teardown): a dedicated logical connection without dedicated resources, with a local identifier that changes at each hop.Circuit Switching and Packet Switching →, Network Performance AnalysisNetwork performance is measured by traffic metrics (bitrate R0, the link maximum; throughput S <= R0, data delivered successfully; goodput at the application layer), delay (end-to-end d = d_proc + d_queue + d_trans + d_prop with d_trans = L/R and d_prop = d/v; jitter; RTT), pipe capacity (BDP = rate times delay) and reliability (PER, PDR, PLR). The throughput of a path is that of its bottleneck link, the minimum bitrate, remembering that shared links split their capacity.Network Performance Analysis →). The packet is bit, so gives
on the three links, in total ms; the propagation delays add ms. Total ms.
The other options: B counts only the slowest transmission ( ms) plus the propagation; C forgets the propagation delays (the text gives them, so they must be included); D uses the bottleneck transmission time on every link, ms.
Quiz 3
The data link layer of a link uses bit stuffing with flag 01111110: the sender inserts a 0 after every five consecutive 1 of the data. The data field is
0111111011111011111111100111110
( bits). How many bits are sent after stuffing?
- A) bits
- B) bits
- C) bits
- D) bits
Show the result
Answer D: bits (four stuffed zeros).
Show the full solution
The sender scans the data from the left, counts the consecutive 1 and inserts a 0 as soon as the count reaches five, then restarts the count (Data Link Layer and FramingThe data link layer (DLL) delivers a frame from a node to an adjacent node over a link. Services: framing, medium access (MAC) with 48-bit MAC addresses, flow control, error detection and correction. It splits into DLC (framing, error and flow control) and MAC (shared medium access). Framing delimits frames with a flag: byte-oriented protocols (8-bit flag, ESC) use byte stuffing, bit-oriented ones (flag 01111110) use bit stuffing, which inserts a 0 after every five consecutive 1s.Data Link Layer and Framing →). The data are made of the runs
0 , 111111 (six 1) , 0 , 11111 (five) , 0 , 111111111 (nine) , 00 , 11111 (five) , 0 .
- the run of six: after the fifth
1a0is inserted, the sixth1is then alone (count ): one inserted bit; - the run of five: one inserted bit (after the fifth
1, even if the next data bit is already0); - the run of nine: five
1, inserted0, then four1(the count restarts, four is below five): one inserted bit; - the last run of five: one inserted bit.
Four bits are added: . The stuffed frame is 01111101011111001111101111001111100, and the receiver removes every 0 that follows five 1 and gets the original bits back.
The other options come from missing or inventing insertions: A and B forget the runs of exactly five (a run of five also needs the extra 0) or count too few runs; C invents one more, for example a second insertion in the run of nine (after the first insertion the count restarts, and four 1 are below five).
Quiz 4
A shared Ethernet-like segment works at Mbit/s with CSMA/CD. The maximum distance between two stations is m and the signal speed is m/s. What is the minimum frame size that guarantees that a collision is always detected while the frame is being sent?
- A) bytes
- B) bytes
- C) bytes
- D) bytes
Show the result
Answer B: bit bytes.
Show the full solution
A station is sure that its frame did not collide only after a round trip: the frame must last at least (LAN - Ethernet and Wi-FiA LAN covers a limited area and is defined by the IEEE 802.x family (802.3 Ethernet, 802.11 Wi-Fi), which splits the link layer into LLC and MAC. Ethernet is connectionless, with no flow control and no ACK; it uses 1-persistent CSMA/CD; the frame is 64 to 1518 bytes (6-byte addresses, type/length, data 46-1500, 4-byte CRC) and the 64 B minimum comes from t_F >= 2 tau_p. From 10 Mbit/s on coax up to 10 Gbit/s on fibre, with full-duplex switches removing collisions. Wi-Fi (802.11) uses CSMA/CA, has BSS (with access point) and ad hoc modes, EBSS with a distribution system, adapts its bitrate to the SNR, and has hidden and exposed terminal problems, partly solved by RTS/CTS and NAV.LAN - Ethernet and Wi-Fi →). Here s, so s and
The other options: A uses the one-way propagation only ( bit); C is bit read as bytes (always convert before dividing: bits are divided by ); D is the minimum frame of the real standard ( bytes), a design value that keeps a margin for repeaters and is not the result of this computation.
Quiz 5
A stop-and-wait protocol sends frames of bit on a link of Mbit/s, with one-way propagation delay of ms. The acknowledgment is so short that its transmission time is negligible. What is the efficiency of the link?
- A)
- B)
- C)
- D)
Show the result
Answer C: .
Show the full solution
The frame lasts ms, so the normalized propagation is . In a cycle of the channel is busy only for (Network Performance AnalysisNetwork performance is measured by traffic metrics (bitrate R0, the link maximum; throughput S <= R0, data delivered successfully; goodput at the application layer), delay (end-to-end d = d_proc + d_queue + d_trans + d_prop with d_trans = L/R and d_prop = d/v; jitter; RTT), pipe capacity (BDP = rate times delay) and reliability (PER, PDR, PLR). The throughput of a path is that of its bottleneck link, the minimum bitrate, remembering that shared links split their capacity.Network Performance Analysis →, ARQ Protocols - Stop-and-Wait, Go-Back-N and Selective RepeatARQ (Automatic Repeat reQuest) makes an error-prone link reliable: the receiver acknowledges (ACK) frames received correctly and the sender retransmits when the timeout expires. Timeouts (against deadlock) and sequence numbers (against duplicates) are needed. With t_G = t_F + 2 tau_p + t_A and error probability p: Stop-and-Wait rho = t_F(1-p)/t_G; Go-Back-N with window N >= t_G/t_F rho = (1-p)/(1+(N-1)p); Selective Repeat rho = 1-p. Efficiency eta = rho I/F. The optimal window is the pipe capacity in packets. For Selective Repeat there is also an optimal frame length: with overhead o and bit error probability P_b, x_opt is about o/2 + sqrt(o/P_b) (shorter frames when the channel errs more).ARQ Protocols - Stop-and-Wait, Go-Back-N and Selective Repeat →):
The other options: A is , forgetting that the ACK also crosses the link (); B is the idle fraction ; D doubles the propagation twice ().
Quiz 6
A file of bytes is hashed with SHA-256. The hash works on blocks of bit; the last block is completed by padding made of a bit 1, zeros and the length of the message on bit. How many blocks are processed and how long is the digest?
- A) blocks, digest of bit
- B) blocks, digest of bit
- C) blocks, digest of bit
- D) blocks, digest of bit
Show the result
Answer B.
Show the full solution
The message has bit. With the padding we need bit, and blocks (Hash Functions and Symmetric CryptographyEncryption turns plaintext into ciphertext with a key; hash functions give a fixed-length one-way digest used for integrity and passwords; symmetric ciphers (Caesar, Vigenere, DES, AES with block modes) share one secret key, exchanged for example with Diffie-Hellman; MAC and HMAC authenticate messages with a shared key.Hash Functions and Symmetric Cryptography →). The output of a hash function has a fixed length whatever the input: bit bytes for SHA-256.
The other options: A forgets the padding, rounding down; C confuses the digest with the block size; D uses bit blocks (): the block is bit, is only the digest.
Quiz 7
Alice and Bob use Diffie-Hellman with and . Alice chooses the secret and Bob the secret . An eavesdropper sees , and the two messages exchanged. What is the shared key?
- A)
- B)
- C)
- D)
Show the result
Answer A: .
Show the full solution
Alice sends . Bob sends . Alice computes , Bob ; both equal (Hash Functions and Symmetric CryptographyEncryption turns plaintext into ciphertext with a key; hash functions give a fixed-length one-way digest used for integrity and passwords; symmetric ciphers (Caesar, Vigenere, DES, AES with block modes) share one secret key, exchanged for example with Diffie-Hellman; MAC and HMAC authenticate messages with a shared key.Hash Functions and Symmetric Cryptography →). Reducing at every step: , , .
The eavesdropper would need from , a discrete logarithm. The other options are wrong combinations that do not correspond to the protocol: B is (a product, not a power); C is ; D is .
Quiz 8
In TLS 1.0 an attacker who records the traffic and later steals the private key of the server can read all the past sessions; with TLS 1.3 he cannot. Why?
- A) Because the session key is sent encrypted with the public key of the server, which the attacker does not have.
- B) Because the certificate of the server is renewed at every session.
- C) Because the application data are encrypted with RSA, whose private key is used only to sign.
- D) Because the session key is computed with ephemeral Diffie-Hellman values and the private key is used only to sign the handshake (forward secrecy).
Show the result
Answer D.
Show the full solution
In TLS 1.0 the client generates the session key and sends it encrypted with the public key of the server: whoever later obtains the private key can decrypt that message in the recording and recover the key of every past session. In TLS 1.3 the key is built with Diffie-Hellman ( from ephemeral values and ) and the private key of the server only signs the handshake: the ephemeral exponents are discarded, so the stolen private key does not reveal (Public-Key Cryptography, RSA and TLSPublic-key cryptography uses a public key to encrypt and a private key to decrypt; certificates issued by a Certificate Authority bind identities to public keys; digital signatures give authenticity, integrity and non-repudiation; RSA relies on the difficulty of factoring; TLS combines certificates, a symmetric session key (derived with Diffie-Hellman since TLS 1.3) and MACs.Public-Key Cryptography, RSA and TLS →). This is called forward secrecy.
The other options: A describes exactly TLS 1.0, where the stolen private key does decrypt the session key; B is false (certificates last for months or years); C is false, because data are encrypted with a fast symmetric cipher and not with RSA.
Quiz 9
A stateless packet filter protects an internal host with the rules, read in order: (1) allow incoming TCP with destination port ; (2) allow incoming TCP with destination port above , to receive the replies of the connections started from inside; (3) deny everything else. Which of the following services of the internal host can still be reached from the outside?
- A) SSH, port
- B) an X11 server, port
- C) HTTP, port
- D) Telnet, port
Show the result
Answer B.
Show the full solution
Rules are applied in order and the first match wins (FirewallsA firewall blocks unauthorised traffic between networks using header information of layers 2-4: stateless packet filters apply ordered rules per packet, stateful firewalls track connections (NEW, ESTABLISHED, RELATED, INVALID), application firewalls act as proxies; in Linux netfilter provides five hooks and iptables organises rules in tables and chains.Firewalls →). Ports , and are neither nor above : they fall in rule 3 and are denied. Port is above , so rule 2 admits it: the X11 server is reachable even if nobody wanted it. This is the weakness of a stateless filter: rule 2 cannot tell a reply to an internal connection from a new connection started by an attacker. Using the ACK flag in rule 2 helps only partly (a crafted packet with still passes); a stateful firewall solves it with the ESTABLISHED state.
Quiz 10
A Linux router has eth0 towards the Internet and eth1 towards the LAN, with the commands
iptables -P FORWARD DROP
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPTWhat happens to a TCP SYN packet that arrives from the Internet for a host of the LAN, and to a TCP connection started by a LAN host towards the Internet?
- A) The SYN is dropped by the default policy; the connection started from the LAN works, and its replies are accepted.
- B) The SYN is forwarded, because the destination is a host of the LAN.
- C) The SYN is dropped and the sender receives an ICMP message; the LAN connections do not work.
- D) The SYN is accepted as RELATED to existing traffic; the LAN connection works.
Show the result
Answer A.
Show the full solution
The packet from the Internet enters from eth0: the second rule requires -i eth1, and the third requires the connection state ESTABLISHED or RELATED, while the first packet of a connection is NEW (FirewallsA firewall blocks unauthorised traffic between networks using header information of layers 2-4: stateless packet filters apply ordered rules per packet, stateful firewalls track connections (NEW, ESTABLISHED, RELATED, INVALID), application firewalls act as proxies; in Linux netfilter provides five hooks and iptables organises rules in tables and chains.Firewalls →, Firewall Configuration with iptables in KatharàLab 6 configures a packet-filter firewall on Linux with iptables (NetFilter): tables filter, nat, mangle and raw hold chains of rules, the first matching rule wins, otherwise the default policy applies; three experiences cover a firewall protecting a host (INPUT with DROP policy plus loopback, ping, SSH and ESTABLISHED,RELATED), a firewall on a LAN router (FORWARD) and NAT with SNAT and DNAT.Firewall Configuration with iptables in Katharà →). No rule matches, so the default policy DROP discards it silently (no ICMP message: that would be REJECT). A SYN from a LAN host comes in from eth1 and goes out to eth0: rule 2 accepts it, and the replies, which belong to a tracked connection, are accepted by rule 3 as ESTABLISHED.
The other options: B ignores the default policy; C confuses DROP with REJECT and wrongly blocks the LAN; D is wrong because the SYN opens a new connection (state NEW), it is not related to any existing one.
Practical module
Exercise 1 (points 12)
Host A and host B are connected through two routers: A, R1, R2, B in a chain, with three links. The routers are store-and-forward, have FIFO output queues with buffers large enough never to lose a packet, and neglect processing times. The links are:
| Link | Ends | Capacity | Propagation |
|---|---|---|---|
| A - R1 | Mbit/s | ms | |
| R1 - R2 | Mbit/s | ms | |
| R2 - B | Mbit/s | ms |
Neglect any other traffic, the headers of every layer, and the length of the acknowledgments and of the connection-opening segments (only their propagation counts). Packets and segments have length bytes. A must send to B a message of kbyte, that is bytes.
(a) (3 points) At the transport layer UDP is used and A sends all the datagrams back to back starting at . Compute the instant at which the last datagram arrives at B, the average throughput, and how long the last datagram waits in the queue of R1 before starting on .
(b) (2 points) Compute the round trip time , the bandwidth-delay product of the path (in bits and in MSS) and the sender window that allows a continuous flow.
Now A and B use TCP Reno, with MSS at the start, MSS and receiver window Mbyte. Every segment is acknowledged separately. Use the round model of the course: in each round the sender transmits its window back to back; the ACKs of a window come back spaced by the transmission time of the bottleneck, the first one an after the first segment; the next round starts when the first ACK of the previous round arrives. Data are sent as soon as possible after the opening (SYN, SYN+ACK, then the first segment with the last ACK of the handshake).
(c) (3 points) Compute the total time from the beginning of the opening to the reception of the last ACK, with no losses.
(d) (4 points) Repeat the computation when the 9th segment of the message is lost on and no other segment is lost. The loss is detected by three duplicate ACKs: the sender retransmits the lost segment when the third duplicate ACK arrives; becomes , where is the window of the round in which the loss occurs; to keep the model simple, no new segment is sent during fast recovery; the cumulative ACK of the retransmitted segment ends fast recovery, sets and starts a new round in congestion avoidance. Give the window of each round, the instant of the third duplicate ACK and the final instant.
Show the result
(a) Last datagram at B at ms; throughput Mbit/s; queueing in R1: ms.
(b) ms; kbit MSS; MSS.
(c) ms.
(d) Windows: ; the 9th segment is lost in the round with ; third duplicate ACK at ms; MSS; ACK of the retransmission at ms; then and from ms the continuous flow (). ms.
Show the full solution
| Link | |||
|---|---|---|---|
| (ms) | |||
| (ms) |
The message is segments. The bottleneck is ( Mbit/s): ms, the minimum spacing between two consecutive segments after it.
(a) UDP. There is no window, no ACK and no waiting: A sends the datagrams one after the other (UDP - User Datagram ProtocolUDP is the connectionless, unreliable transport protocol that adds to IP only process-to-process communication through ports and an optional checksum; its header is 8 bytes (source port, destination port, length, checksum), the checksum covers a pseudo-header (IP addresses, protocol 17, length), the UDP header and the data as a one's complement sum (0 means not computed and a computed 0 is sent as 0xFFFF), and UDP has no connection setup, sequence numbers, flow, error or congestion control, which makes it suitable for short messages (DNS, DHCP, RIP, SNMP) and real-time applications.UDP - User Datagram Protocol →). Datagram finishes on at ms and arrives at R1 at ms (Circuit Switching and Packet SwitchingA switching node can connect input to output in three ways. Circuit switching sets up a dedicated physical connection first (telephone network), delivery time T = 3N t_p + N t_s + M/R. Datagram packet switching splits the message into K packets with a header, each routed independently with store-and-forward, T = N t_p + (N+K-1)(M/K+H)/R, with optimal K = sqrt((N-1)M/H). Virtual circuit has three phases (setup, data, teardown): a dedicated logical connection without dedicated resources, with a local identifier that changes at each hop.Circuit Switching and Packet Switching →). Since is faster than the datagrams pile up in R1 and works without pauses (Introduction to Queueing TheoryA queueing system is made of an arrival process (Poisson, rate lambda), a queue and one or more servers with service rate mu. Offered load G = lambda/mu, load factor rho = lambda/(m mu): the system is stable only if rho < 1, and then the throughput is lambda (otherwise m mu). Little's law E[x] = lambda E[s] holds for any discipline. M/M/1: E[x] = rho/(1-rho), E[s] = (1/mu)/(1-rho), E[w] = (rho/mu)/(1-rho). With deterministic service (M/D/1, a special case of Pollaczek-Khinchin): E[w] = rho/(2 mu (1-rho)). The delay grows without bound as rho tends to 1.Introduction to Queueing Theory →): datagram starts on at and ends at ms. After the datagram needs ms of propagation, ms on (never a queue in R2: the datagrams arrive ms apart and needs only ms) and ms of propagation. For the last datagram ():
Equivalent: first datagram ms plus ms. Average throughput: kbit delivered in ms, so Mbit/s, a little below the Mbit/s of the bottleneck because of the first ms.
Queue of R1. The last datagram arrives at R1 at ms, but it starts on only at ms: it waits . (At ms only datagrams have already left R1, one is being transmitted and are waiting, the last one included.)
Typical mistakes: using or spacings instead of ; adding a final RTT (with UDP the time stops at the arrival); computing the queueing wait from instead of from the arrival at R1.
(b) RTT, BDP and . Forward trip of one segment: ms. The ACK has negligible length, so it only has propagation: ms. Then
To keep the bottleneck always busy at least segments must be in flight: MSS (equivalently , TCP - Connection, Reliability and Flow ControlTCP is the connection-oriented, reliable transport protocol that turns IP's unreliable service into an ordered byte stream without errors or duplicates; the connection opens with a three-way handshake (SYN, SYN+ACK, ACK) and closes with FIN segments, bytes are numbered (sequence number = first byte of the segment, cumulative ACK = next byte expected), the sender may transmit min(rwnd, cwnd) unacknowledged bytes (rwnd, the receiver window in a 16-bit field, is flow control), errors are handled with checksum, ACKs, retransmission timeout and fast retransmit after three duplicate ACKs, and to fill the pipe the window must reach the bandwidth-delay product, with maximum throughput MSS times Wmax over RTT.TCP - Connection, Reliability and Flow Control →). Rounding down to would leave the bottleneck idle for part of every RTT. With Mbyte, much larger than the windows reached, .
(c) TCP without losses. Opening: SYN and SYN+ACK have negligible length, so only propagation counts: ms in each direction, ms in total (not ms: there is no data segment to transmit yet). The first data segment leaves at ms together with the last ACK of the handshake.
Windows. MSS: slow start doubles the window every round, (TCP Congestion ControlCongestion arises when fast links feed a slow one, router queues fill and packets are lost or delayed, possibly up to network collapse; TCP controls its congestion window cwnd using loss feedback (timeout or three duplicate ACKs): slow start doubles cwnd every RTT up to the threshold ssthresh, then congestion avoidance adds 1 MSS per RTT, and on a loss ssthresh becomes W/2; variants differ in reaction to three dupACKs: Tahoe restarts from cwnd=1, Reno uses fast recovery (ssthresh=cwnd/2, cwnd=ssthresh+3, +1 per further dupACK), NewReno handles partial ACKs and recovers several losses in one window, SACK acknowledges received blocks and resends only what is missing.TCP Congestion Control →). A round lasts one RTT while the window is below (the sender sends and waits for the ACKs; ). The first four rounds start at , , and ms and send segments. The fifth window is : from ms the flow is continuous, one segment every , for the remaining segments.
Reading the terms: are the rounds ; the first of the segments leaves at ms and the last one later; the final brings back the ACK of the last segment (the exercise asks for the last ACK). Compared with UDP ( ms) TCP is slower by ms: ms of opening, the slow start rounds in which the bottleneck is idle, and the last ACK.
(d) One loss detected by three duplicate ACKs. Segments are numbered from : round 1 sends segment ; round 2 segments -; round 3 segments -; round 4, with window , segments -. The 9th segment is the second of round 4 and it is lost on (the bottleneck still spends its ms on it, so the spacing of the following segments does not change). Round 4 starts at ms.
Detection. The ACK of segment of this round returns at . Segment arrives and its ACK returns at ms (asking for segment ). Segments , , arrive out of order and each produces a duplicate ACK asking again for segment , at
At the third duplicate ACK ( ms) Reno applies fast retransmit (TCP Congestion ControlCongestion arises when fast links feed a slow one, router queues fill and packets are lost or delayed, possibly up to network collapse; TCP controls its congestion window cwnd using loss feedback (timeout or three duplicate ACKs): slow start doubles cwnd every RTT up to the threshold ssthresh, then congestion avoidance adds 1 MSS per RTT, and on a loss ssthresh becomes W/2; variants differ in reaction to three dupACKs: Tahoe restarts from cwnd=1, Reno uses fast recovery (ssthresh=cwnd/2, cwnd=ssthresh+3, +1 per further dupACK), NewReno handles partial ACKs and recovers several losses in one window, SACK acknowledges received blocks and resends only what is missing.TCP Congestion Control →): it resends segment at once, with MSS (and in fast recovery, but by our assumption no new segment is sent). Segments , , produce further duplicate ACKs, which only inflate .
Recovery. The retransmitted segment crosses the path in ms and arrives at ms. The receiver already holds segments -, so it answers with a cumulative ACK that acknowledges everything up to segment ; it reaches A after the ms of the return trip, at ms (that is ). Fast recovery ends: MSS and a new round starts in congestion avoidance.
After the recovery. Delivered: segments -, in all; remain. From ms the window grows by MSS per round, , each lasting one RTT because ms:
| Round | start (ms) | window (MSS) | segments sent so far |
|---|---|---|---|
| 1 | |||
| 2 | |||
| 3 | |||
| 4 | (9th lost) | ||
| recovery | to | no new segments | |
| 5 | |||
| 6 | |||
| 7 | |||
| 8 | |||
| 9 | |||
| 10 | |||
| 11 | continuous flow |
The six rounds send segments, so remain and they go in continuous flow from round 11 at ms (the window has reached and keeps growing). The last segment leaves ms after the first of the continuous flow:
The loss costs ms: ms of recovery round plus the slow regrowth of the window from instead of .
Grafico interattivo: Sender window (MSS) against time (ms): no loss (window 16 from 116 ms) and with the 9th segment lost (third duplicate ACK at 126 ms, ssthresh 4, congestion avoidance from 150 ms); dotted line: BDP = 9.6 MSS
Remark on the model. A real sender does not send the whole window at the beginning of the round: it releases the segments as the ACKs come back, one every , and a simulation of this behaviour event by event, with the same assumptions, gives about ms for case (d), against ms of the round model (the third duplicate ACK at ms and the ACK of the retransmission at ms are the same). The exam convention, as in the official solutions, is the round model. For case (c) the two methods give exactly the same ms.
Typical mistakes: counting the opening as ms (the data are not there yet) instead of ms; taking ; starting congestion avoidance from after three duplicate ACKs (that is a timeout, or Tahoe: Reno restarts from ); taking from the old threshold instead of with ; forgetting that the third duplicate ACK arrives after the first ACK of the round, where is the position of the lost segment; counting the lost segment as not delivered at the end.
Exercise 2 (points 8)
A company has the block . Router R1 is connected to the Internet provider (the link to the provider is not part of the block: R1 has the address on it and the provider router has ), to the LAN Production with hosts, to the LAN Offices with hosts and, with a point-to-point link, to router R2. Router R2 is connected to the LAN Lab with hosts and to the LAN DMZ with hosts. The numbers of hosts do not include the router interfaces: every router has one address in each of its LANs.
(a) (3 points) Define the five subnets (the four LANs and the link R1-R2) using the smallest possible blocks and allocating from the largest to the smallest starting from the beginning of the block. For each subnet give network address, mask, direct broadcast address and maximum number of hosts. Assign to the router interfaces the first usable address of each LAN (on the link R1 has the first and R2 the second address).
(b) (3 points) Write the routing tables of R1 and R2 (apart from the directly connected networks) with the minimum number of rows, using route aggregation, and the row that the provider needs to reach the whole company.
(c) (2 points) How does R1 treat packets with the following destinations: , , , ? Say whether the delivery is direct or indirect, which interface and next hop are used, and what happens to the packet for , an address not assigned to any host.
Show the result
(a)
| Subnet | Network | Mask | Broadcast | Max hosts |
|---|---|---|---|---|
| Production | ||||
| Offices | ||||
| Lab | ||||
| DMZ | ||||
| Link R1-R2 |
R1: , , , . R2: , , .
(b) R1: via ; via . R2: via . Provider: via .
(c) : direct on the interface of Offices. : indirect, next hop , interface towards the link. : indirect to the same next hop (aggregate row), then it loops between R2 and R1 until the TTL expires. : indirect, default route, next hop .
Show the full solution
(a) Plan. The size of a subnet is the smallest power of , , with (Subnetting, VLSM and SupernettingSubnetting splits an address block into smaller subnets by lengthening the mask (2^s subnets when s bits are borrowed), supernetting does the opposite by shortening the prefix to merge contiguous blocks; design rules for variable-size subnets are power-of-two sizes M with M at least hosts plus 2, prefix 32 minus log2 M, and start addresses divisible by M (largest subnet first), while 2^j blocks of prefix n aggregate into one block of prefix n minus j only if contiguous and aligned.Subnetting, VLSM and Supernetting →, Network Layer and IPv4 AddressingThe network layer delivers datagrams host to host through routers (encapsulation, routing, forwarding); an IPv4 address is 32 bits split into a network prefix and a host suffix, and modern classless addressing (CIDR) gives a block of 2^(32-n) addresses from a.b.c.d/n, with network and broadcast addresses computed through the netmask.Network Layer and IPv4 Addressing →); the router interface is one more host, so for the LANs. The prefix is .
| Subnet | Hosts + router | Prefix | Max hosts | ||
|---|---|---|---|---|---|
| Production | |||||
| Offices | |||||
| Lab | |||||
| DMZ | |||||
| Link R1-R2 |
The block goes from to ( addresses). Allocating from the largest and keeping each start address a multiple of its size (so the start is automatically aligned):
- Production: covers to (the third byte takes values, ), broadcast ;
- Offices: next free address , a multiple of : , from to , broadcast ;
- Lab: next free , multiple of : , from to , broadcast ;
- DMZ: next free , multiple of : , from to , broadcast ;
- link: next free , multiple of : , from to , broadcast .
The five blocks use addresses; to remain free. A is the right size for a point-to-point link: two usable addresses, none wasted. Router interfaces: the first usable address of each LAN is the network address plus (, , , ); on the link R1 has and R2 . Starting from the smaller subnets would break the alignment: a cannot start at .
Typical mistakes: forgetting the router interface (here it does not change any prefix, but DMZ is tight: hosts of available); forgetting network and broadcast, or sizing the blocks with the number of hosts instead of a power of ; taking a for Production ( hosts ); forgetting the point-to-point link; starting a subnet at a non-aligned address.
(b) Tables. A table row is (network, mask, next hop) and a packet takes the row with the longest mask that contains the destination (Forwarding and Routing TablesForwarding moves each packet one hop at a time toward its destination; it is direct when the destination is on a local network (ARP gives its MAC) and indirect otherwise (the packet goes to the next hop or default gateway given by the routing table). With netmasks, delivery is direct on interface x if the destination AND the mask equals the interface address AND the mask; otherwise the table is scanned from the longest mask (longest prefix match) and the default route 0.0.0.0/0 always matches; route aggregation shortens tables.Forwarding and Routing Tables →).
R1. Its directly connected networks are Production, Offices, the link and the provider link. Lab and DMZ are behind R2, and the three blocks , and lie inside ( to , addresses, is a multiple of ). One aggregate row replaces the two rows of Lab and DMZ:
| Network | Mask | Next hop |
|---|---|---|
The first row sends to R2 everything of the upper half of ; the default row sends to the provider everything else. Production and Offices cannot be aggregated with the rest (they are not contiguous with a aligned block), but they are connected to R1 and need no row.
R2. It is directly connected to Lab, DMZ and the link, and everything else is reached through R1: one default row via .
Provider. The five subnets are inside the , so the whole company is announced with one row, via (Subnetting, VLSM and SupernettingSubnetting splits an address block into smaller subnets by lengthening the mask (2^s subnets when s bits are borrowed), supernetting does the opposite by shortening the prefix to merge contiguous blocks; design rules for variable-size subnets are power-of-two sizes M with M at least hosts plus 2, prefix 32 minus log2 M, and start addresses divisible by M (largest subnet first), while 2^j blocks of prefix n aggregate into one block of prefix n minus j only if contiguous and aligned.Subnetting, VLSM and Supernetting →): instead of five rows, supernetting into the original block (the blocks of are contiguous and is a multiple of ).
(c) Forwarding at R1. For each destination R1 first tests the networks of its interfaces (direct delivery), then the table with the longest mask (Forwarding and Routing TablesForwarding moves each packet one hop at a time toward its destination; it is direct when the destination is on a local network (ARP gives its MAC) and indirect otherwise (the packet goes to the next hop or default gateway given by the routing table). With netmasks, delivery is direct on interface x if the destination AND the mask equals the interface address AND the mask; otherwise the table is scanned from the longest mask (longest prefix match) and the default route 0.0.0.0/0 always matches; route aggregation shortens tables.Forwarding and Routing Tables →).
- : , so it is in , the network of the Offices interface: direct delivery, with ARP on that LAN.
- : not in a connected network (Offices is to , the link to , the others are elsewhere). The aggregate row contains it and is more specific than the default: indirect, next hop (R2) on the interface towards the link.
- : it is in but outside the five subnets (the link ends at ): the same aggregate row sends it to R2 with next hop . R2 has no specific row, so its default route sends the packet back to R1, which sends it again to R2: the packet loops between the two routers, losing one TTL unit at every hop, until the TTL reaches and a router drops it with an ICMP time exceeded message (Forwarding and Routing TablesForwarding moves each packet one hop at a time toward its destination; it is direct when the destination is on a local network (ARP gives its MAC) and indirect otherwise (the packet goes to the next hop or default gateway given by the routing table). With netmasks, delivery is direct on interface x if the destination AND the mask equals the interface address AND the mask; otherwise the table is scanned from the longest mask (longest prefix match) and the default route 0.0.0.0/0 always matches; route aggregation shortens tables.Forwarding and Routing Tables →). This is the price of aggregation: it also covers addresses that are not assigned.
- : no connected network and no specific row; only the default route matches: indirect, next hop on the provider link.
Typical mistakes: using the default row for (the row is more specific and wins); treating as indirect; writing the next hop of the aggregate row as the address of R2 on the Lab LAN (it is the address of R2 on the link, the only one on a network that R1 is attached to).
Self-assessment grid
| Item | Points | What you need for full marks | Typical mistakes |
|---|---|---|---|
| Quiz 1 | 1 | Mbit/s: the shared link is the bottleneck | taking the client access ( Mbit/s) |
| Quiz 2 | 1 | each link adds transmission and propagation: ms | forgetting the propagation; using the bottleneck on all links |
| Quiz 3 | 1 | bits: count restarts after each inserted | counting overlapping groups of five |
| Quiz 4 | 1 | bit bytes | one-way propagation; bit read as bytes |
| Quiz 5 | 1 | , | forgetting the factor |
| Quiz 6 | 1 | blocks, digest bit | forgetting the padding; digest equal to block |
| Quiz 7 | 1 | , , | multiplying or adding the public values |
| Quiz 8 | 1 | ephemeral Diffie-Hellman, private key only signs | saying the session key is encrypted with RSA in TLS 1.3 |
| Quiz 9 | 1 | port is above and passes rule 2 | thinking a stateless filter recognizes replies |
| Quiz 10 | 1 | NEW packet from eth0 hits the default DROP, silently |
confusing DROP and REJECT |
| Ex. 1 (a) | 3 | ms; Mbit/s; wait ms | wrong number of spacings; adding a final RTT |
| Ex. 1 (b) | 2 | ms; MSS; | rounding down; wrong bottleneck |
| Ex. 1 (c) | 3 | opening ms; rounds ; continuous from ms; ms | opening ms; summing below the BDP |
| Ex. 1 (d) | 4 | third dupACK ms; ; ACK ms; ; ms | restart from ; wrong ; wrong dupACK instant |
| Ex. 2 (a) | 3 | five aligned blocks, largest first, with the router interfaces | forgetting interface or link; misaligned subnets |
| Ex. 2 (b) | 3 | R1: aggregate and default; R2: default; provider: the | many rows instead of the aggregate; wrong next hop |
| Ex. 2 (c) | 2 | direct, indirect via R2, loop for , default for | default for ; missing the loop |