Sie sind auf Seite 1von 114

MODULE -5

TRANSPORT LAYER
&
DOMAIN NAME SYSTEM

Computer Communication Networks


Computer Communication Networks
Figure 2.5 Taxonomy of protocols discussed in this chapter
2-4 NOISELESS CHANNELS

Let us first assume we have an ideal channel in which no frames


are lost, duplicated, or corrupted. We introduce two protocols for
this type of channel.

Topics discussed in this section:


Simplest Protocol
Stop-and-Wait Protocol
Figure 2.6 The design of the simplest protocol with no flow or error control
Example 2.1

Figure 2.7 shows an example of communication using


this protocol. It is very simple. The sender sends a
sequence of frames without even thinking about the
receiver. To send three frames, three events occur at the
sender site and three events at the receiver site. Note that
the data frames are shown by tilted boxes; the height of
the box defines the transmission time difference between
the first bit and the last bit in the frame.
Figure 2.7 Flow diagram for Example 2.1
Figure 2.8 Design of Stop-and-Wait Protocol
Example 2.2

Figure 2.9 shows an example of communication using


this protocol. It is still very simple. The sender sends one
frame and waits for feedback from the receiver. When the
ACK arrives, the sender sends the next frame. Note that
sending two frames in the protocol involves the sender in
four events and the receiver in two events.
Figure 2.9 Flow diagram for Example 2.2
2-5 NOISY CHANNELS

Although the Stop-and-Wait Protocol gives us an idea of


how to add flow control to its predecessor, noiseless
channels are nonexistent. We discuss three protocols in
this section that use error control.

Topics discussed in this section:


Stop-and-Wait Automatic Repeat Request
Go-Back-N Automatic Repeat Request
Selective Repeat Automatic Repeat Request
Stop-and-Wait Automatic
Repeat Request
Figure 2.10 Design of the Stop-and-Wait ARQ Protocol
Example 2.3

Figure 2.11 shows an example of Stop-and-Wait ARQ.


Frame 0 is sent and acknowledged. Frame 1 is lost and
resent after the time-out. The resent frame 1 is
acknowledged and the timer stops. Frame 0 is sent and
acknowledged, but the acknowledgment is lost. The
sender has no idea if the frame or the acknowledgment
is lost, so after the time-out, it resends frame 0, which is
acknowledged.
Figure 2.11 Flow diagram for Example 11.3
Go-Back-N ARQ Protocol
Figure 2.12 Send window for Go-Back-N ARQ
Figure 2.13 Receive window for Go-Back-N ARQ
Note

The receive window is an abstract


concept defining an imaginary box
of size 1 with one single variable Rn.
The window slides
when a correct frame has arrived;
sliding occurs one slot at a time.
Figure 2.14 Design of Go-Back-N ARQ
Figure 2.15 Window size for Go-Back-N ARQ
Note

In Go-Back-N ARQ, the size of the send


window must be less than 2m;
the size of the receiver window
is always 1.
Example 2.6
Figure 2.16 shows an example of Go-Back-N. This is an
example of a case where the forward channel is reliable,
but the reverse is not. No data frames are lost, but some
ACKs are delayed and one is lost. The example also
shows how cumulative acknowledgments can help if
acknowledgments are delayed or lost. After initialization,
there are seven sender events. Request events are
triggered by data from the network layer; arrival events
are triggered by acknowledgments from the physical
layer. There is no time-out event here because all
outstanding frames are acknowledged before the timer
expires. Note that although ACK 2 is lost, ACK 3 serves as
both ACK 2 and ACK 3.
Figure 2.16 Flow diagram for Example 2.6
Example 2.7

Figure 2.17 shows what happens when a frame is lost.


Frames 0, 1, 2, and 3 are sent. However, frame 1 is lost.
The receiver receives frames 2 and 3, but they are
discarded because they are received out of order. The
sender receives no acknowledgment about frames 1, 2, or
3. Its timer finally expires. The sender sends all
outstanding frames (1, 2, and 3) because it does not know
what is wrong. Note that the resending of frames 1, 2, and
3 is the response to one single event. When the sender is
responding to this event, it cannot accept the triggering of
other events. This means that when ACK 2 arrives, the
sender is still busy with sending frame 3.
Example 2.7 (continued)

The physical layer must wait until this event is completed


and the data link layer goes back to its sleeping state. We
have shown a vertical line to indicate the delay. It is the
same story with ACK 3; but when ACK 3 arrives, the
sender is busy responding to ACK 2. It happens again
when ACK 4 arrives. Note that before the second timer
expires, all outstanding frames have been sent and the
timer is stopped.
Figure 2.17 Flow diagram for Example 2.7
Figure 2.5 Taxonomy of protocols discussed in this chapter
The Stop-and-Wait ARQ Protocol, adds a
simple error control mechanism to the Stop-
and-Wait Protocol.

In the Go-Back-N ARQ Protocol, we can


send several frames before receiving
acknowledgments, improving the efficiency
of transmission.

In the Selective Repeat ARQ protocol we


avoid unnecessary transmission by sending
only frames that are corrupted.
Selective Repeat ARQ Protocol
Figure 2.18 Send window for Selective Repeat ARQ
Figure 2.19 Receive window for Selective Repeat ARQ
Figure 2.20 Design of Selective Repeat ARQ
Figure 2.21 Selective Repeat ARQ, window size
Figure 2.22 Delivery of data in Selective Repeat ARQ
Example 2.8

This example is similar to Example 2.3 in which frame 1


is lost. We show how Selective Repeat behaves in this
case. Figure 2.23 shows the situation. One main
difference is the number of timers. Here, each frame sent
or resent needs a timer, which means that the timers need
to be numbered (0, 1, 2, and 3). The timer for frame 0
starts at the first request, but stops when the ACK for this
frame arrives. The timer for frame 1 starts at the second
request, restarts when a NAK arrives, and finally stops
when the last ACK arrives. The other two timers start
when the corresponding frames are sent and stop at the
last arrival event.
Example 2.8 (continued)

At the receiver site we need to distinguish between the


acceptance of a frame and its delivery to the network
layer. At the second arrival, frame 2 arrives and is stored
and marked, but it cannot be delivered because frame 1 is
missing. At the next arrival, frame 3 arrives and is
marked and stored, but still none of the frames can be
delivered. Only at the last arrival, when finally a copy of
frame 1 arrives, can frames 1, 2, and 3 be delivered to the
network layer. There are two conditions for the delivery of
frames to the network layer: First, a set of consecutive
frames must have arrived. Second, the set starts from the
beginning of the window.
Example 2.8 (continued)

Another important point is that a NAK is sent after the


second arrival, but not after the third, although both
situations look the same. The reason is that the protocol
does not want to crowd the network with unnecessary
NAKs and unnecessary resent frames. The second NAK
would still be NAK1 to inform the sender to resend frame
1 again; this has already been done. The first NAK sent is
remembered (using the nakSent variable) and is not sent
again until the frame slides. A NAK is sent once for each
window position and defines the first slot in the window.
Example 2.8 (continued)

The next point is about the ACKs. Notice that only two
ACKs are sent here. The first one acknowledges only the
first frame; the second one acknowledges three frames. In
Selective Repeat, ACKs are sent when data are delivered to
the network layer. If the data belonging to n frames are
delivered in one shot, only one ACK is sent for all of them.
Figure 2.23 Flow diagram for Example 2.8
PIGGYBACKING
A technique called piggybacking is
used to improve the efficiency of the
bidirectional protocols.

When a frame is carrying data from


A to B, it can also carry control
information about frames from B;

when a frame is carrying data from B


to A, it can also carry control
information about frames from A.
Figure 2.24 Design of piggybacking in Go-Back-N ARQ
1a). Explain the ISO-OSI reference model with a neat diagram. Discuss
the function of each layer. (10M)

b).With a neat diagram, describe the TCP/IP reference model. Explain the
protocol functions of each layer (10 marks)

2a). List different types of addressing in TCP. Explain all types of addressing
with a suitable example . (10M)

b) List the differences between:


i) Connection oriented and connectionless communication
(10 marks)
ii) OSI and TCP/IP

Computer Communication Networks


Chapter 23

User Datagram
Protocol
Objectives
Upon completion you will be able to:

• Be able to explain process-to-process communication


• Know the format of a UDP user datagram
• Be able to calculate a UDP checksum
• Understand the operation of UDP
• Know when it is appropriate to use UDP

TCP/IP 45
Protocol Suite
Figure 11.1 Position of UDP in the TCP/IP protocol suite

TCP/IP 46
Protocol Suite
11.1 PROCESS-TO-PROCESS
COMMUNICATION
Before we examine UDP, we must first understand host-to-host
communication and process-to-process communication and the difference
between them.

The topics discussed in this section include:

Port Numbers
Socket Addresses

TCP/IP 47
Protocol Suite
socket

The combination of the IP address


and the port number, called the
socket address, defines a process
and a host.
Figure 11.6 Socket address

TCP/IP 49
Protocol Suite
Figure 11.2 UDP versus IP

TCP/IP 50
Protocol Suite
Figure 11.3 Port numbers

TCP/IP 51
Protocol Suite
Figure 11.4 IP addresses versus port numbers

TCP/IP 52
Protocol Suite
Figure 11.5 ICANN ranges

Internet Corporation for Assigned Names & Numbers

TCP/IP 53
Protocol Suite
Note:

The well-known port numbers are less


than 1024.

TCP/IP 54
Protocol Suite
Table 11.1 Well-known ports used with UDP

TCP/IP 55
Protocol Suite
Example 1
In UNIX, the well-known ports are stored in a file called
/etc/services. Each line in this file gives the name of the server
and the well-known port number. We can use the grep utility to
extract the line corresponding to the desired application. The
following shows the port for TFTP. Note TFTP can use port 69
on either UDP or TCP.

$ grep tftp /etc/services


tftp 69/tcp
tftp 69/udp

See Next Slide


TCP/IP 56
Protocol Suite
Example 1 (Continued)

SNMP uses two port numbers (161 and 162), each for a different
purpose, as we will see in Chapter 21.

$ grep snmp /etc/services


snmp 161/tcp #Simple Net Mgmt Proto
snmp 161/udp #Simple Net Mgmt Proto
snmptrap 162/udp #Traps for SNMP

TCP/IP 57
Protocol Suite
Figure 11.6 Socket address

TCP/IP 58
Protocol Suite
11.2 USER DATAGRAM

UDP packets are called user datagrams and


have a fixed-size header of 8 bytes.

TCP/IP 59
Protocol Suite
UDP is a connectionless, unreliable
transport layer protocol with no
embedded flow or error control
mechanism except the checksum for
error detection.

The UDP packet is called a user


datagram. A user datagram is
encapsulated in the
data field of an IP datagram.
Figure 11.7 User datagram format

TCP/IP 61
Protocol Suite
Note:

UDP length =
IP length − IP header’s length

TCP/IP 62
Protocol Suite
11.3 CHECKSUM
UDP checksum calculation is different from the one for IP and ICMP. Here
the checksum includes three sections: a pseudoheader, the UDP header,
and the data coming from the application layer.

The topics discussed in this section include:

Checksum Calculation at Sender


Checksum Calculation at Receiver
Optional Use of the Checksum

TCP/IP 63
Protocol Suite
Figure 11.8 Pseudoheader for checksum calculation

TCP/IP 64
Protocol Suite
Figure 11.9 Checksum calculation of a simple UDP user datagram

TCP/IP 65
Protocol Suite
11.4 UDP OPERATION
UDP uses concepts common to the transport layer. These concepts will be
discussed here briefly, and then expanded in the next chapter on the TCP
protocol.

The topics discussed in this section include:

Connectionless Services
Flow and Error Control
Encapsulation and Decapsulation
Queuing
Multiplexing and Demultiplexing

TCP/IP 66
Protocol Suite
Figure 11.10 Encapsulation and decapsulation

TCP/IP 67
Protocol Suite
Figure 11.11 Queues in UDP

TCP/IP 68
Protocol Suite
Figure 11.12 Multiplexing and demultiplexing

TCP/IP 69
Protocol Suite
Chapter 25

Transmission
Control Protocol
Objectives
Upon completion you will be able to:
• Be able to name and understand the services offered by TCP
• Understand TCP’s flow and error control and congestion control
• Be familiar with the fields in a TCP segment
• Understand the phases in a connection-oriented connection
• Understand the TCP transition state diagram
• Be able to name and understand the timers used in TCP
• Be familiar with the TCP options
TCP/IP 70
Protocol Suite
Figure 12.1 TCP/IP protocol
suite

TCP/IP 71
Protocol Suite
12.1 TCP SERVICES
We explain the services offered by TCP to the processes at the application
layer.

The topics discussed in this section include:

Process-to-Process Communication
Stream Delivery Service
Full-Duplex Communication
Connection-Oriented Service
Reliable Service

TCP/IP 72
Protocol Suite
Transmission Control Protocol (TCP) is one
of the transport layer protocols in the
TCP/IP protocol suite.

TCP provides process-to-process, full-


duplex, and connection-oriented service.

The unit of data transfer between two


devices using TCP software is called a
segment; it has 20 to 60 bytes of header,
followed by data from the application
program.
Table 12.1 Well-known ports used by TCP

TCP/IP 74
Protocol Suite
Example 1

As we said in Chapter 11, in UNIX, the well-known ports are


stored in a file called /etc/services. Each line in this file gives the
name of the server and the well-known port number. We can use
the grep utility to extract the line corresponding to the desired
application. The following shows the ports for FTP.

$ grep ftp /etc/services


ftp-data 20/tcp
ftp-control 21/tcp

TCP/IP 75
Protocol Suite
Figure 12.2 Stream delivery

TCP/IP 76
Protocol Suite
Figure 12.3 Sending and
receiving buffers

TCP/IP 77
Protocol Suite
Figure 12.4 TCP segments

TCP/IP 78
Protocol Suite
12.2 TCP FEATURES
To provide the services mentioned in the previous section, TCP has several
features that are briefly summarized in this section.

The topics discussed in this section include:

Numbering System
Flow Control
Error Control
Congestion Control

TCP/IP 79
Protocol Suite
Note:

The bytes of data being transferred in


each connection are numbered by TCP.
The numbering starts with a randomly
generated number.

TCP/IP 80
Protocol Suite
Example 2

Suppose a TCP connection is transferring a file of 5000 bytes.


The first byte is numbered 10001. What are the sequence
numbers for each segment if data is sent in five segments, each
carrying 1000 bytes?
Solution
The following shows the sequence number for each segment:
Segment 1 ➡ Sequence Number: 10,001 (range: 10,001 to 11,000)
Segment 2 ➡ Sequence Number: 11,001 (range: 11,001 to 12,000)
Segment 3 ➡ Sequence Number: 12,001 (range: 12,001 to 13,000)
Segment 4 ➡ Sequence Number: 13,001 (range: 13,001 to 14,000)
Segment 5 ➡ Sequence Number: 14,001 (range: 14,001 to 15,000)
TCP/IP 81
Protocol Suite
Note:

The value in the sequence number field


of a segment defines the number of the
first data byte contained
in that segment.

TCP/IP 82
Protocol Suite
Note:

The value of the acknowledgment field


in a segment defines the number of the
next byte a party expects to receive.
The acknowledgment number is
cumulative.

TCP/IP 83
Protocol Suite
12.3 SEGMENT
A packet in TCP is called a segment

The topics discussed in this section include:

Format
Encapsulation

TCP/IP 84
Protocol Suite
Figure 11.7 User datagram format

TCP/IP 85
Protocol Suite
Figure 12.5 TCP segment
format

TCP/IP 86
Protocol Suite
Figure 12.6 Control field

TCP/IP 87
Protocol Suite
Table 12.2 Description of flags in the control field

TCP/IP 88
Protocol Suite
Figure 12.7 Pseudoheader
added to the TCP datagram

TCP/IP 89
Protocol Suite
Note:

The inclusion of the checksum in TCP is


mandatory.

TCP/IP 90
Protocol Suite
Figure 12.8 Encapsulation
and decapsulation

TCP/IP 91
Protocol Suite
A TCP connection normally consists of three
phases: 1. connection establishment
2. data transfer
3. connection termination.

Connection establishment requires three-way


handshaking; connection termination requires
three- or four-way handshaking.

o TCP uses flow control, implemented as a sliding


window mechanism, to avoid
overwhelming a receiver with data.
12.4 A TCP CONNECTION
TCP is connection-oriented. A connection-oriented transport protocol
establishes a virtual path between the source and destination. All of the
segments belonging to a message are then sent over this virtual path. A
connection-oriented transmission requires three phases: connection
establishment, data transfer, and connection termination.

The topics discussed in this section include:

Connection Establishment
Data Transfer
Connection Termination
Connection Reset

TCP/IP 93
Protocol Suite
Figure 12.9 Connection establishment
using three-way handshaking

TCP/IP 94
Protocol Suite
Note:

A SYN segment cannot carry data, but it


consumes one sequence number.

TCP/IP 95
Protocol Suite
Note:

A SYN + ACK segment cannot carry


data, but does consume one
sequence number.

TCP/IP 96
Protocol Suite
Note:

An ACK segment, if carrying no data,


consumes no sequence number.

TCP/IP 97
Protocol Suite
Figure 12.10 Data transfer

TCP/IP 98
Protocol Suite
Note:

The FIN segment consumes one


sequence number if it does not carry
data.

TCP/IP 99
Protocol Suite
Figure 12.11 Connection termination
using three-way handshaking

TCP/IP 100
Protocol Suite
Note:

The FIN + ACK segment consumes one


sequence number if it does not carry
data.

TCP/IP 101
Protocol Suite
Figure 12.12 Half-close

TCP/IP 102
Protocol Suite
1 a).Explain the different protocols used in noiseless
channels ( Go-Back- N Protocol & Selective repeat
Prptocol. (20 marks)

1b). How is TCP better than UDP?. Explain services


Offered by TCP. (10 Marks)

25.103
2. a). Explain the different fields in TCP header and mention the fields
that are used for Addressing, error control and flow control.
( 10 marks)

b). Explain connection establishment, Data Transfer, connection


termination and half close in TCP. (32 marks)

3). Write short notes on any Four ( Each 10 marks)


a). user datagram protocol ( UDP )datagram format.
b) Compare between UDP & TCP

c) Compare and contrast the Go-Back-N ARQ and selective


repeat ARQ protocols.
d). Define piggybacking and its usefulness.
25.104
Unit -8

1. a). Explain the different fields in TCP header and mention the
fields that are used for Addressing, error control and flow control.
( 10 marks)

b). Explain connection establishment, Data Transfer and connection


termination in TCP. (10 marks)

2). Write short notes on any Four ( Each 10 marks)


a). user datagram protocol ( UDP ).

b) Compare between UDP & TCP


I. a) . What is the difference between a direct and an indirect delivery?
(6 marks)
b) Explain dynamic routing table ( 8M )

c). Explain in detail, three different forwarding techniques. (10 marks)

II). Explain in detail with diagrams, the following Routing Protocols


( algorithms) ( Each one 12 marks)

a). Distance Vector Routing OR Routing Information Protocol


( RIP )

b). Link State Routing OR Open Shortest Path First ( OSPF )


and types of links OR Dijkstra Algorithms

c). Path Vector Routing OR Border Gateway Protocol ( BGP )

)
1a.Explain the different fields of IPv4 datagram format.

1b. Explain the operation of External and Internal Border


Gateway Protocol

2a. Explain the ICMPv4 message format. Write short Each


notes on Security of IPv4 10 M

b. Draw a neat diagram of areas in an Autonomous


system in OSPF. Explain Least cost tree using shared
link state data base with suitable example.

3 a. Explain sending and receiving buffers in TCP.

Each
3b. Explain with neat diagram the three phases in
10 M
Mobile host communication.
4a. Explain the Go-Back-N protocol &
Each
Selective Repeat ARQ with suitable FSMs.
10 M

5 a. Explain sending and receiving buffers in


TCP.
Each
10 M
5 b. Discuss the general services provided by
UDP.
3c).Draw a neat diagram of areas in an
Autonomous system in OSPF. Explain Least
cost tree using shared link state data base
with suitable example.
10

3d). Explain the operation of External and


Internal Border Gateway Protocol

10
Q1
• In a block, the prefix length is /24; what is the mask?

• A) 255.255.255.0
• B) 255.255.242.0
• C) 255.255.0.0
• D) none of the above

Computer Communication Networks


Q2
• The IPv4 header size _______.

• A) is 20 to 60 bytes long
• B) is 20 bytes long
• C) is 60 bytes long
• D) none of the above

Computer Communication Networks


Q3
• In IPv4, what is the value of the total length field in bytes if the
header is 28 bytes and the data field is 400 bytes?

• A) 428
• B) 407
• C) 107
• D) 427

Computer Communication Networks


Additional References
• http://iit.qau.edu.pk/books/Data%20Communications%20and
%20Networking%20By%20Behrouz%20A.Forouzan.pdf

• http://www.froydwess.com/2014/04/mcqs-in-data-
communications-and-networking.html

Computer Communication Networks


Questions

Computer Communication Networks

Das könnte Ihnen auch gefallen