Download Tutorial 2 Solutions (Week 13)

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Network effect wikipedia , lookup

Transcript
COMP 3331/9331 Computer Networks and Applications
Tutorial 2 Solutions (Week 13)
Routing Protocols
1) Consider the following network with the indicated link costs. Use Dijkstra’s shortestpath algorithm to compute the shortest path from node x to all network nodes. Show
how the algorithm works by computing a table similar to Table 4.3 from the textbook.
z
14
2
t
4
y
1
6
v
3
x
s
2
1
1
1
1
9
4
u
3
w
Solution:
N’
X
xw
xwv
xwvu
xwvuy
xwvuyt
xwvuyts
D(s),
p(s)
Inf
Inf
Inf
7,u
7,u
6,t
D(t),
p(t)
Inf
Inf
11,v
5,u
5,u
D(u),
p(u)
Inf
4,w
3,v
D(v),
p(v)
3,x
2,w
D(w),
p(w)
1,x
D(y),
p(y)
6,x
6,x
3,v
3,v
D(z),
p(z)
Inf
Inf
Inf
Inf
17,y
7,t
7,t
2) Consider the three node topology shown in the figure below. Compute the distance
tables after the initialisation step and after each iteration of a synchronous version of
the distance vector algorithm. (similar to the steps show in figure 4.30 on the
textbook) Assume that poisoned reverse is not employed by the nodes.
y
5
x
8
2
z
1
COMP 3331/9331 Computer Networks and Applications
Node x table
from
X
Y
Z
Cost to
X
Y
0
5
inf
inf
inf
inf
Z
2
Inf
Inf
Cost to
X
Y
inf
inf
5
0
inf
inf
Z
Inf
8
Inf
from
X
Y
Z
X
0
5
2
Cost to
Y
Z
5
2
0
8
8
0
X
Y
Z
X
0
5
2
Cost to
Y
Z
5
2
0
7
8
0
X
0
5
2
Cost to
Y
Z
5
2
0
8
7
0
Node y table
from
X
Y
Z
from
Node z table
from
X
Y
Z
Cost to
X
Y
inf
inf
inf
inf
8
2
Z
Inf
Inf
0
from
X
Y
Z
3) Now consider the same topology as in the above problem. In this case, assume that
the poisoned reverse algorithm is being used by all the nodes. In this situation what
are the distance vectors sent by each of the nodes to their neighbours?
Solution: There will be no change in the distance vector sent by X to its neighbours since
X has a direct one hop path to Y and Z.
However, since the path from Z to Y is through X, Z will lie to X that Z’s distance to Y is
infinity. Hence the distance vector sent by Z to X is:
Z
Cost to
X
Y
2
inf
Z
0
The distance vector sent from Z to Y however will be the correct one (without lies):
Z
Cost to
X
Y
2
7
Z
0
Similarly the distance vector sent from Y to X will also advertise the distance to Z as
infinity (since the path from Y to Z goes through X), resulting in the following distance
vector:
2
COMP 3331/9331 Computer Networks and Applications
Y
Cost to
X
Y
5
0
Z
inf
The distance vector sent from Y to Z however will be the correct one (without lies):
Y
Cost to
X
Y
5
0
Z
7
Datalink Layer
4) Consider the simple network shown below:
111.111.111.111
A
AC-45-B1-50-98-E1
222.222.222.224
111.111.111.112
Router
111.111.111.114
52-56-A3-4D-1F-11
222.222.222.223
99-AA-B2-15-67-90
111.111.111.113
Subnet 1
37-14-F2-AC-09-00
222.222.222.222
E
Subnet 2
a) Write down an IP address for all interfaces at all hosts and routers in the network. The
IP addresses for A and E are as given. Both, Subnet 1 and Subnet 2 make use of 24 bit
network prefixes. You should assign IP addresses so that interfaces on the same subnetwork have the same network-part of their IP address.
Solution: If the network part of the address is 24 bits (/24), then all interfaces in the
left network must be of the form 111.111.111.xxx, while the interfaces in the right
part must be of the form 222.222.222.xxx. The IP addresses are shown in the above
figure.
b) Choose physical addresses (LAN addresses) for only those interfaces on the path
from A to E. Can these addresses be the same as in part a)? Why?
Solution: LAN addresses are 48 bits long and are very different from the 32 bit IP
addresses from part a). The LAN addresses are shown in the above figure.
3
COMP 3331/9331 Computer Networks and Applications
c) Now focus on the actions taken at both the network and data link layers at sender A,
the intervening router, and destination E in moving an IP datagram from A to E:
(i)
What, specifically, are the source and destination addresses in the IP
datagram that flows from A to the router. What, specifically, are the
source and destination addresses in the IP datagram that flows from the
router to E?
Solution: In the IP datagrams from A to the router the addresses are as
follows: source: 111.111.111.111, destination: 222.222.222.222. In the IP
datagrams from the router to E the source and destination addresses are
same.
(ii)
Name any three other fields found in an IP datagram?
Solution: Hopcount (TTL), upper layer protocol, options (see book/notes
for others).
(iii)
How do A, E and the router determine the physical (LAN) addresses
needed for the data link layer frame?
Solution: Using the address resolution protocol (ARP).
d) Suppose that the router in the figure above is replaced by a bridge.
(i)
How would the IP addresses change in this case?
Solution: The IP addresses of A and E would have to have the same
network prefix since they are now part of the same subnet.
(ii)
How would the physical (LAN) addresses change in this case?
Solution: They would stay the same in A and E.
(iii)
How does a learning bridge learn the physical addresses of the attached
hosts?
Solution: When an attached host sent a frame through the bridge (e.g.,
arriving on interface x) the bridge would observe the LAN (physical)
address of the sender, and then know that a host with that physical address
was reachable via the interface (x) on which the original frame was
received.
5) Suppose that nodes A and B are attached to the opposite ends of a 900 m Ethernet
cable and that they each have one 1000 bit frame (including all headers and
preambles) to send to each other. Suppose that there are four repeaters between A and
B, each inserting a 20-bit delay (this is the time taken to transmit 20 bits on the
Ethernet segment) and that the transmission rate is 10 Mbps. Assume that CSMA/CD
4
COMP 3331/9331 Computer Networks and Applications
with backoff intervals of multiples of 512 bits is used. Assume that there is a collision
when both A and B transmit their packets simultaneously at time t = 0 sec. After the
collision, A draws K=0 whereas B draws K=1 in the exponential backoff protocol.
Ignore the jam signal and the 96-bit time delay.
a. What is the one-way propagation delay (including the repeater delays)
between A and B in seconds? Assume that the signal propagation speed is 2 x
108 m/sec.
Solution: The one-way propagation delay is,
900m
20bits
+ 4"
8
2 " 10 m / sec
10 ! 10 6 bps
= ( 4.5 ! 10 "6 + 8 ! 10 "6 ) sec
= 12.5µ sec
b. At what time (in seconds) is A’s packet completely delivered at B?
Solution:
•
•
•
•
At time t = 0 , both A and B transmit.
At time t = 12.5µ sec , A detects a collision.
At time t = 25µ sec last bit of B 's aborted transmission arrives at A .
Since A draws K=0 in the backoff algorithm it can instantly start the
retransmission at time t = 25µ sec .
• At time t = 37.5µ sec first bit of A 's retransmission arrives at B . Note
that, this time is smaller than the 512 bit time that B has to wait for
backoff. Hence, B does not begin its transmission since it detects A’s
transmission. (In CSMA, the node senses the channel before transmit)
1000bits
= 137.5µ sec A 's packet is
• At time t = 37.5µ sec +
10 ! 106 bps
completely delivered at B .
If you had assumed that the nodes A and B detect the collision at time,
t=0, then your solution should be 12.5 µ sec less than the above answer.
6)
H1
H2
100m
.....
200m
H10
1000m
Hub
5
COMP 3331/9331 Computer Networks and Applications
For this question, assume that the speed of propagation of a signal along a cable is 2 x 108
m/s. The figure above shows a 10Mbps CSMA/CD network interconnecting ten
computers. Each computer is connected to the hub with a cable of different length.
Computer H1 is connected via a 100m cable, computer H2 via a 200m cable, computer
H3 via a 300m cable and so on upto computer H10, which is connected via a 1000m
cable (ignore the requirement of repeater due to signal degradation). Assume that the hub
introduces a delay of 2.5 microseconds. Calculate the shortest packet length Lmin of this
network in order to ensure that the CSMA/CD protocol functions properly.
Solution: The maximum end-to-end propagation delay is = (1000m + 900m) / (2 x
108m/s) = 9.5µsec. The hub introduces an additional 2.5 microseconds delay.
The time taken to transmit Lmin >= 2 (9.5µsec + 2.5µsec) >= 24µsec.
Hence, Lmin = 24µsec x 10Mbps = 240 bits.
7) If all the links in the Internet were to provide reliable data transfer would the TCP
reliable delivery service be redundant? Why or why not?
Solution: Although each link guarantees that an IP datagram sent over the link will be
received at the other end of the link without errors, it is not guaranteed that IP datagrams
will arrive at the ultimate destination in the proper order. With IP, datagrams emerging
from the same TCP connection can take different routes in the network, and therefore
arrive out of order. TCP is still needed to provide the receiving end of the application the
byte stream in the correct order. Also, IP can lose packets due to routing loops or
equipment failures.
8) Suppose the information content of a packet is the bit pattern 1010101010101011 and
an even parity scheme is being used. What would the value of the checksum field be
for the case of a two-dimensional parity scheme?
Solution: The rightmost column and bottom row are for parity bits.
10100
10100
10100
10111
00011
6
COMP 3331/9331 Computer Networks and Applications
Network Security
9) An RSA public-key algorithm is used for communicating characters of the English
alphabet with plaintext 1 representing A, 2 representing B, 3 representing C and so
on. Plaintext 27 represents a blank space. The public key pair is (e,n) = (27, 55), i.e.
ciphertext C is obtained from the plaintext P using the formula C = P27 mod 55.
Determine the plaintext message corresponding to the following ciphertext. Each
number in parenthesis corresponds to a single plaintext character.
(2)(1)(36)(36)(20)(3)(2)(5)(23)(4)(49)(1)(20)(24)
Solution:
We first need to determine the private key.
Since n = 55, p and q are 5 and 11 respectively.
Hence, z = (p-1)(q-1) = 40.
e is 27, we need to find d such that (ed-1) is exactly divisible by 40. Hence, d = 3.
(NOTE: You could choose other values of d provided they satisfy the above property)
So the private key pair is (d,n) = (3, 55).
We can down convert the ciphertext to plaintext using the formula, P = C3 mod 55.
Using this we get: (8)(1)(16)(16)(25)(27)(8)(15)(12)(9)(4)(1)(25)(19)
This translates to: HAPPY HOLIDAYS
(NOTE: 27 indicates a white space between HAPPY and HOLIDAYS)
10) Is the message associated with a message digest encrypted? Explain your answer.
Solution: The message associated with a message digest value need not be encrypted.
Encrypting the message provides for confidentiality, which the message digest provides
for integrity – two different goals.
7