CS 447-Network and Data Communication

CS 447-Network and Data Communication
Midterm Exam No.2 (SOLUTIONS)
Summer, 2005
6:00-7:20 P.M.
July 18, 2005
This exam is a closed-book and closed note exam. There are 8 questions in this exam.
You have 80 minutes to finish the questions. Please write your answers on separated
piece of papers. To avoid grading problems, please staple your papers in the ascending
order in the question number. Calculator can be used during this exam, but you can not
share a calculator with anyone else.
Name: _______________________________
Last 4 digits of your SID: ___________________
QUESTION #1 (10 minutes)
#1: What does “ARP” stand for? Why is “ARP” needed?
 “ARP” stands for “Address Resolution Protocol”
 ARP is needed mainly because a NIC does not use software address (such as IP)
while human users (and network application programs) usually do not use
hardware address. Therefore, a mechanism that translates a software address
into a hardware address (and vice versa) is required.
#2: What is “persistency algorithm” for?
algorithm” for?


What is “binary-exponential back-off
Persistency algorithm is for CSMA. In CSMA. If more than one host are
waiting for their packet transmission while a host is transmitting a packet, a
packet collision will happen for sure, if the waiting hosts start transmitting
their packet immediately after the current transmission is over. Persistency
algorithm tries to prevent a packet collision by inserting random delay before
transmission (except for 1-persistent).
Binary-exponential back-off algorithm is for CSMA/CD. It is a solution
for problem #2 in CSMA/CD in question (19) above. Similar to the problem
solved by persistency algorithm, immediate retransmissions by collided hosts
will result in another packet collision. Binary-exponential back-off algorithm
tries to insert random delay to avoid collisions.
1
#3: Give a sketch of the IP header.
CS 447 Networks and Data Communication
The format of the IP header
IP Header format is specified in RFC (Request For Comment)
by IETF (Internet Engineering Task Force)
IP/002
#4: Which layer does Internet routing (i.e. IP routing) belong to?
IP (Internet Protocol) is a network layer protocol. Thus, it is a layer-3 routing.
#5: Why is “software address” needed (mention two reasons)?
1. Because the network hardware (NICs and repeaters) do not understand software
addresses.
2. Because hardware address is not flexible (you can’t change it!!) – you want to
assign an address you like (that’s the motivation of the software address).
2
QUESTION #2 (10 minutes)
#1: Regarding the course project phase 2, show an example that explains why
multi-threaded design is required at a FTP client. Attach a brief (but correct)
description to your example. Your example should be something that visualizes the
organization or flow of execution in an FTP client. Amount of credit to be given
depends on both correctness and clearness in your solution (simple figures are
necessary to be provided for full credit).
The problem is that an FTP server will talk to an FTP client to establish the second
socket connection for some commands that require bulk data transmission, such as
get, put, and ls commands. A client is supposed to receive a result status code for
PORT command, which uses recv socket function. Then the client should wait for
the server at accept function. Both recv and accept are blocking functions. Since
TCP relies on IP for actual packet transmission, we never know (or it is
unpredictable) which message (the result status code or a request for connection for
the second connection) will arrive at the client first.
Case 1: (usual case)
Case 2: (possible case)
at client
at client
Transmit PORT
Command by “send”
Transmit PORT
Command by “send”
Receive result status
code by “recv”
Result status
from the server
Establish a connection
by “accept”
Connection
from the server
Establish a connection
by “accept”
Connection
from the server
Receive result status
code by “recv”
Result status
from the server
#2: For token ring networks, we discussed that one of the existing techniques to improve
token-ring networks is “slotted token ring”. For slotted token ring, is it possible to
reach 100% utilization? If not, mention at least two reasons why 100% utilization
can not be achieved for slotted token ring. Assume that bit error will never happen.
Also assume that token will never be lost.
100% utilization will not be achieved in the slotted token ring because of the
following two reasons.


The token inserted at the beginning of each slot consumes some bandwidth.
Each slot may not be full (some packets will be smaller than the slot size).
3
#3: Suppose we have three networks connected by two routers (as shown below). Show
the Source IP address, source MAC address, destination IP address and destination
MAC address of packets at “This Point” if packets are transmitting from host A to F.
LAN 2
143.163.XX.XX
LAN 1
131.247.XX.XX
C
D
LAN 3
28.181.XX.XX
Router #1
B
Router #2
E
This Point
F
A
Assume the following network setting:
Host A: 28.181.1.1 (MAC address: 1050)
Host B: 28.181.1.2 (MAC address: 1ABC)
Router #2 (LAN 3 side): 28.181.1.100 (MAC address: 2019)
Router #2 (LAN 2 side): 143.163.32.99 (MAC address: 1021)
Host C: 143.163.32.1 (MAC address: 3082)
Router #1: (LAN 2 side): 143.163.32.98 (MAC address: 7547)
Router #1: (LAN 1 side): 131.247.68.99 (MAC address: 7546)
Host D: 131.247.68.1 (MAC address: ABCD)
Host E: 131.247.68.2 (MAC address: 9356)
Host F: 131.247.68.3 (MAC address: 5466)
Solution is posted in the next page:
Source IP: 28.181.1.1
Source MAC: 1021
Destination IP: 131.247.68.3
Destination MAC: 7547 (or “BC”)
Message Field: “Data” (or “ACK”)
4
QUESTION #3 (7.5 minutes)
Four hundreds of network hosts are connected by four independent ring networks (each
ring with 100 hosts) by three bridges as shown by a figure below. Develop a formula to
calculate the following probability: Assume the probability for failure for each link,
repeater and bridge are PL, PR, and PB (same probability for each of the same type of
components). Find the probability that any two randomly selected hosts are unable to
communicate.
B1
B2
Ring 1
B3
Ring 2
Ring 3
Ring 4
Solution:
There are three cases. Case 1; the destination is on the same network. Case 2: The
destination is not the same network, but it is connected to the local bridge. Case 3: The
destination is not the same network and it is connected through remote bridges.
Case 1: 99/400  (1-(1-PL)100(1-PR)100)
(1)
Case 2: 100/400  (1-(1-PL)100(1-PR)100(1-PB))
(2)
Case 3: 200/400  (1-(1-PL)100(1-PR)100(1-PB)3)
(3)
The probability in the question is calculated by (1) + (2) + (3).
5
QUESTION #4 (7.5 minutes)
Suppose an IP packet with the following property will be forwarded to another network
where the maximum packet size is only 252 bytes. Show (1) Total length, (2) IHL, (3)
Fragment offset and (4) More fields in the second packet after fragmentation. Assume
IHL = 7 for every packet.
The original packet carries:
(1) Total Length = 748
(2) IHL = 7
(3) Fragment Offset = 0
(4) More = 0
Solution:
(1) BEFORE fragmentation:
Header
Payload (user data)
28 bytes
720 bytes
(2) AFTER fragmentation:
1st packet
3rd packet
Payload (user data)
28 bytes
2nd packet
28 bytes
224 bytes
Payload (user data)
28 bytes



Payload (user data)
224 bytes
Last packet
224 bytes
28 bytes 48 bytes
The total packet length of the last packet = 76 (28-byte header +
48-byte payload), IHL = 7 (given)
Fragment Offset = (224  3) / 8 = 672/8 =84
More = 0
6
QUESTION #5 (10 minutes)
Given an IP address, 126.142.176.173, and a network domain that has the following
properties.
 The domain uses CIDR.
 The maximum number of hosts this domain expects to have is ten thousand
hosts (at most).
 This domain expects up to 19 sub-networks.
(1) Find the subnet mask that should be used at the gateway router of this domain (in
decimal number(s) with each decimal digit for 8bits separated by a period – e.g.,
“146.163.5.31”).
(2) Find the domain address of this domain (in decimal number(s) with each decimal
digit for 8bits separated by a period – e.g., “146.163.5.31”).
(3) Find the host address of the given IP address (in decimal number(s) with each
decimal digit for 8bits separated by a period – e.g., “146.163.5.31”).
Solutions:

Convert “126.142.176.173” into the binary expression.
126
01111111


142
.
173
10001110
.
176
.
1 0 11 0 0 0 0
1 0 10 1 10 1
Since there will be up to 10,000 hosts, we need ceiling(log2(10,000)) bits for
hosts addresses (= 14 bits for the host addresses).
Since there will be up to 19 hosts, we need ceiling ceiling(log2(19)) bits for
sub-network addresses (= 5 bits).
As a result, the bits assigned for, the domain address, sub-network addresses and
host addresses should look like a figure below (any bit that does not belong to either
the host address or subnet address, it must be a part of the domain address).
Sub-Net Address
01111111
.
10001110
.
Host Address
1 0 11 0 0 0 0
.
1 0 10 1 10 1
Domain Address
(1) The subnet-mask is: “1 1 1 1 1 1 1 1.1 1 1 1 1 1 1 1.1 1 0 0 0 0 0 0.0 0 0 0 0 0 0
0”, which is, “255.255.192.0”.
7
(2) The domain address is “0 1 1 1 1 1 1 1.1 0 0 0 1” = “126.17”
(3) The host address is: “1 1 0 0 0 0.1 0 1 0 1 1 0 1”, which is “48.173”
QUESTION #6 (15 minutes)
For the following question, select the best option (by circling one of TRUE, FALSE or
DEPENDS). For the question that requires an explanation, only one-line sentence can
be provided. Your solution is considered correct only if both of your selection and your
explanation are correct (except for the solutions that do not require an explanation). If
you do not select any option (one of TRUE, FALSE and DEPENDS), you will not get
any credit (even if your explanation is correct). If you select more than one option, you
will not get credit either.
(1) "In some special cases, CSMA can result in a better performance than
CSMA/CD." (TRUE, FALSE, DEPENDS)
Attach an explanation for your selection, if you select either “TRUE” or
“DEPENDS”.
Explanation (required only for “TRUE” or “DPENDS”):
FALSE: CSMA could be as good as CSMA/CD, but it can not be better than
CSMA/CD, because CSMA/CD is a superset of CSMA.
(2) "Since there is no overhead in data transmission, circuit switching will be
faster than datagram data transmission." (TRUE, FALSE, DEPENDS)
Attach an explanation for your selection, if you select either “FALSE” or
“DEPENDS”.
Explanation (required only for “FALSE” or “DPENDS”):
DEPENDS: If the path setup delay is long, datagram can be faster.
(3) "Since the relative header overhead is high for small packets, you should use
large packets if you have much data to transmit." (TRUE, FALSE,
DEPENDS)
Attach an explanation for your selection, if you select either “FALSE” or
“DEPENDS”.
Explanation (required only for “FALSE” or “DPENDS”):
8
DEPENDS: If the error rate is high, large packets can result in a longer time.
(4) "In some special cases, token-ring can result in a better utilization than FDDI."
(TRUE, FALSE, DEPENDS)
Attach an explanation for your selection, if you select either “TRUE” or
“DEPENDS”.
Explanation (required only for “TRUE” or “DPENDS”):
FALSE: Utilization in token-ring will never be better than that of FDDI.
(5) "Dijkstra algorithm (for the shortest-path) always result in the same result as
Bellman-Ford algorithm (assume that the path length for every possible
source-destination pair is different)." (TRUE, FALSE, DEPENDS)
Attach an explanation for your selection, if you select either “FALSE” or
“DEPENDS”.
Explanation (required only for “FALSE” or “DPENDS”):
TRUE: Otherwise, either Dijkstra or Bellman-Ford algorithm must be wrong!!
(6) "The TTL filed in an IP packet shows the number of hop counts that packet has
made to reach a host." (TRUE, FALSE, DEPENDS)
Attach an explanation for your selection, if you select either “FALSE” or
“DEPENDS”.
Explanation (required only for “FALSE” or “DPENDS”):
FALSE: The TTL filed is *not* the number of hops that has made by an IP packet,
but the remaining hops an IP packet can make.
(7) "Since circuit switching data transmission does not have any overhead during
data transmission, the quality of sounds that will be played back at the
destination will be better than virtual circuit and datagram transmission."
(TRUE, FALSE, DEPENDS)
Attach an explanation for your selection, if you select either “FALSE” or
“DEPENDS”.
Explanation (required only for “FALSE” or “DPENDS”):
FALSE: Low delay does not imply good quality of sound due to signal noise and
signal attenuation during transmission.
9
(8) "Sub-networking is an efficient technique to reduce routing complexity in the
Internet routing (because core routers do not have to recognize each sub
networks in a domain)." (TRUE, FALSE, DEPENDS)
Attach an explanation for your selection, if you select either “FALSE” or
“DEPENDS”.
Explanation (required only for “FALSE” or “DPENDS”):
FALSE: Sub-networking does not have anything to do with the Internet routing or
core routers. It’s a technique to reduce complexity in address management in a
local domain.
(9) "A repeater hub can always be replaced by a switching hub as long as we don’t
care security and throughput." (TRUE, FALSE, DEPENDS)
Attach an explanation for your selection, if you select either “FALSE” or
“DEPENDS”.
Explanation (required only for “FALSE” or “DPENDS”):
TRUE
(10) "In the source routing, routing will be performed only once, while routing is
performed for every packet in IP routing. Because of less routing overhead in
the source routing, data transmission by the source routing is faster than IP
routing." (TRUE, FALSE, DEPENDS)
Attach an explanation for your selection, if you select either “FALSE” or
“DEPENDS”.
Explanation (required only for “FALSE” or “DPENDS”):
DEPENDS: If the delay for a link suddenly increases during a transmission,
because the source routing can not adjust routing during a transmission.
Note: The solution for this question can not be "FALSE", since it really depends!
10
QUESTION #7 (7.5 minutes)
A disadvantage of the contention approach for LANs, such as CSMA/CD, is the
capacity waste due to multiple stations attempting to access the channel at the same time.
Suppose that time is divided into discrete slots, with each of N stations attempting to
transmit with probability of p during each slot. What fraction of slots is wasted due to
multiple simultaneous transmission attempts?
Solution:



Each station transmits at the probability of p. That means that each station does
not transmit at the probability of (1-p).
A collision will happen if more than one host transmits in a slot.
The probability of exactly one station transmits is:
(number of possible combinations of any two stations out of N stations)p(1-p)N-1
Thus, the fraction of waste due to a collision is calculated by:
1-(Probability of “no one transmits”)-(Probability of exactly one host transmits)
1  (1  p) N   N2   (1  p) N 1  p
11
QUESTION #8 (12.5 minutes)
The binary exponential backoff algorithm defined by IEEE 802 as follows:
The delay is an integral multiple of slot time. The number of slot times to delay
before nth retransmission attempts is chosen as a uniformly distributed random
integer in the range of 0  r  2K, where K = min (n, 10).
Slot time is, roughly, twice the round-trip propagation delay. Assume that S (S is any
integer) stations always have a frame to send. After a collision, what is the mean
number of retransmission attempts before one station successfully retransmits (show the
formula to calculate this)?
Solution:
We know the following table:
Possible “r”s
0, 1, 2 (3 options)
0, 1, 2, 3, 4 (5 options)
0, 1, 2, 3, 4, 5, 6, 7, 8 (9 options)
0 through 16 (17 options)
0 through 32 (33 options)
0 through 64 (65 options)
0 through 128 (129 options)
0 through 256 (257 options)
0 through 512 (513 options)
0 through 1024 (1025 options)
# of attempts
1
2
3
4
5
6
7
8
9
10
Let us analyze for one simple case. Assume that N = 5 and (# of retransmission
attempts) = 1 and that your host selects “0”. As long as you select “0”, the number of
different combinations for other four hosts will be 29 (29 different combinations). See a
figure below.
A
B
C
D
E
0
0, 1, 2
0, 1, 2
0, 1, 2
0, 1, 2
Number of
Combinations
31
32
33
34
Collision-free
Combinations
1, 2
1, 2
1, 2
1, 2
Number of
Collision-free
Combinations
21
22
23
Probability of
No-collision
21/31
22/32
23/33
Possible
Combinations
12
  
3S-1
24
  
2S-1
24/34
  
2S-1/3S-1
The above figure implies that for S transmitting nodes, the probability of successful
attempts is 2S-1/3S-1, which keeps decreasing as S gets larger (this makes a sense).
How about for number of attempts larger than 1? If the number of attempts is 2, for
example, the probability of the successful attempt for re-transmission will be:
(22)S-1/(22+1)S-1
Therefore, the formula for the general expression will be:
10
 ((2 )
i
S 1
/( 2 i  1) S 1 )
i 1
QUESTION #9 (10 minutes)
It is well known fact that IP packets always gets smaller (continuously fragmented) until
they reach a destination but never increase even though some networks have larger
maximum packet length. Why?
Each of IP datagram packets can take a different path even for the same
sender-destination pair. This means that IP packets can never be assembled during
transmission, while fragmentations are always possible at any intermediate router.
___________________________________________________________________
CS447, Network and Data Communication, Midterm #2, July 18, 2005
13