Salta al contenuto
Note per Studenti Internet and Security - Exam of 14 February 2020 Report

Internet and Security - Exam of 14 February 2020

Questa pagina non ha ancora la versione ripasso: qui sotto c'è il testo completo.

In questa pagina 3

Written exam of the Internet course taught in English at the University of Padua (master degree on ICT for Internet and Multimedia Engineering), session 2, 14 February 2020: this is Part 2, numerical exercises. The theory part of that exam is not public, so it is not reproduced here. The sheet gives only the final results (printed next to each question) and no worked solution: every step below was derived from the notes of this course and every number was checked with Python scripts (event simulation of the FIFO queues, event simulation of Go-Back-N with a loss, the ipaddress module for the addressing plan and the longest prefix match). The sheet has two exercises, 12+8=2012+8=20 points; the duration and the allowed material are not printed on it. The official format of the Internet and Security exam is a written test in two modules (theory, and practice with network configuration exercises like these) plus a laboratory test; with at least 1818 out of 3030 in the written test the student may ask for an oral exam on the whole program.

Exercise 1 (points 12)

Consider the network shown in the figure, where the intermediate routers R1, R2 and R3 implement a packet-switched network paradigm with datagram (store-and-forward) approach. Every router operates with independent queues for every output interface.

Topology (a chain of routers with hosts hanging off it):

Link Ends Capacity Propagation delay
C1C_1 S – R1 2424 Mbit/s τ1=1\tau_1=1 ms
C2C_2 R1 – R2 66 Mbit/s τ2=5\tau_2=5 ms
C3C_3 R2 – R3 1212 Mbit/s τ3=4\tau_3=4 ms
C4C_4 R3 – C 4848 Mbit/s τ4=2\tau_4=2 ms
C5C_5 R1 – A 1515 Mbit/s τ5=0.5\tau_5=0.5 ms
C6C_6 R2 – B 2424 Mbit/s τ6=1.5\tau_6=1.5 ms
C7C_7 R3 – D C7= ?C_7=\,? τ7= ?\tau_7=\,?

(Server S is attached to R1 on the left; R1, R2 and R3 are in a row; host A hangs below R1, host B below R2; hosts C and D hang off R3, C on the upper link and D on the lower one. The output queue of S holds three packets labelled "C", the output queue of A three packets labelled "B".)

Question 1 (4 pt). At time t=0t=0, the output queue of server S has three packets towards C, while the output queue of host A has three packets towards B. Considering packets of length L=1500L=1500 Byte, and assuming that packet transmissions start at time t=0t=0 for all nodes, calculate the instant of time the three packets of server S only arrive to their intended destinations.

Neglect the effect of any other parallel transmission. We want to estimate the capacity (C7C_7) and the propagation delay (τ7\tau_7) of the link between R3 and D. To do so, two consecutive pings are sent from B to D. The size of the first ping is Lp,1=1500L_{p,1}=1500 Bytes, while the size of the second ping is Lp,2=600L_{p,2}=600 Bytes. The measured RTT (from the time the ping is sent to the time the corresponding ACK is received) is RTTp,1=21\text{RTT}_{p,1}=21 ms for the first ping and RTTp,2=19.8\text{RTT}_{p,2}=19.8 ms for the second ping.

Question 2 (2 pt). Determine the value of C7C_7 and τ7\tau_7. Neglect processing and queuing delays, and the header at every layer. The size of acknowledgments is also negligible.

Neglecting the effect of any other parallel transmission, assume C7=24C_7=24 Mbps and τ7=4\tau_7=4 ms, and consider the transmission of a message of M=300M=300 KByte, split in packets of L=1500L=1500 Byte, from host D to host C.

Question 3 (3 pt). Determine the total time it takes to transfer the message (from the transmission of the first Byte at node D to the reception of the last Byte at node C), in case:

  • GBN ARQ (with sending window N=3N=3 packets) is executed on the first link (D–R3);
  • S&W ARQ is executed on the second link (R3–C);
  • processing and queuing delays are neglected.

Question 4 (3 pt). Repeat the previous calculation in case GBN ARQ (with sending window N=3N=3 packets) is executed end-to-end on both links and the 2nd packet is lost on the first link (D–R3). Consider the minimum possible time-out for GBN.

Show the result
  • Question 1: the three packets of S arrive at C at 17.5517.55 ms, 19.5519.55 ms and 23.5523.55 ms.
  • Question 2: C7=24C_7=24 Mbit/s, τ7=4\tau_7=4 ms.
  • Question 3: TARQ=852.5T_{\text{ARQ}}=852.5 ms.
  • Question 4: TARQ=861.5T_{\text{ARQ}}=861.5 ms.

All four values coincide with the official ones printed on the sheet.

Show the full solution

Question 1: arrival instants of the three packets of S. The packet is L=1500L=1500 B =12 000=12\,000 bit, so the transmission time on a link is T=L/CT=L/C (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 →); with Mbit/s in the denominator the result comes out in microseconds, so divide by 10001000 for ms:

Link C1C_1 C2C_2 C3C_3 C4C_4 C5C_5 C6C_6
T=L/CT=L/C 0.50.5 ms 22 ms 11 ms 0.250.25 ms 0.80.8 ms 0.50.5 ms

(for example T2=12 000/6⋅106=2T_2=12\,000/6\cdot10^{6}=2 ms). The paths are: S to C uses C1,C2,C3,C4C_1,C_2,C_3,C_4; A to B uses C5,C2,C6C_5,C_2,C_6. The two flows meet only on C2C_2 (the output queue of R1 towards R2), so the packets of A delay those of S there. After C2C_2 they separate: S goes on to R3 on C3C_3, A to B on C6C_6. Each router receives the whole packet before forwarding it (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 →) and serves each output queue in order of arrival (FIFO).

Departures from the hosts and arrival in R1. A host sends its packets one after the other; each packet reaches R1 after its transmission plus τ\tau:

Packet end of transmission arrival in R1
S1S_1 0.50.5 0.5+1=1.50.5+1=1.5
S2S_2 1.01.0 2.02.0
S3S_3 1.51.5 2.52.5
A1A_1 0.80.8 0.8+0.5=1.30.8+0.5=1.3
A2A_2 1.61.6 2.12.1
A3A_3 2.42.4 2.92.9

Queue of C2C_2 (T2=2T_2=2 ms). The order of arrival in R1 is A1 (1.3)A_1\,(1.3), S1 (1.5)S_1\,(1.5), S2 (2.0)S_2\,(2.0), A2 (2.1)A_2\,(2.1), S3 (2.5)S_3\,(2.5), A3 (2.9)A_3\,(2.9). A packet starts when it has arrived and the link is free:

Packet ready start end arrival in R2 (+5+5)
A1A_1 1.31.3 1.31.3 3.33.3 8.38.3
S1S_1 1.51.5 3.33.3 5.35.3 10.310.3
S2S_2 2.02.0 5.35.3 7.37.3 12.312.3
A2A_2 2.12.1 7.37.3 9.39.3 14.314.3
S3S_3 2.52.5 9.39.3 11.311.3 16.316.3
A3A_3 2.92.9 11.311.3 13.313.3 18.318.3

The packets of A leave R2 on C6C_6 towards B and do not matter any more. The packets of S go on to R3 on C3C_3; they arrive at R2 at least 22 ms apart, while their transmission lasts 11 ms, so they never wait there:

Packet C3C_3 start C3C_3 end arrival in R3 (+4+4) C4C_4 end (+0.25+0.25) arrival in C (+2+2)
S1S_1 10.310.3 11.311.3 15.315.3 15.5515.55 17.55\mathbf{17.55}
S2S_2 12.312.3 13.313.3 17.317.3 17.5517.55 19.55\mathbf{19.55}
S3S_3 16.316.3 17.317.3 21.321.3 21.5521.55 23.55\mathbf{23.55}

Check on S1S_1: alone in the network it would arrive after T1+τ1+T2+τ2+T3+τ3+T4+τ4=0.5+1+2+5+1+4+0.25+2=15.75T_1+\tau_1+T_2+\tau_2+T_3+\tau_3+T_4+\tau_4=0.5+1+2+5+1+4+0.25+2=15.75 ms. The actual 17.5517.55 ms differs by 1.81.8 ms, which is exactly the time S1S_1 waits in R1 for A1A_1 to finish on C2C_2 (3.3−1.53.3-1.5). Typical errors: forgetting that A shares C2C_2 with S; putting A2A_2 before S2S_2 in the queue of C2C_2 because it was ready earlier at the host (the order that counts is the arrival in R1: S2S_2 at 2.02.0, A2A_2 at 2.12.1); mixing bytes and bits (15001500 B is 12 00012\,000 bit).

Question 2: capacity and delay of the link R3–D. The ping goes B–R2–R3–D on C6,C3,C7C_6,C_3,C_7. The data packet crosses three links in store-and-forward (transmission plus propagation on each); the ACK has negligible size, so on the way back only the propagation delays count (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 →, definition of RTT): RTT=(LC6+LC3+LC7)+2 (τ6+τ3+τ7).\text{RTT}=\Bigl(\frac{L}{C_6}+\frac{L}{C_3}+\frac{L}{C_7}\Bigr)+2\,(\tau_6+\tau_3+\tau_7). The propagation part is 2(1.5+4+τ7)=11+2τ72(1.5+4+\tau_7)=11+2\tau_7 ms. For the first ping, Lp,1=12 000L_{p,1}=12\,000 bit: L/C6=0.5L/C_6=0.5 ms, L/C3=1L/C_3=1 ms, so 21=0.5+1+12 000C7+11+2τ7⟹12 000C7+2τ7=8.5 ms.21=0.5+1+\frac{12\,000}{C_7}+11+2\tau_7\quad\Longrightarrow\quad \frac{12\,000}{C_7}+2\tau_7=8.5\ \text{ms}. For the second ping, Lp,2=600L_{p,2}=600 B =4800=4800 bit: L/C6=0.2L/C_6=0.2 ms, L/C3=0.4L/C_3=0.4 ms, so 19.8=0.2+0.4+4800C7+11+2τ7⟹4800C7+2τ7=8.2 ms.19.8=0.2+0.4+\frac{4800}{C_7}+11+2\tau_7\quad\Longrightarrow\quad \frac{4800}{C_7}+2\tau_7=8.2\ \text{ms}. Two equations in two unknowns: subtracting them removes τ7\tau_7 (the propagation delay does not depend on the size of the packet): 12 000−4800C7=8.5−8.2=0.3 ms ⟹ C7=7200 bit0.3⋅10−3 s=24⋅106 bit/s=24 Mbit/s.\frac{12\,000-4800}{C_7}=8.5-8.2=0.3\ \text{ms}\ \Longrightarrow\ C_7=\frac{7200\ \text{bit}}{0.3\cdot10^{-3}\ \text{s}}=24\cdot10^{6}\ \text{bit/s}=\mathbf{24\ Mbit/s}. Then 12 000/C7=0.512\,000/C_7=0.5 ms and 2τ7=8.5−0.5=82\tau_7=8.5-0.5=8 ms, so τ7=4 ms\tau_7=\mathbf{4\ ms}. Check with the second ping: 0.6+0.2+11+8=19.80.6+0.2+11+8=19.8 ms. The method generalizes: two packet sizes separate the part of the RTT that grows with the size (transmission) from the fixed part (propagation).

Question 3: GBN on the first link, S&W on the second. The message has 300 000/1500=200300\,000/1500=200 packets (11 KByte =1000=1000 B, as the official result confirms). Per-link times with C7=24C_7=24 Mbit/s: T7=0.5T_7=0.5 ms, τ7=4\tau_7=4 ms on the first link (D–R3), T4=0.25T_4=0.25 ms, τ4=2\tau_4=2 ms on the second (R3–C). The ACKs have negligible size (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 →).

First link, GBN with N=3N=3. One cycle is tG,1=T7+2τ7=0.5+8=8.5t_{G,1}=T_7+2\tau_7=0.5+8=8.5 ms, and the window needs only N T7=1.5<8.5N\,T_7=1.5<8.5 ms to be sent: the transmission is not continuous; the sender sends 33 packets and then waits for the ACK of the first. The first link therefore delivers 33 packets every 8.58.5 ms to R3, i.e. one every 2.832.83 ms on average (the pipe holds 8.5/0.5=178.5/0.5=17 packets, the window only 33).

Second link, S&W. Each packet occupies the link until its ACK is back: tG,2=T4+2τ4=0.25+4=4.25t_{G,2}=T_4+2\tau_4=0.25+4=4.25 ms per packet. Since 4.25>2.834.25>2.83, R3 receives packets faster than the second link can send them: after the first packet the second link is always busy and is the bottleneck. (The statement says to neglect queuing delays, i.e. we assume that the buffer of R3 absorbs the surplus without loss and we do not add any further delay for the packets that wait; the exact waiting is accounted for by serving them back to back.)

The first packet reaches R3 at T7+τ7=4.5T_7+\tau_7=4.5 ms. Packet number kk (k=1,…,200k=1,\dots,200) then starts on the second link at 4.5+(k−1)⋅4.254.5+(k-1)\cdot4.25 ms (a check with the instants of arrival at R3 shows that each packet is already in R3 when its turn comes). The last one starts at 4.5+199⋅4.25=850.254.5+199\cdot4.25=850.25 ms and is entirely received by C after its transmission and propagation, without waiting for its ACK: TARQ=4.5+199⋅4.25+T4+τ4=850.25+0.25+2=852.5 ms.T_{\text{ARQ}}=4.5+199\cdot4.25+T_4+\tau_4=850.25+0.25+2=\mathbf{852.5\ ms}. Typical errors: using the first link as the bottleneck (200/3200/3 cycles of 8.58.5 ms =567=567 ms); counting the ACK of the last packet; using 200200 cycles of 4.254.25 ms without the initial 4.54.5 ms and the final 2.252.25 ms.

Question 4: GBN end-to-end, packet 2 lost. Now the sender D and the receiver C run a single GBN with N=3N=3 over the two links, with cumulative ACKs: ACK(n)\text{ACK}(n) means "I expect packet nn". The packets are pipelined by R3 (the second link, faster, adds only T4=0.25T_4=0.25 ms). The time of a cycle (first bit sent, ACK back at D, ACK of negligible size) is tG=T7+τ7+T4+τ4+τ4+τ7=0.5+4+0.25+2+2+4=12.75 ms.t_G=T_7+\tau_7+T_4+\tau_4+\tau_4+\tau_7=0.5+4+0.25+2+2+4=12.75\ \text{ms}. Again N T7=1.5<tGN\,T_7=1.5<t_G: the window is sent in 1.51.5 ms and then the sender idles until the ACK of the first packet returns. Without errors, there is one window every tGt_G: ⌈200/3⌉=67\lceil200/3\rceil=67 windows, the last one holding 200−66⋅3=2200-66\cdot3=2 packets, and the end is 66 tG+(2T7+τ7+T4+τ4)=841.5+7.25=848.75 ms.66\,t_G+(2T_7+\tau_7+T_4+\tau_4)=841.5+7.25=848.75\ \text{ms}.

With the loss. The minimum timeout of packet 2 is tGt_G counted from the start of its transmission (t=0.5t=0.5 ms), because the ACK cannot come back earlier: so the timer expires at 0.5+12.75=13.250.5+12.75=13.25 ms. Timeline (times in ms):

Time Event
00 – 1.51.5 window 1,2,31,2,3 is sent: packet 2 is lost on D–R3
6.756.75 packet 1 arrives at C; packet 3 arrives out of order and is discarded (GBN receiver: window of size 1) and C repeats ACK(2)\text{ACK}(2)
12.7512.75 ACK(2)\text{ACK}(2) reaches D: the window slides and packet 4 is sent (12.7512.75–13.2513.25)
13.2513.25 timeout of packet 2: D goes back and resends 2,3,42,3,4 (13.2513.25–14.7514.75)
26.026.0 ACK(3)\text{ACK}(3) for the retransmitted packet 2 (13.25+12.7513.25+12.75): window 5,6,75,6,7 starts

From the timeout on, the windows start every tGt_G: window jj (j=0,1,…j=0,1,\dots) starts at 13.25+12.75 j13.25+12.75\,j and carries packets 3j+2, 3j+3, 3j+43j+2,\,3j+3,\,3j+4. Packet 200=3⋅66+2200=3\cdot66+2 is the only packet of window j=66j=66, which starts at 13.25+66⋅12.75=854.7513.25+66\cdot12.75=854.75 ms, and arrives at C at TARQ=854.75+T7+τ7+T4+τ4=854.75+6.75=861.5 ms.T_{\text{ARQ}}=854.75+T_7+\tau_7+T_4+\tau_4=854.75+6.75=\mathbf{861.5\ ms}. Equivalently, the loss costs one extra cycle tG=12.75t_G=12.75 ms with respect to the error-free 848.75848.75 ms (848.75+12.75=861.5848.75+12.75=861.5). The cost per failure is tGt_G and not N T7N\,T_7 because N T7<tGN\,T_7<t_G: the timeout is longer than the time to send the window (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 →).

Hypothesis behind the official value: the minimum timeout is measured from the transmission of the lost packet (expiry at 13.2513.25 ms). If one counted 12.7512.75 ms from the start of the window (t=0t=0), the timeout would expire at 12.7512.75 ms, before the ACK of packet 2 could ever return (13.2513.25 ms): it would not be a valid timeout for packet 2 (and the total would be 861.0861.0 ms). Typical errors: using N T7N\,T_7 as the cost of the loss; retransmitting only packet 2 (that is Selective Repeat); forgetting that the receiver discards packet 3.

Exercise 2 (points 8)

Consider the network shown in the figure, to which is assigned the address block 131.175.208.0/21131.175.208.0/21.

Topology: router R0 is in the Internet (outside the block) and is linked to R1. R1 is the central router of the block and has three links: to R0, to R2, and to R3. R2 is connected by one link to a switch, to which LAN 1 (200 hosts) and LAN 2 (250 hosts) are attached. R3 has two LANs: LAN 3 (400 hosts) and LAN 4 (101 hosts). The links R1–R2 and R1–R3 are point-to-point links.

Question 1 (4 pt). Divide the network into sub-networks as shown in the figure above. For each of the sub-networks, indicate IP address, netmask, direct broadcast address, and maximum number of hosts it can contain (except for the link between R1 and R0).

Warning: IP addresses for point-to-point links have also to be configured, where needed.

Question 2 (4 pt). A router in the Internet has the following interface configuration and routing table:

Network Netmask Next hop
180.12.144.64180.12.144.64 255.255.255.192255.255.255.192 180.12.144.253180.12.144.253
180.12.144.0180.12.144.0 255.255.254.0255.255.254.0 180.12.144.40180.12.144.40
180.12.145.0180.12.145.0 255.255.255.192255.255.255.192 180.12.144.130180.12.144.130
180.12.145.64180.12.145.64 255.255.255.192255.255.255.192 180.12.144.200180.12.144.200
0.0.0.00.0.0.0 0.0.0.00.0.0.0 180.12.144.150180.12.144.150
Interface IP address Netmask MTU [B]
eth0 180.12.144.254180.12.144.254 255.255.255.192255.255.255.192 10001000
eth1 180.12.144.25180.12.144.25 255.255.255.192255.255.255.192 500500
eth2 180.12.144.180180.12.144.180 255.255.255.192255.255.255.192 12001200

Indicate how packets with the following destination IP addresses are handled. Indicate if direct or indirect forwarding is used (in case of indirect forwarding, indicate what is the next hop and its corresponding output interface), and whether and why the packet is dropped.

  • 180.12.144.95180.12.144.95 from eth1. Packet size is 300300 B and Don't Fragment bit set to 11.
  • 180.12.144.222180.12.144.222 from eth0. Packet size is 300300 B and Don't Fragment bit set to 11.
  • 180.12.144.25180.12.144.25 from eth0. Packet size is 400400 B and Don't Fragment bit set to 11.
  • 180.12.145.203180.12.145.203 from eth0. Packet size is 15 00015\,000 B and Don't Fragment bit set to 00 (in case IP fragmentation is needed, indicate how many fragments should be sent).
Show the result

Question 1:

Sub-network Address/netmask Direct broadcast Max hosts
LAN 1 + LAN 2 131.175.208.0/23131.175.208.0/23 (255.255.254.0255.255.254.0) 131.175.209.255131.175.209.255 510510
LAN 3 131.175.210.0/23131.175.210.0/23 (255.255.254.0255.255.254.0) 131.175.211.255131.175.211.255 510510
LAN 4 131.175.212.0/25131.175.212.0/25 (255.255.255.128255.255.255.128) 131.175.212.127131.175.212.127 126126
P2P R1–R2 131.175.214.0/30131.175.214.0/30 (255.255.255.252255.255.255.252) 131.175.214.3131.175.214.3 22
P2P R1–R3 131.175.214.4/30131.175.214.4/30 (255.255.255.252255.255.255.252) 131.175.214.7131.175.214.7 22

Question 2:

  • 180.12.144.95180.12.144.95 from eth1: indirect forwarding, next hop 180.12.144.253180.12.144.253 through eth0.
  • 180.12.144.222180.12.144.222 from eth0: no forwarding.
  • 180.12.144.25180.12.144.25 from eth0: delivered to the higher layers (it is the router's own address).
  • 180.12.145.203180.12.145.203 from eth0: indirect forwarding, next hop 180.12.144.40180.12.144.40 through eth1; 3232 fragments are sent.

These coincide with the official results (the sheet writes "etho0" and "etho1" for eth0 and eth1, obvious typos).

Show the full solution

Question 1: addressing plan (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 →).

Step 1: which sub-networks. LAN 1 and LAN 2 are attached to the same switch, which has a single link to R2: a switch does not separate broadcast domains, and R2 has a single interface on that side. They therefore form one IP network with 200+250=450200+250=450 hosts. (Splitting them would need VLANs or two interfaces of R2, which the figure does not show.) The block of R1 on the R0 side is excluded by the text. So the networks to address are five: the merged LAN 1+2, LAN 3, LAN 4 and the two point-to-point links.

Step 2: size of each block. A network with hh hosts needs 2b≥h+22^b\ge h+2 addresses (network address and direct broadcast are not assignable), with bb host bits and netmask /(32−b)/(32-b):

Network hosts h+2h+2 bb Netmask Max hosts
LAN 1+2 450450 452≤512452\le512 99 /23/23 510510
LAN 3 400400 402≤512402\le512 99 /23/23 510510
LAN 4 101101 103≤128103\le128 77 /25/25 126126
each P2P link 22 44 22 /30/30 22

(A /24/24 is too small for 450450 or 400400 hosts: it has only 254254; for LAN 4 a /26/26 has 6262 hosts, too few.)

Step 3: allocation. The block 131.175.208.0/21131.175.208.0/21 spans the third byte from 208208 to 215215 (8⋅256=20488\cdot256=2048 addresses; 510+510+126+2+2=1150510+510+126+2+2=1150 are used). A block must start at a multiple of its own size: a /23/23 occupies 22 values of the third byte and must start at an even one (208,210,…208,210,\dots). Starting from the largest blocks:

  • LAN 1+2: 131.175.208.0/23131.175.208.0/23, third byte from 208208 to 209209, broadcast 131.175.209.255131.175.209.255;
  • LAN 3: 131.175.210.0/23131.175.210.0/23, broadcast 131.175.211.255131.175.211.255;
  • LAN 4: 131.175.212.0/25131.175.212.0/25 (half of the third byte 212212: fourth byte from 00 to 127127), broadcast 131.175.212.127131.175.212.127;
  • the two /30/30 links in the free space, for example in 131.175.214.0131.175.214.0: R1–R2 131.175.214.0/30131.175.214.0/30 (broadcast .3.3) and R1–R3 131.175.214.4/30131.175.214.4/30 (broadcast .7.7).

The broadcast is the last address of the block (all host bits at 11). Any other allocation with disjoint, aligned blocks inside the /21/21 is correct; the one above is the official one.

Addresses of the interfaces (the warning of the text). A point-to-point link has two usable addresses, one per router: R1 131.175.214.1131.175.214.1 and R2 131.175.214.2131.175.214.2 on the first link; R1 131.175.214.5131.175.214.5 and R3 131.175.214.6131.175.214.6 on the second, both with netmask 255.255.255.252255.255.255.252. Each router also needs an address on its LANs (the default gateway of the hosts), for example R2 131.175.208.1/23131.175.208.1/23, R3 131.175.210.1/23131.175.210.1/23 on LAN 3 and 131.175.212.1/25131.175.212.1/25 on LAN 4. For the R1–R0 link a further /30/30 block would be needed (not required by the text). The external router R0 needs a single route for the whole network, 131.175.208.0/21131.175.208.0/21, thanks to aggregation (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 →). All the blocks were checked to be pairwise disjoint and inside the /21/21.

Typical errors: treating LAN 1 and LAN 2 as two networks behind the same switch; /24/24 for 450450 hosts; blocks not aligned (for example a /23/23 starting at 209209); forgetting that the /30/30 links need an address too; counting network and broadcast among the hosts.

Question 2: forwarding (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 →, IPv4 Datagram and FragmentationIPv4 is a connectionless, unreliable best-effort service; the header is 20 to 60 bytes (HLen counts 4-byte words), TTL limits hops, Protocol identifies the payload (1 ICMP, 6 TCP, 17 UDP) and the checksum covers only the header; a datagram larger than the link MTU is fragmented (only the payload is split, offsets are in units of 8 bytes, MF is 1 in all fragments but the last) and reassembled only at the destination.IPv4 Datagram and Fragmentation →).

Networks of the interfaces (netmask 255.255.255.192255.255.255.192, i.e. /26/26, blocks of 6464 addresses: the last byte is rounded down to a multiple of 6464):

  • eth0: 254→192254\to192: network 180.12.144.192/26180.12.144.192/26 (last byte 192192–255255);
  • eth1: 25→025\to0: network 180.12.144.0/26180.12.144.0/26 (last byte 00–6363);
  • eth2: 180→128180\to128: network 180.12.144.128/26180.12.144.128/26 (last byte 128128–191191).

Reach of the table rows (the /26/26 rows cover 6464 addresses; the row with 255.255.254.0255.255.254.0 is a /23/23 covering 180.12.144.0180.12.144.0–180.12.145.255180.12.145.255, 512512 addresses):

  • 180.12.144.64/26180.12.144.64/26: last byte 6464–127127, next hop .253.253 (on eth0);
  • 180.12.144.0/23180.12.144.0/23: next hop .40.40 (on eth1);
  • 180.12.145.0/26180.12.145.0/26: third byte 145145, last byte 00–6363, next hop .130.130 (on eth2);
  • 180.12.145.64/26180.12.145.64/26: last byte 6464–127127, next hop .200.200 (on eth0);
  • default: next hop .150.150 (on eth2).

The output interface of a next hop is the one whose network contains it. Procedure: first the direct delivery check (destination in an interface network), then the longest prefix match on the table; then the checks on MTU and DF.

Packet Analysis Outcome
180.12.144.95180.12.144.95 from eth1, 300300 B, DF=1=1 not the router's own address; 9595 is in none of the interface networks (00–6363, 128128–191191, 192192–255255). Rows that contain it: the /26/26 row .64.64 (64≤95≤12764\le95\le127) and the /23/23; the longest prefix is the /26/26: next hop 180.12.144.253180.12.144.253, which is in the network of eth0. MTU eth0 =1000≥300=1000\ge300 indirect forwarding, next hop 180.12.144.253180.12.144.253, through eth0
180.12.144.222180.12.144.222 from eth0, 300300 B, DF=1=1 222222 is in the network of eth0 (192192–255255), the one the packet came from: the destination is on the same network as the sender, which has already reached it directly (the destination received the frame on the shared medium). The router does not send the packet back on the network it came from no forwarding
180.12.144.25180.12.144.25 from eth0, 400400 B, DF=1=1 it is exactly the IP address of the interface eth1 of this router: the packet is for the router itself delivered to the higher layers (no forwarding; with MTU 500500 on eth1 nothing is sent)
180.12.145.203180.12.145.203 from eth0, 15 00015\,000 B, DF=0=0 not in an interface network. Third byte 145145: the row 180.12.145.0/26180.12.145.0/26 covers last byte 00–6363 and the row 180.12.145.64/26180.12.145.64/26 covers 6464–127127: 203203 is in neither. The /23/23 row matches: next hop 180.12.144.40180.12.144.40 on eth1, MTU 500<15 000500<15\,000 and DF=0=0: fragmentation indirect forwarding, next hop 180.12.144.40180.12.144.40, through eth1, 3232 fragments

Fragmentation of the last packet (IPv4 Datagram and FragmentationIPv4 is a connectionless, unreliable best-effort service; the header is 20 to 60 bytes (HLen counts 4-byte words), TTL limits hops, Protocol identifies the payload (1 ICMP, 6 TCP, 17 UDP) and the checksum covers only the header; a datagram larger than the link MTU is fragmented (only the payload is split, offsets are in units of 8 bytes, MF is 1 in all fragments but the last) and reassembled only at the destination.IPv4 Datagram and Fragmentation →). The IP header is 2020 B, so the payload is 15 000−20=14 98015\,000-20=14\,980 B. Each fragment carries at most 500−20=480500-20=480 B of data, which is already a multiple of 88 (480=8⋅60480=8\cdot60, the offset field counts units of 88 B). Number of fragments: ⌈14 980/480⌉=⌈31.2⌉=32\lceil14\,980/480\rceil=\lceil31.2\rceil=32: 3131 fragments with 480480 B of data (31⋅480=14 88031\cdot480=14\,880) and a last one with 14 980−14 880=10014\,980-14\,880=100 B of data. Remark: the sheet does not say how a 15 00015\,000 B packet entered eth0, whose MTU is 10001000 B (it would have been fragmented earlier); the official result 3232 ignores this and counts the fragmentation at the output on eth1 only.

Typical errors: reading the rows with the wrong mask (for the row 180.12.145.0180.12.145.0 the third byte is 145145 and the fourth must be in 00–6363: 203203 is not); using the first matching row instead of the longest prefix; forgetting the check that the destination is the router itself or lies on the arrival network; forgetting to subtract the 2020 B header in the fragmentation; rounding the data per fragment to a non-multiple of 88.

Self-assessment grid
Exercise Points What must be there for full marks Typical errors
1, Question 1 4 T=L/CT=L/C of each link; arrival in R1 of all packets; FIFO service on the shared link C2C_2 in order of arrival; results 17.5517.55, 19.5519.55, 23.5523.55 ms ignoring the packets of A on C2C_2; wrong FIFO order; bits and bytes
1, Question 2 2 RTT equation with transmission on the three links and double propagation; two equations; difference gives C7=24C_7=24 Mbit/s, then τ7=4\tau_7=4 ms counting the transmission of the ACK; not subtracting the two equations
1, Question 3 3 200200 packets; GBN link with cycle 8.58.5 ms (window 33), S&W link with cycle 4.254.25 ms is the bottleneck; 4.5+199⋅4.25+2.25=852.54.5+199\cdot4.25+2.25=852.5 ms taking the GBN link as bottleneck; counting the last ACK
1, Question 4 3 tG=12.75t_G=12.75 ms, timeout expiring at 13.2513.25 ms, go-back to packet 2, windows every 12.7512.75 ms, last window with packet 200 only; 861.5861.5 ms (error-free 848.75848.75 plus one cycle) N T7N\,T_7 as cost of the loss; selective retransmission; timeout counted from t=0t=0
2, Question 1 4 LAN 1+2 as one network (/23/23); sizes /23/23, /23/23, /25/25, /30/30, /30/30; aligned disjoint blocks inside the /21/21; netmask, broadcast and maximum hosts; addresses of the point-to-point interfaces two separate networks behind the same switch; wrong alignment; wrong maximum hosts
2, Question 2 4 networks of the interfaces; longest prefix match; own address and arrival network cases; MTU and DF; 3232 fragments (31⋅480+10031\cdot480+100) wrong mask on a row; ignoring the destination on the arrival network; 2020 B header in the payload