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, 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 out of 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 |
|---|---|---|---|
| S – R1 | Mbit/s | ms | |
| R1 – R2 | Mbit/s | ms | |
| R2 – R3 | Mbit/s | ms | |
| R3 – C | Mbit/s | ms | |
| R1 – A | Mbit/s | ms | |
| R2 – B | Mbit/s | ms | |
| R3 – D |
(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 , 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 Byte, and assuming that packet transmissions start at time 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 () and the propagation delay () 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 Bytes, while the size of the second ping is Bytes. The measured RTT (from the time the ping is sent to the time the corresponding ACK is received) is ms for the first ping and ms for the second ping.
Question 2 (2 pt). Determine the value of and . 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 Mbps and ms, and consider the transmission of a message of KByte, split in packets of 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 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 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 ms, ms and ms.
- Question 2: Mbit/s, ms.
- Question 3: ms.
- Question 4: 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 B bit, so the transmission time on a link is (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 for ms:
| Link | ||||||
|---|---|---|---|---|---|---|
| ms | ms | ms | ms | ms | ms |
(for example ms). The paths are: S to C uses ; A to B uses . The two flows meet only on (the output queue of R1 towards R2), so the packets of A delay those of S there. After they separate: S goes on to R3 on , A to B on . 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 :
| Packet | end of transmission | arrival in R1 |
|---|---|---|
Queue of ( ms). The order of arrival in R1 is , , , , , . A packet starts when it has arrived and the link is free:
| Packet | ready | start | end | arrival in R2 () |
|---|---|---|---|---|
The packets of A leave R2 on towards B and do not matter any more. The packets of S go on to R3 on ; they arrive at R2 at least ms apart, while their transmission lasts ms, so they never wait there:
| Packet | start | end | arrival in R3 () | end () | arrival in C () |
|---|---|---|---|---|---|
Check on : alone in the network it would arrive after ms. The actual ms differs by ms, which is exactly the time waits in R1 for to finish on (). Typical errors: forgetting that A shares with S; putting before in the queue of because it was ready earlier at the host (the order that counts is the arrival in R1: at , at ); mixing bytes and bits ( B is bit).
Question 2: capacity and delay of the link R3–D. The ping goes B–R2–R3–D on . 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): The propagation part is ms. For the first ping, bit: ms, ms, so For the second ping, B bit: ms, ms, so Two equations in two unknowns: subtracting them removes (the propagation delay does not depend on the size of the packet): Then ms and ms, so . Check with the second ping: 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 packets ( KByte B, as the official result confirms). Per-link times with Mbit/s: ms, ms on the first link (D–R3), ms, 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 . One cycle is ms, and the window needs only ms to be sent: the transmission is not continuous; the sender sends packets and then waits for the ACK of the first. The first link therefore delivers packets every ms to R3, i.e. one every ms on average (the pipe holds packets, the window only ).
Second link, S&W. Each packet occupies the link until its ACK is back: ms per packet. Since , 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 ms. Packet number () then starts on the second link at 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 ms and is entirely received by C after its transmission and propagation, without waiting for its ACK: Typical errors: using the first link as the bottleneck ( cycles of ms ms); counting the ACK of the last packet; using cycles of ms without the initial ms and the final ms.
Question 4: GBN end-to-end, packet 2 lost. Now the sender D and the receiver C run a single GBN with over the two links, with cumulative ACKs: means "I expect packet ". The packets are pipelined by R3 (the second link, faster, adds only ms). The time of a cycle (first bit sent, ACK back at D, ACK of negligible size) is Again : the window is sent in ms and then the sender idles until the ACK of the first packet returns. Without errors, there is one window every : windows, the last one holding packets, and the end is
With the loss. The minimum timeout of packet 2 is counted from the start of its transmission ( ms), because the ACK cannot come back earlier: so the timer expires at ms. Timeline (times in ms):
| Time | Event |
|---|---|
| – | window is sent: packet 2 is lost on D–R3 |
| packet 1 arrives at C; packet 3 arrives out of order and is discarded (GBN receiver: window of size 1) and C repeats | |
| reaches D: the window slides and packet 4 is sent (–) | |
| timeout of packet 2: D goes back and resends (–) | |
| for the retransmitted packet 2 (): window starts |
From the timeout on, the windows start every : window () starts at and carries packets . Packet is the only packet of window , which starts at ms, and arrives at C at Equivalently, the loss costs one extra cycle ms with respect to the error-free ms (). The cost per failure is and not because : 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 ms). If one counted ms from the start of the window (), the timeout would expire at ms, before the ACK of packet 2 could ever return ( ms): it would not be a valid timeout for packet 2 (and the total would be ms). Typical errors: using 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 .
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 |
|---|---|---|
| Interface | IP address | Netmask | MTU [B] |
|---|---|---|---|
| eth0 | |||
| eth1 | |||
| eth2 |
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.
- from eth1. Packet size is B and Don't Fragment bit set to .
- from eth0. Packet size is B and Don't Fragment bit set to .
- from eth0. Packet size is B and Don't Fragment bit set to .
- from eth0. Packet size is B and Don't Fragment bit set to (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 | () | ||
| LAN 3 | () | ||
| LAN 4 | () | ||
| P2P R1–R2 | () | ||
| P2P R1–R3 | () |
Question 2:
- from eth1: indirect forwarding, next hop through eth0.
- from eth0: no forwarding.
- from eth0: delivered to the higher layers (it is the router's own address).
- from eth0: indirect forwarding, next hop through eth1; 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 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 hosts needs addresses (network address and direct broadcast are not assignable), with host bits and netmask :
| Network | hosts | Netmask | Max hosts | ||
|---|---|---|---|---|---|
| LAN 1+2 | |||||
| LAN 3 | |||||
| LAN 4 | |||||
| each P2P link |
(A is too small for or hosts: it has only ; for LAN 4 a has hosts, too few.)
Step 3: allocation. The block spans the third byte from to ( addresses; are used). A block must start at a multiple of its own size: a occupies values of the third byte and must start at an even one (). Starting from the largest blocks:
- LAN 1+2: , third byte from to , broadcast ;
- LAN 3: , broadcast ;
- LAN 4: (half of the third byte : fourth byte from to ), broadcast ;
- the two links in the free space, for example in : R1–R2 (broadcast ) and R1–R3 (broadcast ).
The broadcast is the last address of the block (all host bits at ). Any other allocation with disjoint, aligned blocks inside the 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 and R2 on the first link; R1 and R3 on the second, both with netmask . Each router also needs an address on its LANs (the default gateway of the hosts), for example R2 , R3 on LAN 3 and on LAN 4. For the R1–R0 link a further block would be needed (not required by the text). The external router R0 needs a single route for the whole network, , 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 .
Typical errors: treating LAN 1 and LAN 2 as two networks behind the same switch; for hosts; blocks not aligned (for example a starting at ); forgetting that the 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 , i.e. , blocks of addresses: the last byte is rounded down to a multiple of ):
- eth0: : network (last byte –);
- eth1: : network (last byte –);
- eth2: : network (last byte –).
Reach of the table rows (the rows cover addresses; the row with is a covering –, addresses):
- : last byte –, next hop (on eth0);
- : next hop (on eth1);
- : third byte , last byte –, next hop (on eth2);
- : last byte –, next hop (on eth0);
- default: next hop (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 |
|---|---|---|
| from eth1, B, DF | not the router's own address; is in none of the interface networks (–, –, –). Rows that contain it: the row () and the ; the longest prefix is the : next hop , which is in the network of eth0. MTU eth0 | indirect forwarding, next hop , through eth0 |
| from eth0, B, DF | is in the network of eth0 (–), 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 |
| from eth0, B, DF | 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 on eth1 nothing is sent) |
| from eth0, B, DF | not in an interface network. Third byte : the row covers last byte – and the row covers –: is in neither. The row matches: next hop on eth1, MTU and DF: fragmentation | indirect forwarding, next hop , through eth1, 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 B, so the payload is B. Each fragment carries at most B of data, which is already a multiple of (, the offset field counts units of B). Number of fragments: : fragments with B of data () and a last one with B of data. Remark: the sheet does not say how a B packet entered eth0, whose MTU is B (it would have been fragmented earlier); the official result ignores this and counts the fragmentation at the output on eth1 only.
Typical errors: reading the rows with the wrong mask (for the row the third byte is and the fourth must be in –: 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 B header in the fragmentation; rounding the data per fragment to a non-multiple of .
Self-assessment grid
| Exercise | Points | What must be there for full marks | Typical errors |
|---|---|---|---|
| 1, Question 1 | 4 | of each link; arrival in R1 of all packets; FIFO service on the shared link in order of arrival; results , , ms | ignoring the packets of A on ; 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 Mbit/s, then ms | counting the transmission of the ACK; not subtracting the two equations |
| 1, Question 3 | 3 | packets; GBN link with cycle ms (window ), S&W link with cycle ms is the bottleneck; ms | taking the GBN link as bottleneck; counting the last ACK |
| 1, Question 4 | 3 | ms, timeout expiring at ms, go-back to packet 2, windows every ms, last window with packet 200 only; ms (error-free plus one cycle) | as cost of the loss; selective retransmission; timeout counted from |
| 2, Question 1 | 4 | LAN 1+2 as one network (); sizes , , , , ; aligned disjoint blocks inside the ; 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; fragments () | wrong mask on a row; ignoring the destination on the arrival network; B header in the payload |