IK2218 Homework - 2 - Solutions PDF

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

EP2120 Internetworking

IK2218 Protocols and Principles of the Internet

Homework assignment 2
(Solutions due 20:00, Tuesday, 17 Sep 2019)
(Review due 20:00, Thursday, 19 Sep 2019)

1. ARP (20/100)

m
er as
co
eH w
o.
rs e
ou urc
o
aC s
vi y re

The figure above illustrates six hosts H1, H2, H3, H4, H5 and H6 connected by an internetwork
running IPv4. The learning bridge B1 connects hosts H1, H2, and router R1, the learning bridge
B2 connects routers R1, R2, hosts H5, and H6 and the learning bridge B3 connects hosts H3, H4,
and router R2. For the hosts and routers, the interfaces’ logical (IP) addresses are shown with
ed d

capital letters, and physical (MAC) addresses are shown with small letters. The interfaces of
ar stu

the bridges are denoted by N, E, S or W.


Assume that the ARP caches of the routers and of the hosts, and the MAC address tables of
the bridges are initially empty and that no packets have been sent yet. The forwarding tables
of all hosts and routers are correctly configured. All hosts know the IP addresses of each
is

other. ARP snooping (also called passive ARP learning) is enabled.


Th

Consider that host H1 sends an IPv4 unicast datagram to host H4.

Let us first look at how the datagram will be delivered.


The steps are the following:
sh

1) Host H1 knows the IP address of Host H4 . Based on its forwarding table, host H1
knows that host H4 is not on the same subnet and knows that router R1 is the next hop.
Hence, H1 has to forward the datagram to router R1. Host H1 knows the IP address of
router R1 but does not know its MAC address. Hence it will perform an ARP request for
the IP address ‘E’.
2) The ARP request is received by the bridge B1 on its interface ‘North’, and the bridge
forwards the request on all the other interfaces. Hence, the request is received by host H 2

This study source was downloaded by 100000832311862 from CourseHero.com on 09-20-2021 06:54:19 GMT -05:00

https://www.coursehero.com/file/49077920/Homework-2-solutionspdf/
and by router R1. Both will learn the binding (A,a). (H2 learns it because of ARP
snooping. It would not learn it if ARP snooping was disabled.) Bridge B 1 learns that the
MAC address ‘a’ is on its ‘North’ interface.
3) Router R1 replies to the ARP request, and provides its MAC address.
4) Bridge B1 learns that the MAC address ‘e’ is on its 'East' interface.
5) Bridge B1 forwards the ARP reply on its ‘North’ interface to H1, which learns the MAC
address of router R1 and stores the pair (E,e) in its ARP table. Note that H2 does not
receive the ARP reply.
6) Host H1 can send the datagram to router R1 now.
7) Upon receiving the datagram, router R1 checks its forwarding table and finds based on
the destination IP address that host H4 is not on the same subnet and knows that router R2
is the next hop. Hence, R1 sends an ARP request for IP address ‘G’.
8) Bridge B2 learns that the MAC address ‘f’ is on its ‘West’ interface. It forwards the
ARP request on its ‘South’, ‘North’, and ‘East’ interfaces. H5, H6 and R2 learn the binding
(F,f).
9) Router R2 notices that the ARP request is intended for itself, and sends an ARP reply to
router R1. Router R1 learns the binding of (G,g).
10) Router R1 can send the datagram to router R2 now.
11) Upon receiving the datagram, router R2 checks its forwarding table and finds based

m
on the destination IP address that host H4 is on a directly connected subnet. It thus sends

er as
an ARP request for IP address ‘D’.

co
12) Bridge B3 learns that the MAC address ‘h’ is on its ‘West’ interface. It forwards the

eH w
ARP request on its ‘North’, and ‘South’ interfaces. Hosts H3 and H4 learn the binding
(H,h).

o.
rs e
13) Host H4 notices that the ARP request is intended for itself, and sends an ARP reply to
router R2.
ou urc
14) Router R2 receives the ARP reply and stores the pair (D,d) in its ARP table.
15) Router R2 can now forward the datagram to H4.
o

(This explanation is not part of the expected solution, but it explains the reasoning that
aC s

leads to the correct solution.)


vi y re

a) Provide the state of the eight ARP caches of the hosts and routers as they will appear after
the IPv4 unicast datagram has been delivered to host H4, that is, after dynamic ARP
resolution has been made (16p).
ed d
ar stu

Based on the above description the ARP tables of the hosts are:
H1: (E,e)
H2: (A,a)
H3: (H,h)
is

H4: (H,h)
H5: (F,f)
Th

H6: (F,f)
R1: (A,a), (G,g)
R2: (F,f), (D,d)
sh

(If ARP snooping is not enabled then the ARP tables of H2, H3, H5 and H6 are empty.)

b) Provide the state of the MAC table of bridge B3 as it will appear after the IPv4 unicast
datagram has been delivered to host H4, that is, after dynamic ARP resolution has been
made. (4p)

This study source was downloaded by 100000832311862 from CourseHero.com on 09-20-2021 06:54:19 GMT -05:00

https://www.coursehero.com/file/49077920/Homework-2-solutionspdf/
Based on the above description, the MAC address table of B3 is:
B3: (h, West), (d, South)

2. UDP and fragmentation (15/100)


Assume that an Ethernet network with an MTU of 1400 bytes connects hosts A and B. An
application process on Host A sends 6476 bytes of application data via UDP to a process on
Host B. IPv4 is used at the network layer.

Let us first look at how the datagram will be fragmented. There are 6484 bytes of payload for
IP to send (6476 bytes UDP payload and 8 bytes of UDP header). Each link layer frame can
contain 1400 bytes of payload. Every fragment has to contain an IP header, of course, which
takes 20 bytes (assuming options are not used). The fragment length has to be a multiple of 8
bytes (except for the last fragment), so that up to floor[(1400-20)/8]*8=1376 bytes of data
can be sent in one IP fragment (but the last one). Note that the length of fragments, except the
last one, has to be divisible by 8.

a) How many fragments are transmitted? (5p)

m
5(five), because 3*1376+1380<6484<=4*1376+1380

er as
co
b) Give the values of the MF bit, the offset and the total length field of the IP header of

eH w
each fragment! (10p)

o.
rs e
Using the "tcpdump" notation (offset in bytes):
ou urc
Fragment 1: 1396@0+ (1376 bytes of data, offset of 0 bytes, and more fragments bit
set)
Fragment 2: 1396@1376+
Fragment 3: 1396@2752+
o

Fragment 4: 1396@4128+
aC s

Fragment 5: 1000@5504(no more fragments)


vi y re

Any other notation that contains the same information is correct (e.g., the offset could
be divided by 8, as it is contained in the IP header, or one could provide the total length
of the IP payloads, which are the total length of the IP header of each segment -20
ed d

shown above). It is important, however, to specify what the solution contains (e.g., offset
ar stu

byte vs. contents of the offset field).

3. Routing (25/100)
is
Th
sh

This study source was downloaded by 100000832311862 from CourseHero.com on 09-20-2021 06:54:19 GMT -05:00

https://www.coursehero.com/file/49077920/Homework-2-solutionspdf/
In the IPv4 network shown in the figure all routers (A-E) run RIPv2 and all link metrics are 1.
The addresses of the IPv4 networks and the associated interface addresses are given in the
figure. Note that the letters A-E denote routers. Assume that initially only the addresses of the
directly connected networks are known to the routers. The destinations in the network are the
/24 prefixes. Assume also that all RIP implementations support Equal-cost-multi-path
(ECMP). All routers implement split-horizon.

Express routes as 'destination, metric, next-hop'. If the destination is a directly connected


network, the route is given as 'destination, metric, -'.

a) What is the initial routing state of A? (5p)

192.168.1.0/24, 1, -
192.168.2.0/24, 1, -
192.168.3.0/24, 1, -

b) Assume that the first event that happens in the network is that A starts by sending RIP
responses to its neighbors. What is the routing state of C after it has received the initial
distance-vector from A? (5p)

m
er as
192.168.1.0/24, 2, 192.168.2.1

co
192.168.2.0/24, 1, -

eH w
192.168.3.0/24, 2, 192.168.2.1
192.168.4.0/24, 1, -

o.
rs e
c) Assume that the second event that happens in the network is that router C sends RIP
ou urc
responses to its neighbors. Please list the RIP responses that C sends. You should indicate
the source and destination address of each RIP response, on which interface they are sent
out (and to which IP address(es)) and which distance-vectors (destination, metric tuples)
o

are contained in each message. (5p)


aC s
vi y re

On the east interface, C sends a RIP response message with src address 192.168.4.1 and
destination address 224.0.0.9. The distance-vector of this message using split-horizon is:
192.168.1.0/24, 2
192.168.2.0/24, 1
ed d

192.168.3.0/24, 2
ar stu

(# RIP implementations may announce network 192.168.4.0/24, but it is not necessary


since all connected routers have this as a directly connected network: it is accepted both
to have this route and to omit it)
is

On the north interface, C sends a RIP response message with src address 192.168.2.2 and
Th

destination address 224.0.0.9. The distance-vector of this message using split-horizon is:
192.168.4.0/24, 1
sh

(# RIP implementations may announce network 192.168.2.0/24, but it is not necessary


since all connected routers have this as a directly connected network: it is accepted both
to have this route and to omit it)

This study source was downloaded by 100000832311862 from CourseHero.com on 09-20-2021 06:54:19 GMT -05:00

https://www.coursehero.com/file/49077920/Homework-2-solutionspdf/
d) After step (c) the routers send out RIP responses to their neighbors simultaneously every
30 seconds, and the first RIP updates after c) are sent out at t=0. How long does it take for
B to learn all the networks? Motivate your answer. (4p)

At t=0, after A receives the RIP response from D, all the networks are known to A.
Therefore, at t=30s B receives RIP response from A and then B learns all the networks.

e) In d), assume that after the routing tables of all the routers converge (e.g., the routes and
their metrics are not changing anymore), the east interface of D is turned off by mistake.
After this, the first RIP updates are sent out at t=120s by the routers simultaneously. Can
the routing tables of the routers converge by t=180s, assuming the routers continue
sending updates simultaneously every 30s? Motivate your answer. (6p)
Hint: Please consult rfc2453 for details on timers, expiration, etc
(https://tools.ietf.org/html/rfc2453#page-24).

Turning off the east interface of D only affects the entries about network 192.168.5.0/24,
so we only need to consider those entries.

At t=120s, C and A tell each other that network 192.168.5.0/24 can be reached with

m
metric 2, and D notifies A and C that network 192.168.5.0/24 is not reachable anymore

er as
through D. Thus A and C update their metrics to network 192.168.5.0/2 to 3, and set each

co
other as the next hop.

eH w
At t=150s, A and C notify D that network 192.168.5.0/24 can be reached with metric 3.

o.
rs e
Thus D updates its metric to network 192.168.5.0/24 to 4, and then sets A and C as the
next hop due to the ECMP.
ou urc
At t=180s, since D learned its route to network 192.168.5.0/24 via A and C, D will not
update A and C about network 192.168.5.0/24 (split horizon). Also, since A and C learned
o

their routes to network 192.168.5.0/24 from each other, A and C will not update each
aC s

other about network 192.168.5.0/24. At the same time, A and C will again notify D that
vi y re

network 192.168.5.0/24 is reachable with metric 3.

This continues until the timeout timer for the routes of A and C to network 192.168.5.0/24
expires, and then A and C set their metric to network 192.168.5.0/24 to16. After this, in
ed d

the next RIP updates, A and C notify D that network 192.168.5.0/24 is unreachable
ar stu

(metric 16), and then D sets its metric to network 192.168.5.0/2 to 16. The resulting routes
with metric 16 will be removed from the routing tables of the routers when the garbage-
collection timer expires. Therefore, the routing tables of the routers will not converge by
t=180s.
is
Th
sh

This study source was downloaded by 100000832311862 from CourseHero.com on 09-20-2021 06:54:19 GMT -05:00

https://www.coursehero.com/file/49077920/Homework-2-solutionspdf/
4. ICMP (15/100)

The hosts H1 and H2 are connected by networks running IPv4. The forwarding tables of all
hosts and routers are correctly configured. Note that the letters A and B denote routers.

a) H1 performs a traceroute to host H2 relying on ICMP. Traceroute is configured to


send one message for each hop. Please list the first and the last ICMP messages that
H1 sends, and the corresponding replies that H1 receives (10p).

The first ICMP message and its response:

m
er as
H1 sends an ICMP Echo Request (Type 8) message to 10.0.3.2 with the TTL field set
to 1. Router A receives the message, decrements the TTL to 0 and drops the packet.

co
eH w
Router A replies to 10.0.1.2 with an ICMP Time Exceeded message. H1 learns that
10.0.1.1 is the IP address of one of the interfaces of the first router on the path to H3.

o.
rs e
The last ICMP message and its response:
ou urc
H2 sends an ICMP Echo Request (Type 8) message to 10.0.3.2 with the TTL field set
to 3. After H3 receives the ICMP Echo Request, H3 replies to 10.0.1.2 with an ICMP
Echo Reply packet. H1 then knows that the destination is reached.
o
aC s

b) Assume that H1 sends a UDP unicast datagram to 10.0.2.2 with TTL=2 but there is no
vi y re

application listening at the specified destination UDP port. Will H1 receive any ICMP
message (3p)?

If the answer is yes, please specify the sender and the type of the ICMP message,
ed d

otherwise, please motivate your answer.


ar stu

The UDP datagram arrives at B with TTL=1. However, as B is the destination of the
UDP datagram, B behaves as a normal host. Since the UDP datagram cannot be
is

delivered to the destination UDP port, B will send an ICMP destination unreachable
message (type 3) to H1.
Th

c) A and B are configured to forward datagrams with a directed broadcast address.


Consider that H1 sends a UDP segment to 10.0.3.255 with TTL=10. However, none of
the routers and hosts on the target network has a process listening at the specified
sh

destination UDP port. Will H1 receive any ICMP message (2p)?

If the answer is yes, please specify the sender and the type of the ICMP message,
otherwise, please motivate your answer.

This study source was downloaded by 100000832311862 from CourseHero.com on 09-20-2021 06:54:19 GMT -05:00

https://www.coursehero.com/file/49077920/Homework-2-solutionspdf/
Since the UDP datagram H1 sends has a broadcast destination address, none of the
routers and hosts will return an ICMP error message. This is to avoid a flood of
ICMP destination unreachable messages from all routers and hosts to H1.

5. TCP (25/100)
Consider a recently established TCP connection between processes PA and PB on hosts A and
B, respectively. The three-way handshake has been completed, but no data has been sent yet.
TCP on Host B announced a receiver window size of 4500 bytes to TCP on Host A, and
Process PB can read the received data from TCP as soon as they arrive. Process PA has 9000
bytes to send via TCP. The path MTU between the two hosts is known to be 1165 bytes. The
propagation time is 150ms, and the link speed is 1Mbps. It takes 1ms for TCP to generate a
segment (with or without data) and this can be done in parallel with sending a previously
generated segment.
The receiver uses delayed acknowledgements with a delay of 400ms (or at most two full
segments). The size of a segment having a TCP header only is negligible in terms of
transmission time. Moreover, for segments containing TCP payload, the size of the headers
can be neglected when computing the transmission time of the segment. IPv4 is used as a
network layer protocol and IP options are not used. Process PA sends the first segment at time

m
t0 with sequence number 0. CWND is originally set to 1 MSS (packet loss was experienced

er as
during connection establishment, as per RFC5681) and the slow start threshold is 65535 bytes.

co
Assume that the granularity G of the heartbeat timer is 0.5 seconds.

eH w
o.
a) What is the MSS used by TCP? (2p)
rs e
ou urc
MSS = MTU –IP header - TCP header = 1165 – 20 – 20 = 1125 bytes.

b) What is the bandwidth-delay product of the communication channel? Is the advertised


receiver window of B big enough to fully utilize the channel? If not, how big should it be
o

for A to be able to fully utilize the channel? (5p)


aC s
vi y re

BWxDelay = BW*RTT = (1*10^6) *(2*150*10^-3) = 3*10^5 bits = 37.5 kB


The receiver window (4.5 kB) is not big enough. It has to be at least 37.5 kB to fully utilize the
channel.
ed d

c) Provide the sequence of segments sent by TCP from host A. For each segment sent
ar stu

from host A provide the time it is sent, and the sequence number of the first byte it
contains. For the first five segments sent from host A also provide the SRTT, RTTVAR
and the RTO values of the sender TCP at the time the segment is sent. Assume that
outgoing segments are handled before incoming segments in case more than one event
is

happens at the same time! (15p)


Th

Notes:
1) As of June 2011, RFC2988 has been obsoleted by RFC6298. RFC6298 states that the
initial RTO should be set to 1 s, instead of the previous 3 s. Either solution should be
sh

considered correct.
2) RFC6298 says that if the computed RTO is below 1s then the RTO should be rounded
up to 1s. In RFC terminology SHOULD is a recommendation that one may deviate
from if one knows what one is doing, and in fact most popular TCP implementations
use a minimum RTO well below 1s (200ms in Linux, approx. 300ms in Windows). We
thus consider both the computed RTO (if computed according to the RFC) and a
rounded up value to 1s to be correct.

This study source was downloaded by 100000832311862 from CourseHero.com on 09-20-2021 06:54:19 GMT -05:00

https://www.coursehero.com/file/49077920/Homework-2-solutionspdf/
Host A will need to send a total of 8 segments to host B. The transmission time of a full
sized segment is (1125*8) / (10^6)=9ms, and the transmission time of an ACK segment is 0
ms (we ignore it for simplicity, as stated in the problem). In what follows all values are given
in milliseconds.

Solution without RTT measurement during connection establishment.


After connection establishment (at time t0), RTO = 1000ms, SRTT = 0, RTTVAR = 0.
SRTT RTTVAR RTO
1) 0 0 1000

ACK received at t0+710. Measured RTT = 710 ms.


SRTT = RTT = 710 ms.
RTTVAR = RTT/2 = 355 ms.
RTO = SRTT + max(G, 4*RTTVAR) = 710 + 4*355 = 2130 ms.

2) 710 355 2130


3) 710 355 2130

m
ACK received at t0+1030. Measured RTT = 319 ms.

er as
RTTVAR = 0.75*355+ 0.25*|710 – 319| = 364 ms (note that it is RTTVAR that is first

co
updated)

eH w
SRTT = 0.875*710 + 0.125*319 = 661.125 ms
RTO = 661.125 + 4*364 = 2117.125 ms

o.
4) 661.125 rs e 364 2117.125
ou urc
5) 661.125 364 2117.125
o
aC s

d) At what time does A receive the acknowledgement for the last segment? (3p)
vi y re

At t0+2070 ms.

Hint 1: Try to first draw the sequence of segment exchanges to get the order of the segments
ed d

right.
ar stu

Hint 2: Consult RFC 6298 for details on how to calculate the SRTT, RTTVAR and the RTO.
The description provided in the course book (3ed and 4ed) is not correct. Consult
RFC5681 for congestion control.
is

Grading suggestions: Important things to consider are whether flow control and congestion
control are correctly accounted for (slow start, and max 4 segments outstanding). Delayed
Th

ACKs are also important, there should be 1 ACK for every two segments OR a delay of 400
ms. The 1 ms to prepare segments was added to spread out the reception of the segments
slightly, missing it is not a major issue, but the solution should be consistent. Missing the
sh

transmission time (9 ms) is a mistake.

This study source was downloaded by 100000832311862 from CourseHero.com on 09-20-2021 06:54:19 GMT -05:00

https://www.coursehero.com/file/49077920/Homework-2-solutionspdf/
m
er as
co
eH w
o.
rs e
ou urc
o
aC s
vi y re

In the figure, delayed ACKs are indicated by red.


ed d
ar stu
is
Th
sh

This study source was downloaded by 100000832311862 from CourseHero.com on 09-20-2021 06:54:19 GMT -05:00

https://www.coursehero.com/file/49077920/Homework-2-solutionspdf/
Powered by TCPDF (www.tcpdf.org)

You might also like