Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
Data Communications and Networks
CSCI-GA.2262-001 – Fall 2015
Dr. Jean-Claude Franchitti
New York University
Computer Science Department
Courant Institute of Mathematical Sciences
Midterm Examination
This midterm exam covers the following data communications and networks topics
covered in class: introduction and overview, the application layer, data encoding and
transmission, data link control, and wireless and mobile networks.
As the exam is rather long, it is EXTREMELY IMPORTANT to use GOOD TEST
TAKING STRATEGY. That is, first answer the problems that you can answer easily and
quickly, and then go to the problems that are going to take you more work. Do not waste
a lot of time at the beginning trying to figure out a problem that you find difficult. The
answers do not have to be in order in your exam booklet.
General Directions:
This is an open book test; you may bring the course text book(s) or notes to the room.
Computers are allowed for access to material stored on the hard drive(s). No internet
access via computers or electronic devices is allowed. No communication with other
students in the room is allowed.
Each question is preceded by a numeric score in parenthesis: that score indicates both
the weight of the question, and a (high) estimate of how many minutes you should be
spending on it. The total score is 100. The weight of each question is indicated in
points and therefore each point counts for 1% of the total grade. The official exam
period is 110 minutes.
Write your answers in your exam booklet(s). It is not expected that you will need
additional sheets, but there will be a supply of extra booklets. Please number your
booklets as needed. At the end of the exam period, insert all additional booklets and
your copy of the exam specification in your first booklet and return the package to the
instructor.
Please make sure that you also observe the following:
2
Please provide answers to all ten (10) questions, unless stated otherwise you will
not be penalized for providing a wrong answer.
Place your name on your exam booklet(s) and on your copy of the exam
specification.
Please read the questions carefully and consider all hints and assumptions provided
Problems:
1. General Q&As – (6 points)
Note: For this particular question, proper context setting and explanations
may have led the grader to consider alternate answers as valid.
Indicate whether each of the following statement is true or false (T/F) and explain
your answers if/as needed:
1a. (1 point) The internal data rates of LANs are typically much greater than those
of WANs.
T
1b. (1 point) Name servers are server programs that hold information about a
portion of the domain name tree structure and the associated resource records
(RRs).
T
1c. (1 point) Synchronous time division multiplexing is only possible when the
achievable data rate (sometimes called bandwidth) of the medium exceeds the
data rate of digital signals to be transmitted.
T
1d. (1 point) A set of devices and LANs connected by layer 2 (i.e., link layer)
switches is considered to have a “flat” address space where the term “flat” means
that all users share a common MAC broadcast address.
T
1.e. (1 point) Channel partitioning strategies (e.g., FDMA, TDMA, and CDMA)
are more suitable for burst traffic than for constantly distributed traffic.
F
3
1.f. (1 point) In the data link layer of a direct link between two workstations, flow
control is used to transmit frames as quickly as possible whenever the link is free.
T
2. Computer Networks and the Internet – (9 points)
2.a. (3 points) A 3000 bit frame is sent from point A to point B via a laptop
computer through copper wire at 100 Mbps. Once the first bit of the frame arrives
to point B, has the last bit of the frame has left point A?
It takes 10-8
s (1/106) for one bit to travel from point A to point B so it will
take 3000*10-8
s = 3*10-5
s for the complete 3000 bit frame to travel to
destination.
The propagation delay is dprop = D / 2*108. Assuming that D is such that
dprop < dtrans then once the first bit of the frame arrives at point B, the last bit
of the frame would have left point A.
2.b. (3 points) A real-time voice is being sent via Voice over IP (VoIP) from Host
A to Host B over a single link packet-switched network. Host A converts analog
voice to a digital 256 kbps bit stream on the fly and groups the bits into 28-byte
packets. The single link between Host A and Host B has a transmission rate of 10
Mbps and a propagation delay of 5 msec. Packets gathered by Host A are
immediately sent to Host B and as soon as Host B receives an entire packet, it
converts it to an analog signal. How much time elapses from the time a bit is
created from the original analog signal at Host A until the bit is decoded as part of
the analog signal at Host B?
Consider the first bit in a packet. Before this bit can be transmitted, all of the
bits in the packet must be generated. This requires:
(28x8)/(256*103) = .875*10
-3 s
The time required to transmit the packet is:
(28x8)/(10x106)sec = 224*10
-7 s
Propagation delay = 5ms
The total delay until decoding is
.875*10-3
+ 224*10-7
+ 5*10-3
= 5.8974 msec
2.c. (3 points) Explain how phone calls made from a PC to an ordinary phone
4
(e.g., via Skype) are typically supported. (Note: It is assumed here that the voice
call would pass through the Internet and a telephone carrier.)
See http://www.mjalali.com/blog/?p=10 for more details
5
6
7
8
9
3. Application Layer – FTP (10 points)
In the FTP architecture, the client and the server need to agree on the port
numbers to use for the separate data-transfer connection. In one possible
implementation approach referred to as “active mode,” the client opens a socket
with a dynamic port and sends the IP address and port number to the server (using
10
the existing control connection) so the server knows what client address and port
number to use for the data-transfer connection. For example, the client on IP
address 192.168.0.1 that chose port 49150 for the data connection might send a
command like “PORT 192.168.0.1 49150” over the control connection In an
alternate implementation approach used to establish the data-transfer connection
and referred to as “passive mode,” the server selects a port number and instructs
the client (using the existing control connection) to establish the data-transfer
connection.
3.a. (2 points) Active mode may cause problems when the client host resides
behind a NAT box. Explain why this is the case?
The NAT box maps the IP address and port number of the client’s data
connection to new values. As such, the arguments the client sends in the
PORT command (sent over the control connection) would not match the
values the NAT box would use. In addition, the server would have trouble
initiating a data connection to a client lying behind a NAT box, without the
NAT box already having a table entry for the associated connection; since the
client has not transmitted any packets on the data connection yet, the NAT
box would not yet have an entry installed when the server sends the initial
SYN packet. Worse yet, the IP address in the PORT command is a private,
non-routable address, so the FTP server would not be able to direct a packet
with this destination address to the appropriate place.
3.b. (2 points) Suppose a NAT box wanted to correctly handle clients running
“active mode” FTP. What actions would the NAT box need to perform on FTP
control messages from the client?
The NAT box would need to parse the messages sent on the FTP control
connection (i.e., on port 21) to extract the arguments of the PORT command.
The NAT box would need to create a table entry for the data connection and
modify the arguments in the PORT message accordingly, so the FTP server
can successfully create and use the data connection.
3.c. (2 points) Why might these operations change the size of underlying IP
packets associated with the control connection? How could the NAT handle the
change in packet sizes?
The IP address and port numbers used by the NAT box may have a different
number of decimal digits, when represented as the arguments in the PORT
command. As such, the NAT box must change the packet sizes, as well as the
TCP sequence numbers (when sending to the server) and acknowledgment
numbers (when directing return packets to the client) to remain consistent.
If the packet size increases, the new packet may exceed the MTU, requiring
the NAT box to fragment the IP packets.
11
3.d. (2 points) What challenges are introduced if other applications (besides FTP
control) use port 21? What challenges are introduced if the FTP client and FTP
server encrypt their communications?
If another application uses port 21, the NAT may mistakenly think the
connection is an FTP control connection and try to parse the messages. If the
other application also sends the string “PORT”, the NAT box may
mistakenly modify the packet contents, leading to unpredictable affects.
If the FTP client and server encrypt their communications, the NAT box
cannot parse the PORT command (in the payload of TCP connection) and
correctly map the IP address and port number. This can lead to significant
confusion for users, when their FTP client works fine in the absence of
encryption and then mysteriously does not work when encryption is enabled.
3.e. (2 points) Why is passive mode easier than active mode in the presence of
client-side NAT boxes?
In passive mode, the server selects an address and port number, and sends
them to the client over the control connection. The client-side NAT does not
need to modify the address and port number used by the remote server.
(That said, passive mode is challenging in the presence of a server-side NAT
box, though this is a much less common configuration.)
If you are curious to learn more about the interaction of FTP and NAT, see
http://en.wikipedia.org/wiki/File_Transfer_Protocol#FTP_and_NAT_devices
4. Application Layer – SMTP (8 points)
The following questions pertain to electronic mail applications in the Internet and
the related SMTP protocol:
4a. (2 points) Assuming that the connection establishment and termination
durations are excluded, what is the minimum number of network round trips to
send a small email message using SMTP?
It is the message passed after connecting to smtp mail server. Client message
are blue in color. You can see it need 5 round trip to send mail using smtp.
R:220 Beta.ARPA Simple Mail Transfer Service Ready Sendmail 8.9.3/8.9.3
S: HELO supermanhelp.com
R: 250 yahoo.com
12
S: MAIL FROM:<[email protected]>
R: 250 OK
S: RCPT TO:<[email protected]>
R: 250 OK
S: DATA
R: 354 Start mail input; end with "."
S: .
R: 250 OK
4b. (2 points) Suppose you need to send one message to three different users:
[email protected], [email protected], and [email protected]. Is there
any difference between sending one separate message per user vs. sending only
one message with multiple (i.e., three) recipients? Please explain.
If a separate message is sent for each of the users, one MAIL, one RCPT, and
one DATA command will be issued for each of the messages, resulting in the
transmission of three copies of the message data. If only one message with
multiple recipients (three) is sent, one MAIL, multiple RCPT, and one DATA
command will be issued, resulting in the transmission of only one copy of the
message data.
There is not much difference between sending one message to multiple users
and sending one separate message per user. Most of the effects come on the
sender’s side.
While sending a message to multiple recipients, the message is first sent to
the outgoing email server. The email server then makes a copy for each
recipient and forwards them to corresponding domain. Since there are
multiple recipients of same message, the server has to send them at the same
time. In this case, the usage of processor of the server is higher than usual,
but there is benefit of saving disc space because the server keeps only one
copy of the message.
On the other hand, while sending separate message per user, there is no
pressure on email server. The server forwards the message as it receives
from the sender. But the disadvantage is that the messages with different
email addresses have to be saved on the server even if the message is same.
4c. (2 points) Because SMTP uses two different port numbers (i.e., UDP ports
161 and 162), a single system can easily run both a manager and an agent. What
would happen if the same port number was used for both UDP ports?
13
If the same port were used for both traps and requests, separating the
manager from the agent in the same system would be difficult.
4d. (2 points) Electronic mail systems differ in the manner they handle multiple
recipients. In some systems, the originating user agent or mail sender makes all
the necessary copies and these are sent out independently. An alternative
approach is to determine the route for each destination first. Then a single
message is sent out on the common portion of the route and copies are only made
when the routes diverge; this process is referred to as “mail-bagging”. Discuss the
relative advantages and disadvantages of the two methods.
Mail-bagging economizes on data transmission time and costs. It also reduces
the amount of temporary storage that each MTA must have available to
buffer messages in its possession. These factors can be very significant in
electronic mail systems that process a large number of messages. Routing
decisions may keep mail-bagging in mind.
5. Application Layer – HTTP and P2P – (12 points)
The following questions pertain to the Internet Directory Service and the World
Wide Web and the related DNS and HTTP protocols.
5a. (6 points) Prior to persistent connections, one separate TCP connection was
used to fetch each URL. Analyze the advantages of persistent connections over
the old HTTP paradigm of one connection per data transfer.
Prior to persistent connections, a separate TCP connection was established to
fetch each URL, increasing the load on HTTP servers and causing congestion
on the Internet. The use of inline images and other associated data often
require a client to make multiple requests of the same server in a short
amount of time. Analysis of these performance problems and results from a
prototype implementation are available [26] [30]. Implementation experience
and measurements of actual HTTP/1.1 (RFC 2068) implementations show
good results [39]. Alternatives have also been explored, for example, T/TCP
[27].
Persistent HTTP connections have a number of advantages:
- By opening and closing fewer TCP connections, CPU time is saved
in routers and hosts (clients, servers, proxies, gateways,
tunnels, or caches), and memory used for TCP protocol control
blocks can be saved in hosts.
- HTTP requests and responses can be pipelined on a connection.
Pipelining allows a client to make multiple requests without
14
waiting for each response, allowing a single TCP connection to
be used much more efficiently, with much lower elapsed time.
- Network congestion is reduced by reducing the number of packets
caused by TCP opens, and by allowing TCP sufficient time to
determine the congestion state of the network.
- Latency on subsequent requests is reduced since there is no time
spent in TCP's connection opening handshake.
- HTTP can evolve more gracefully, since errors can be reported
without the penalty of closing the TCP connection. Clients using
future versions of HTTP might optimistically try a new feature,
but if communicating with an older server, retry with old
semantics after an error is reported.
HTTP implementations SHOULD implement persistent connections.
5b. (6 points) Consider distributing a file of F = 30 Gbits to N peers. The server
has an upload rate of us = 50 Mbps, and each peer has a download rate of di = 5
Mbps and an upload rate of u. For N = 100, 1000, and 10,000 and u = 300 Kbps,
900 Kbps, and 2 Mbps, prepare a chart giving the minimum distribution time for
each of the combinations of N and u for both client-server distribution and P2P
distribution.
The following illustrates a solution for F = 15 Gbits, us=30 Mbps, di =
2Mbps. N=10, 100, 1000 and u=300 Kbps, 700 Kbps, 2 Mbps. The solution to
the problem at hand can easily be derived from it.
For the problem at hand, the numbers need to be replaced by F = 30 Gbits,
us=50 Mbps, di = 5Mbps. N=10, 100, 1000 and u=300 Kbps, 900 Kbps, 2
Mbps
15
6. Application Layer - DNS – (9 points)
The following questions pertain to the Internet Directory Service and the related
DNS protocol.
6.a. (3 points) A DNS resolver typically issues a query using UDP but may also
use TCP. Is there a problem using TCP for this purpose? If so, what do you
suggest is the solution?
DNS primarily uses User Datagram Protocol (UDP) on port number 53 to
serve requests. DNS queries consist of a single UDP request from the client
followed by a single UDP reply from the server. The Transmission Control
Protocol (TCP) is used when the response data size exceeds 512 bytes, or for
tasks such as zone transfers. Some resolver implementations use TCP for all
queries.
IP Fragmentation and TCP Segmentation
The presence of larger IP packets, such as those found when using DNS
(mainly due to zone transfers, EDNS, and DNSSEC), translates to an
increase in the probability that a large packet containing DNS information
will exceed the Maximum Transmission Unit (MTU) at some point in transit.
In cases where the packet exceeds the configured MTU of a Layer 3
interface, the packet will require fragmentation. However, in certain cases,
the packet configuration (for example, if the Don't Fragment (DF) bit is set
(= 1)), or the network configuration (for example, ICMP messages indicating
packets need to be fragmented are not received by the originating host) may
not allow transmission of a fragmented packet. For this reason, it is
necessary to account for the permitted MTU sizes through the use of features
16
such as Path MTU Discovery (PMTUD) to ensure that large DNS packets are
not discarded or subsequently dropped when they exceed the MTU size
configured on a Layer 3 interface.
Similar to the large packets that are impacted by IP fragmentation issues,
large DNS packets that use the TCP protocol (that is 53/tcp) may encounter
issues due to TCP segmentation, which must be accounted for to ensure that
large TCP-based packets are not discarded.
6.b. (3 points) Assume you are setting up a company network that has the
following servers: DNS server: “dns1.compxyz.com” (IP: “128.118.13.50”)
Web server: “compxyz.com” with two IP addresses as “128.118.12.56” and
“128.118.12.58”. The web server also bears the name “www.compxyz.com”.
Email server: “email.compxyz.com” (IP: “128.119.12.60”, company email
address: “[email protected]”). What resource records (RRs) will you be
providing to the .com authoritative registrar?
(compxyz.com, dns1.compxyz.com, NS)
(dns1.compxyz.com, 128.118.13.50, A)
6.c. (3 points) Assuming the same context as for 6.(b) above, what resource
records will you be placing in the company’s DNS server?
(compxyz.com, 128.118.12.56, A)
(compxyz.com, 128.118.12.58, A)
(www.compxyz.com, compxyz.com, CNAME)
(email.compxyz.com, 128.119.12.60, A)
(compxyz.com, email.starwar.com, MX)
7. Link Layer – Encodings and Error-Detection & Correction Techniques – (16 points)
7a. (3 points) For the bit stream 1101010, sketch the waveforms for NRZ-L,
NRZI, Manchester, and Differential Manchester.
Below is a sample answer for 0101110. The solution to the problem at hand
can be easily derived from it.
17
7b. (5 points) In a CRC error-detecting scheme, choose P(x) = x4 + x
2 + 1. Encode
the bits 11011010111.
A sample answer is provided below for P(x) = x4 + x
2 + 1 and bits
10010011011. The solution to the problem at hand can be easily derived by
swapping P(x) = x4 + x + 1 and considering bits 10010011011. The CRC code
is 10101 in this case.
18
7c. (5 points) Assume that the channel introduces an error pattern
100001000000000 (i.e., a flip from 1 to 0 or from 0 to 1 in position 1 and 6).
What is received? Can the error be detected?
This pattern can be detected because it is not a multiple of 10101
(for 100001000000000).
7d. (3 points) Repeat part (7c) with error pattern 101010000000000.
This pattern cannot be detected because it is a multiple of 10101 (for
101010000000000).
8. Link Layer – Channel Partitioning and Random Access Protocols – (12 points)
19
8a. (3 points) In synchronous TDM, it is possible to interleave bits, one bit from
each channel participating in a cycle. If the channel is using a self-clocking code
to assist synchronization, might this bit interleaving introduce problems because
there is not a continuous stream of bits from one source?
Although it seems logical to think of bits being separated as they come in and
then switched unchanged onto the transmission channel, this is not
necessarily the way it happens. What the multiplexer receives from attached
stations are several bit streams from different sources. What the multiplexer
sends over the multiplexed transmission line is a bit stream from the
multiplexer. As long as the multiplexer sends what can be interpreted as a bit
stream to the demultiplexer at the other end, the system will work. The
multiplexer, for example, may use a self-clocking signal.
The incoming stream may be, on the other hand, encoded in some other
format.
The multiplexer receives and understands the incoming bits and sends out its
equivalent set of multiplexed bits.
8b. (3 points) Explain in terms of data link control and physical layer concepts
how error and flow control are accomplished in synchronous time division
multiplexing.
Synchronous TDM is a technique to divide the medium to which it is
applied into time slots which are used by multiple inputs.
TDM’s focus is on the medium rather than the information which travels
on the medium. Its services should be transparent to the user. It offers no
flow or error control.
Flow and error controls must be provided on an individual-channel basis
by a link control protocol.
8c. (3 points) Assume that six active nodes – nodes A, B, C, D, E, and F – are
competing for access to a channel using slotted ALOHA. Assume each node has
an infinite number of packets to send. Each node attempts to transmit in each slot
with probability p. The first slot is numbered slot 1, the second slot is numbered
slot 2, and so on. What is the probability that node A succeeds for the first time in
slot 5?, and what is the probability that the first success occurs in slot 3?
The following is a sample solution to a similar problem where the question is
about the probability that node A succeeds for the first time in slot 5 with
four active nodes A, B, C, D). The solution to the problem at hand can easily
be derived from it.
20
(1 – p(A))4 p(A)
where, p(A) = probability that A succeeds in a slot
p(A) = p(A transmits and B does not and C does not and D does not)
= p(A transmits) p(B does not transmit) p(C does not transmit) p(D does
not transmit)
= p(1 – p) (1 – p)(1-p) = p(1 – p)3
Hence, p(A succeeds for first time in slot 5)
= (1 – p(A))4 p(A) = (1 – p(1 – p)
3)4 p(1 – p)
3
Answer - probability that the first success occurs in slot 3:
p(some node succeeds in a slot) = 4 p(1-p)3
p(no node succeeds in a slot) = 1 - 4 p(1-p)3
Hence, p(first success occurs in slot 3) = p(no node succeeds in first 2 slots)
p(some node
succeeds in 3rd slot) = (1 - 4 p(1-p)3)2 4 p(1-p)
3
8d. (3 points) Recall that with the CSMA/CD protocol, the adapter waits K.512
bit times after a collision, where K is drawn randomly. For K = 500. How long
will the adapter wait until returning to step 2 (see textbook’s chapter 5, p. 456, for
the complete list of steps) for 5, 10, and 100 Mbps broadcast channels?
The following is a sample solution for K = 100 and for 10, 100 Mbps
broadcast channel. The solution to the problem at hand can easily be derived
from it.
Wait for 51,200 bit times.
For 10 Mbps, this wait is
51.2 x 103 bits : 10 x 10
6 bps = 5.12 msec
For 100 Mbps, the wait is 512 µsec.
9. Link Layer – Switched LANs – (10 points)
Let us consider the operation of a learning switch in the context of a network in
which 8 nodes labeled A through H are star connected into an Ethernet switch.
Suppose that (i) B sends a frame to F, (ii) F replies with a frame to B, (iii) A sends
a frame to B, (iv) B replies with a frame to A. The switch table is initially empty.
9.a. (5 points) Show the state of the switch table before and after each of these
events.
21
9.b. (5 points) For each of these events, identify the link(s) on which the
transmitted frame will be forwarded, and briefly justify your answers.
The following is a sample solution for 6 nodes A to F, then B to E, E replies to
B, A sends frame to B, B replies to A. The solution to the problem at hand
can easily be derived from it:
Action Switch Table State Link(s) packet is
forwarded to
Explanation
B sends a frame
to E
Switch learns interface
corresponding to MAC
address of B
A, C, D, E, and F Since switch table is
empty, so switch does
not know the interface
corresponding to MAC
address of E
E replies with a
frame to B
Switch learns interface
corresponding to MAC
address of E
B Since switch already
knows interface
corresponding to MAC
address of B
A sends a frame
to B
Switch learns the interface
corresponding to MAC
address of A
B Since switch already
knows the interface
corresponding to MAC
address of B
B replies with a
frame to A
Switch table state remains
the same as before
A Since switch already
knows the interface
corresponding to MAC
address of A
10. Wireless (8 points)
In an 802.11 wireless network, station A sends one non-fragmented data frame to
station B. What would be the value of the D field (in microseconds) that needs to
be set for the NAV period in each of the following frames: RTS, CTS, Data, and
ACK?
Assumptions:
The transmission time for RTS, CTS, and ACK is 8 μs each.
The transmission time for the data frame is 50 μs.
The SIFS duration is set to 1 μs.
Propagation time may be ignored.
Each frame needs to set the duration of NAV for the rest of time the
medium needs to be reserved to complete the transaction.
Answer for 4 μs each, 50 μs, and 1 μs.
RTS = TSIFS + TCTS + TSIFS + TData + TSIFS + TACK = 3*1 + 4 + 40 + 4 = 51μs CTS = TSIFS + TData + TSIFS + TACK = 2*1 + 4 + 40 + 4 = 46μs Data = TSIFS + TACK = 5μs Ack = 0 μs