0% found this document useful (0 votes)
10 views

Unit 4

Subject: Computer Network security notes

Uploaded by

Pradnya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Unit 4

Subject: Computer Network security notes

Uploaded by

Pradnya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 155

Final Unit 4

Transport Layer: What TCP does?


• TCP provides a reliable transport service
• TCP must use an inherently unreliable service of IP, to provide reliable service.
• TCP must supply / provide a service that guarantees
• Prompt, reliable communication.
• Data delivery in the same order sent.
• No loss.
• No duplication.
• Services provided by TCP
• Connection Oriented service
• End -To- End (Process-To-Process) Communication
• Complete Reliability
• Full Duplex Communication
• Stream Interface
• Reliable Connection Startup
• Graceful Connection Shutdown
2
Transport Layer: What TCP does?
• TCP: Connection Oriented Service
• TCP is a connection-oriented protocol.
• When a process at site A wants to send and receive data from another process at
site B, the following occurs:
• The two TCPs establish a connection between them.
• Data are exchanged in both directions.
• The connection is terminated.
• Note that this is a virtual connection, not a physical connection.
• In addition, TCP uses flow and error control mechanisms at the transport level.
• TCP: End -To- End (Process-To-Process) Communication
• TCP provides a connection from one application (example: file) on a computer to an application (example: file) on a
remote computer.
• Connection is virtual - provided by software passing messages.
• TCP messages are encapsulated in IP Datagram at source.
• Upon arrival IP passes the TCP message on to the TCP layer at destination.
• TCP exists at both end of the connection but not at intermediate points (routers).

3
Transport Layer: What TCP does?
• TCP: End -To- End (Process-To-Process) Communication

4
Transport Layer: What TCP does?

• TCP: Reliability
• Causes of problems
• Failure of the IP system to deliver information reliably
• Messages may be duplicated, lost, delayed or delivered out of order.
• Reboot of a host computer
• Two programs make a connection.
• One computer reboots.
• New connection is formed.
• Messages from first session now arrive.

5
Transport Layer: What TCP does?
• TCP: Reliability
• Packet Loss and Retransmission
Host 1 Host 2
Send P1 Receive P1
Start timer Send ack1
Receive ack1
Send P2
Start timer
Packet Loss
Timer expires
Retransmit P2 Receive P2
Start timer Send ack2
Receive ack2

6
Transport Layer: What TCP does?
• TCP: Buffers and Windows
• Sending and Receiving host can have a buffer.
• Acknowledgements send between sender and receiver can contain
information about amount of free buffer space available (Window).
• Sender will not send more data than buffer (receiver’s) will hold.
• Receiver, as buffer space increases (i.e. application consumes from buffer)
sends additional acks to sender to update it’s buffer space available.

7
Transport Layer: What TCP does?
• TCP: Sliding Window
• TCP uses a sliding window to handle flow control and error control.
• The sliding window protocol used by TCP, however, is something between
the Go-Back-N and Selective Repeat sliding window.
• The sliding window protocol in TCP looks like the Go-Back-N protocol
because it does not use NAKs;
• It looks like Selective Repeat because the receiver holds the out-of-order
segments until the missing ones arrive.
• Main difference between TCP sliding window and the one we uses at the
data link layer is.
• The sliding window of TCP is byte-oriented; whereas in the data link
layer it is frame-oriented.

8
Transport Layer: What TCP does?
• TCP: Sliding Window

Sliding Window Protocol: 1 2 3 4 5 6 7 8 9 10 11 12 ….


9
Transport Layer: What TCP does?
• TCP: Congestion Control
• Upon sensing congestion (lost message)
• Send a single message.
• If received okay.
• Send twice as much data.
• Keep increasing until amount of data is 50% of receivers advertised
window size.
• TCP: provides Multiplexing and De-Multiplexing

1
0
Transport Layer: What TCP does?
• TCP: provides Multiplexing and De-Multiplexing
• Multiplexing: At sender site, there may be several processes that need to
send packets. However, there is only one transport layer protocol (TCP).
• This is a many-to-one relationship and requires multiplexing.
• The protocol (TCP) accepts messages from different processes,
differentiated by their assigned port numbers.
• De-Multiplexing: At the receiver site, the relationship is one-to-many
and requires de-multiplexing.
• The transport layer (TCP) receives datagram from the network layer. After
error checking and dropping of the header, the transport layer (TCP)
delivers each message to the appropriate process based on the port number.
• TCP: Port Numbers
• At transport layer, we need a transport layer address called a port number
to choose among multiple processes running on the destination host.
• Multiple connections from many hosts.
• Multiple connections from one host.
1
1
Transport Layer: What TCP does?
• TCP: provides Reliable Connection Startup
• The connection establishment in TCP is called three way handshaking.
• An application program, called the client, wants to make a connection
with another application program, called the server, using TCP.
• The server program tells its TCP that it is ready to accept a connection.
This is called a request for a passive open.
• The client program issues a request for an active open. A client that
wishes to connect to an open server tells its TCP that it needs to be
connected to that particular server.
• TCP can now start the three-way handshaking process as shown in Figure.
• TCP: provides graceful Connection Shutdown
• Most implementations today allow three-way handshaking for connection
termination as shown in Figure.

1
2
Transport Layer: What TCP does?
• TCP: Connection establishment using three-way handshaking.
• TCP: Connection termination using three-way handshaking.

1
3
Transport Layer Services

• Process to Process delivery


• Addressing
• Multiplexing and Demultiplexing
• Connectionless and Connection Oriented Service
• Reliable and Unreliable Service
PROCESS-TO-PROCESS DELIVERY : Types of data deliveries
Addressing
• A frame in the data link layer needs a destination MAC address
for delivery and a source address for the next node's reply.

• At the network layer, we need an IP address to choose one host


among millions. Network layer needs a destination IP address for
delivery and a source IP address for the destination's reply.

• At the transport layer, we need a transport layer address, called a


port number, to choose among multiple processes running on the
destination host.

16
Continue….
• In the Internet model, the port numbers are 16-bit integers
between 0 and 65,535.

• The lANA (Internet Assigned Number Authority) has divided the


port numbers into three ranges: well known, registered, and
dynamic (or private).

• Well-known ports :- The ports ranging from 0 to 1023 are


assigned and controlled by lANA.
• Registered ports :- The ports ranging from 1024 to 49,151 are not
assigned or controlled by lANA. They can only be registered with
lANA to prevent duplication.
17
Port Number

• Dynamic ports:- The ports ranging from 49,152 to 65,535 are neither controlled
nor registered. They can be used by any process. These are the ephemeral ports.

• The destination IP address defines the host among the different hosts in the
world.

• After the host has been selected, the port number defines one of the processes
on this particular host.

18
IP addresses versus port numbers
Socket Addresses
• Process-to-process delivery needs two identifiers, IP address and the port
number, at each end to make a connection.

• The combination of an IP address and a port number is called a socket address.

• The client socket address defines the client process uniquely just as the server
socket address defines the server process uniquely.

20
Multiplexing and Demultiplexing

Multiplexing (or muxing) is a way of sending multiple signals or streams of information over
a communications link at the same time in the form of a single, complex signal; the receiver
recovers the separate signals, a process calleddemultiplexing (or demuxing).

21
Connectionless Versus Connection-Oriented Service

• In a connectionless service, the packets are sent from one party to another with
no need for connection establishment or connection release.

• The packets are not numbered; they may be delayed or lost or may arrive out of
sequence. There is no acknowledgment either.

• UDP, is connectionless protocol.

22
Connection oriented

• In a connection-oriented service, a connection is first established between the


sender and the receiver. Data are transferred. At the end, the connection is
released.

• TCP and SCTP are connection-oriented protocols.

23
Reliable Versus Unreliable : Error control
Position of UDP, TCP, and SCTP in TCP/IP suite
User Datagram Protocol (UDP)

• The User Datagram Protocol (UDP) is called a connectionless, unreliable


transport protocol.

• If UDP is so powerless, why would a process want to use it?

• If a process wants to send a small message and does not care much about
reliability, it can use UDP.(using UDP takes much less interaction between the
sender and receiver than using TCP or SCTP)

26
27
User Datagram

UDP packets, called user datagrams, have a fixed-size header of 8 bytes.

TCP/IP Protocol Suite 28


Use of UDP
• UDP is suitable for a process that requires simple request-
response communication with little concern for flow and error
control.

• UDP is a suitable transport protocol for multicasting.


Multicasting capability is embedded in the UDP software but
not in the TCP software.

• UDP is used for some route updating protocols such as Routing


Information Protocol (RIP).

• UDP is used for management processes such as SNMP

29
UDP Operations

• Connectionless services
• Flow control and error control
• Encapsulation and decapsulation
• Queuing
Queues in UDP
Introduction to TCP

• TCP is a process-to-process (program-to-program) protocol.


• TCP is a connection-oriented protocol; it creates a virtual connection between
two TCPs to send data.
• TCP uses flow and error control mechanisms at the transport level.
• In brief, TCP is called a connection-oriented, reliable transport protocol.
• It adds connection-oriented and reliability features to the services of IP

32
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

33
TCP provides process-to-process communication using port numbers.

Table 1 Well-known ports used by TCP

34
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 ports for FTP.

$ grep ftp /etc/services


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

35
Figure 2 Stream delivery

TCP creates an environment in which the two processes seem to be connected


by an imaginary "tube“ that carries their data across the Internet.

36
Figure 3 Sending and receiving buffers

two buffers of 20 bytes each

37
Figure 4 TCP segments

TCP groups a number of bytes together into a packet called a segment


38
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
Congestion Control

39
Note:

The bytes of data being transferred in


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

40
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)

41
Note:

The value in the sequence number field


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

42
3 SEGMENT
A packet in TCP is called a segment

The topics discussed in this section include:

Format
Encapsulation

43
Figure 5 TCP segment format 20 to 60 Bytes

44
TCP segment format fields.
• The segment consists of a 20 to 60 byte header.

• The header is 20 bytes if there are no options and up to 60


bytes if it contains options.

• Source port address: This is a 16-bit field that defines the port
number of the application program in the host that is sending
the segment.

• Destination port address: This is a 16-bit field that defines the


port number of the application program in the host that is
receiving the segment.

45
Continue..
• Sequence number:- This 32-bit field defines the number
assigned to the first byte of data contained in this segment.

• Acknowledgment number:- This 32-bit field defines the byte


number that the receiver of the segment is expecting to
receive from the other party.

• Header length:- This 4-bit field indicates the number of 4-byte


words in the TCP header. The length of the header can be
between 20 and 60 bytes.

• Reserved:- This is a 6-bit field reserved for future use.

46
Figure Control field

These bits enable flow control, connection establishment and


termination, connection abortion, and the mode of data transfer in TCP.

47
Continue..
• Window size:- This value is normally referred to as the
receiving window (rwnd) and is determined by the receiver(16
bit field, which means that the maximum size of the window is
65,535 bytes. )

• Checksum:- This 16-bit field contains the checksum. Inclusion


of the checksum in the UDP datagram is optional, whereas the
inclusion of the checksum for TCP is mandatory.

• Urgent pointer: This l6-bit field, which is valid only if the


urgent flag is set, is used when the segment contains urgent
data.

48
Note:

The inclusion of the checksum in TCP is


mandatory.

49
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

50
Figure .9 Connection establishment using three-way handshaking

51
Note:

A SYN segment cannot carry data, but it


consumes one sequence number.

52
Note:

A SYN + ACK segment cannot carry


data, but does consume one
sequence number.

53
Note:

An ACK segment, if carrying no data,


consumes no sequence number.

54
Figure Data transfer

55
Figure Connection termination using three-way handshaking

56
FLOW CONTROL
Flow control regulates the amount of data a source can send before
receiving an acknowledgment from the destination. TCP defines a window
that is imposed on the buffer of data delivered from the application
program.

The topics discussed in this section include:

Sliding Window Protocol


Silly Window Syndrome

57
Figure 12.20 Sliding window

58
Flow control
• The imaginary window has two walls: one left and
one right.

• Opening a window means moving the right wall to the


right. This allows more new bytes in the buffer that
are eligible for sending.

• Closing the window means moving the left wall to the


right. This means that some bytes have been
acknowledged and the sender need not worry about
them anymore.
59
Continue..

• Shrinking the window means moving the right wall to the left.

• The size of the window at one end is determined by the lesser of two
values: receiver window (rwnd) or congestion window (cwnd).

• The receiver window is the value advertised by the opposite end in a


segment containing acknowledgment.

60
Continue..

• It is the number of bytes the other end can accept before its buffer
overflows and data are discarded.

• The congestion window is a value determined by the network to


avoid congestion.

61
Note:

A sliding window is used to make


transmission more efficient as well as to
control the flow of data so that the
destination does not become
overwhelmed with data.
TCP’s sliding windows are byte
oriented.
62
Example 1

What is the value of the receiver window (rwnd) for host A if the
receiver, host B, has a buffer size of 5,000 bytes and 1,000 bytes
of received and unprocessed data?

Solution
The value of rwnd = 5,000 − 1,000 = 4,000. Host B can receive
only 4,000 bytes of data before overflowing its buffer. Host B
advertises this value in its next segment to A.

63
Example 2

Figure 1 shows an unrealistic example of a sliding window. The


sender has sent bytes up to 202. We assume that cwnd is 20 (in
reality this value is thousands of bytes). The receiver has sent an
acknowledgment number of 200 with an rwnd of 9 bytes (in
reality this value is thousands of bytes). The size of the sender
window is the minimum of rwnd and cwnd or 9 bytes. Bytes 200
to 202 are sent, but not acknowledged. Bytes 203 to 208 can be
sent without worrying about acknowledgment. Bytes 209 and
above cannot be sent.

64
Figure 1 Example 2

65
Note:

Some points about TCP’s sliding windows:


❏ The size of the window is the lesser of rwnd and cwnd.
❏ The source does not have to send a full window’s
worth of data.
❏ The window can be opened or closed by the receiver,
but should not be shrunk.
❏ The destination can send an acknowledgment at any
time as long as it does not result in a shrinking window.
❏ The receiver can temporarily shut down the window;
the sender, however, can always send a segment of one
byte after the window is shut down.

66
CONGESTION CONTROL
Congestion control refers to the mechanisms and techniques to keep the
load below the capacity.

The topics discussed in this section include:

Network Performance
Congestion Control Mechanisms
Congestion Control in TCP

67
Figure 12.30 Router queues

68
Figure 12.31 Packet delay and network load

69
Figure 12.32 Throughput versus network load

70
Figure 12.33 Slow start, exponential increase

71
Note:

In the slow start algorithm, the size of


the congestion window increases
exponentially until it reaches a
threshold.

72
Figure 12.34 Congestion avoidance, additive increase

Round Trip Time (RTT)

73
Note:

In the congestion avoidance algorithm


the size of the congestion window
increases additively until
congestion is detected.

74
Note:

Most implementations react differently to


congestion detection:
❏ If detection is by time-out, a new slow start phase
starts.

❏ If detection is by three ACKs, a new congestion


avoidance phase starts.

75
Figure 12.35 TCP congestion policy summary

76
Figure 12.36 Congestion example

77
12.9 TCP TIMERS
To perform its operation smoothly, most TCP implementations use at least
four timers.

The topics discussed in this section include:

Retransmission Timer
Persistence Timer
Keepalive Timer
TIME-WAIT Timer

78
Figure 12.37 TCP timers

79
Note:

In TCP, there can be only be one RTT


measurement in progress at any time.

80
Example 10

Let us give a hypothetical example. Figure 12.38 shows part of a


connection. The figure shows the connection establishment and
part of the data transfer phases.
1. When the SYN segment is sent, there is no value for RTTM , RTTS , or RTTD .
The value of RTO is set to 6.00 seconds. The following shows the value of
these variables at this moment:

RTTM = 1.5 RTTS = 1.5


RTTD = 1.5 / 2 = 0.75 RTO = 1.5 + 4 . 0.75 = 4.5

2. When the SYN+ACK segment arrives, RTTM is measured and is equal to


1.5 seconds. The next slide shows the values of these variables:

81
Example 10 (continued)

RTTM = 1.5 RTTS = 1.5


RTTD = 1.5 / 2 = 0.75 RTO = 1.5 + 4 . 0.75 = 4.5

3.When the first data segment is sent, a new RTT measurement


starts. Note that the sender does not start an RTT measurement
when it sends the ACK segment, because it does not consume a
sequence number and there is no time-out. No RTT measurement
starts for the second data segment because a measurement is
already in progress.

RTTM = 2.5
RTTS = 7/8 (1.5) + 1/8 (2.5) = 1.625
RTTD = 3/4 (7.5) + 1/4 |1.625 − 2.5| = 0.78
RTO = 1.625 + 4 (0.78) = 4.74

82
Figure 12.38 Example 10

83
Note:

TCP does not consider the RTT of a


retransmitted segment in its calculation
of a new RTO.

84
Example 11

Figure 12.39 is a continuation of the previous example. There is


retransmission and Karn’s algorithm is applied. The first
segment in the figure is sent, but lost. The RTO timer expires
after 4.74 seconds. The segment is retransmitted and the timer is
set to 9.48, twice the previous value of RTO. This time an ACK is
received before the time-out. We wait until we send a new
segment and receive the ACK for it before recalculating the RTO
(Karn’s algorithm).

85
Figure 12.39 Example 11

86
12.10 OPTIONS
The TCP header can have up to 40 bytes of optional information. Options
convey additional information to the destination or align other options.

87
Figure 12.40 Options

88
Figure 12.41 End-of-option option

89
Note:

EOP can be used only once.

90
Figure 12.42 No-operation option

91
Note:

NOP can be used more than once.

92
Figure 12.43 Maximum-segment-size option

93
Note:

The value of MSS is determined during


connection establishment and does not
change during the connection.

94
Figure 12.44 Window-scale-factor option

95
Note:

The value of the window scale factor


can be determined only during
connection establishment; it does not
change during the connection.

96
Figure 12.45 Timestamp option

97
Note:

One application of the timestamp


option is the calculation of round trip
time (RTT).

98
Example 12

Figure 12.46 shows an example that calculates the round-trip


time for one end. Everything must be flipped if we want to
calculate the RTT for the other end.

The sender simply inserts the value of the clock (for example, the
number of seconds past from midnight) in the timestamp field for
the first and second segment. When an acknowledgment comes
(the third segment), the value of the clock is checked and the
value of the echo reply field is subtracted from the current time.
RTT is 12 s in this scenario.

99
Example 12 (Continued)

The receiver’s function is more involved. It keeps track of the last


acknowledgment sent (12000). When the first segment arrives, it
contains the bytes 12000 to 12099. The first byte is the same as
the value of lastack. It then copies the timestamp value (4720)
into the tsrecent variable. The value of lastack is still 12000 (no
new acknowledgment has been sent). When the second segment
arrives, since none of the byte numbers in this segment include
the value of lastack, the value of the timestamp field is ignored.
When the receiver decides to send an accumulative
acknowledgment with acknowledgment 12200, it changes the
value of lastack to 12200 and inserts the value of tsrecent in the
echo reply field. The value of tsrecent will not change until it
isreplaced by a new segment that carries byte 12200 (next
segment).
100
Example 12 (Continued)

Note that as the example shows, the RTT calculated is the time
difference between sending the first segment and receiving the
third segment. This is actually the meaning of RTT: the time
difference between a packet sent and the acknowledgment
received. The third segment carries the acknowledgment for the
first and second segments.

101
Figure 12.46 Example 12

102
Note:

The timestamp option can also be used


for PAWS.

103
Figure 12.47 SACK

104
Example 13

Let us see how the SACK option is used to list out-of-order blocks. In Figure
12.48 an end has received five segments of data.

The first and second segments are in consecutive order. An accumulative


acknowledgment can be sent to report the reception of these two segments.
Segments 3, 4, and 5, however, are out of order with a gap between the second
and third and a gap between the fourth and the fifth. An ACK and a SACK
together can easily clear the situation for the sender. The value of ACK
is2001, which means that the sender need not worry about bytes 1 to 2000.
The SACK has two blocks. The first block announces that bytes 4001 to 6000
have arrived out of order. The second block shows that bytes 8001 to 9000
have also arrived out of order. This means that bytes 2001 to 4000 and bytes
6001 to 8000 are lost or discarded. The sender can resend only these bytes.

105
Figure 12.48 Example 13

106
Example 14

The example in Figure 12.49 shows how a duplicate segment can


be detected with a combination of ACK and SACK. In this case,
we have some out-of-order segments (in one block) and one
duplicate segment. To show both out-of-order and duplicate
data, SACK uses the first block, in this case, to show the
duplicate data and other blocks to show out-of-order data. Note
that only the first block can be used for duplicate data. The
natural question is how the sender, when it receives these ACK
and SACK values knows that the first block is for duplicate data
(compare this example with the previous example). The answer is
that the bytes in the first block are already acknowledged in the
ACK field; therefore, this block must be a duplicate.

107
Figure 12.49 Example 14

108
Example 15

The example in Figure 12.50 shows what happens if one of the


segments in the out-of-order section is also duplicated. In this
example, one of the segments (4001:5000) is duplicated. The
SACK option announces this duplicate data first and then the
out-of-order block. This time, however, the duplicated block is
not yet acknowledged by ACK, but because it is part of the out-
of-order block (4001:5000 is part of 4001:6000), it is understood
by the sender that it defines the duplicate data.

109
Figure 12.50 Example 15

110
12.11 TCP PACKAGE
We present a simplified, bare-bones TCP package to simulate the heart of
TCP. The package involves tables called transmission control blocks, a set
of timers, and three software modules.

The topics discussed in this section include:

Transmission Control Blocks (TCBs)


Timers
Main Module
Input Processing Module
Output Processing Module

111
Figure 12.51 TCP package

112
Figure 12.52 TCBs

113
Quality of Service

24.114
QUALITY OF SERVICE

Quality of service (QoS) is an internetworking issue that


has been discussed more than defined. We can
informally define quality of service as something a flow
seeks to attain.

Topics discussed in this section:


Flow Characteristics
Flow Classes
Figure Flow characteristics

Traditionally, four types of characteristics are


attributed to a flow: reliability, delay, jitter, and
bandwidth.

24.116
Reliability

• Reliability is a characteristic that a flow needs. Lack of reliability means losing a


packet or acknowledgment, which entails retransmission.
• For example, it is more important that electronic mail, file transfer, and Internet
access have reliable transmissions than telephony or audio conferencing.
Delay
• Source-to-destination delay is another flow characteristic.
• In this case, telephony, audio conferencing, video conferencing, and remote log-in
need minimum delay, while delay in file transfer or e-mail is less important.

24.117
Jitter
Jitter is defined as the variation in the packet delay

• Jitter is the variation in delay for packets belonging to the same flow.

• For example, if four packets depart at times 0, 1, 2, 3 and arrive at 20, 21, 22, 23,
all have the same delay, 20 units of time.

• On the other hand, if the above four packets arrive at 21, 23, 21, and 28, they will
have different delays: 21,22, 19, and 24.
• For applications such as audio and video, the first case is completely acceptable;
the second case is not.

24.118
Bandwidth

• Different applications need different bandwidths.

• In video conferencing we need to send millions of bits per second to


refresh a color screen while the total number of bits in an e-mail may
not reach even a million.

24.119
24-6 TECHNIQUES TO IMPROVE QoS

In Sectionwe tried to define QoS in terms of its


characteristics. In this section, we discuss some
techniques that can be used to improve the quality of
service. We briefly discuss four common methods:
scheduling, traffic shaping, admission control, and
resource reservation.
Topics discussed in this section:
Scheduling-Packets from diff flows at a switch/router
Traffic Shaping- Control amount , rate of traffic sent to n/w.
Resource Reservation- buffer , BW , CPU time(integrated services)
Admission Control- mechanism used by router/switch to accept/ reject a
flow based on predefined parameters called flow specifications.
24.120
Scheduling

• Packets from different flows arrive at a switch or router for processing. A good
scheduling technique treats the different flows in a fair and appropriate manner.

24.121
Figure FIFO queue

In first-in, first-out (FIFO) queuing, packets wait in a


buffer (queue) until the node (router or switch) is
ready to process them.

If the average arrival rate is higher than the average


processing rate, the queue will fill up and new packets
will be discarded.

24.122
Figure Priority queuing

A priority queue can provide better QoS than the FIFO queue
because higher priority traffic, such as multimedia, can reach
the destination with less delay.
Figure Weighted fair queuing
Traffic Shaping

• Traffic shaping is a mechanism to control the amount and the rate of


the traffic sent to the network.

• Two techniques can shape traffic: leaky bucket and token bucket.

24.125
Figure Leaky bucket

24 Mbits of data

6 Mbits of data
Figure 24.20 Leaky bucket implementation

24.127
Leaky bucket implementation

• A FIFO queue holds the packets. If the traffic consists of fixed-size


packets (e.g., cells in ATM networks), the process removes a fixed
number of packets from the queue at each tick of the clock.
• If the traffic consists of variable-length packets, the fixed output rate
must be based on the number of bytes or bits.

24.128
The following is an algorithm for variable-length packets

1. Initialize a counter to n at the tick of the clock.


2. If n is greater than the size of the packet, send the packet and
decrement the counter by the packet size. Repeat this step until n is
smaller than the packet size.
3. Reset the counter and go to step 1.

24.129
Note

A leaky bucket algorithm shapes bursty


traffic into fixed-rate traffic by averaging
the data rate. It may drop the packets if
the bucket is full.

24.130
Disadvantage of leaky bucket algorithm

• In leaky bucket algorithm the time when the host was idle is not
taken into account.

• On the other hand, the token bucket algorithm allows idle hosts to
accumulate credit for the future in the form of tokens.

• For each tick of the clock, the system sends n tokens to the bucket.

24.131
Figure Token bucket

24.132
Continue..
• The system removes one token for every cell (or byte)
of data sent.

• For example, if n is 100 and the host is idle for 100


ticks, the bucket collects 10,000 tokens.

• Now the host can consume all these tokens in one


tick with 10,000 bytes, or the host takes 1000 ticks
with 10 bytes per tick.
• In other words, the host can send bursty data as long
as the bucket is not empty.
Continue..

• The token bucket can easily be implemented with a counter. The


token is initialized to zero.

• Each time a token is added, the counter is incremented by 1. Each


time a unit of data is sent, the counter is decremented by 1. When
the counter is zero, the host cannot send data.

24.134
Note

The token bucket allows bursty traffic at


a regulated maximum rate.

24.135
Figure Token bucket

24.136
INTEGRATED SERVICES

Two models have been designed to provide quality of


service in the Internet: Integrated Services and
Differentiated Services. We discuss the first model here.

Topics discussed in this section:


Integrated Services, sometimes called IntServ, is a flow-
based QoS model, which means that a user needs to create
a flow, a kind of virtual circuit, from the source to the
destination and inform all routers of the resource
requirement.
Note

Integrated Services is a flow-based QoS


model designed for IP.

24.138
Signaling
• IP is connectionless, datagram , packet-switching
protocol.
• How can we implement flow based model over a
connectionless protocol?
• Solution- signaling protocol to run over IP that
provides signaling mechanism for making a
reservation.
• RSVP- Resource Reservation Protocol

24.139
Flow Specification

• When a source makes a reservation it needs to define a flow


specification.
• Flow spec has two parts
• 1. Rspec(resource specification)- Defines the resource that
the flow needs to reserve (buffer, BW etc).
• 2. Tspec(traffic specification) – Defines the traffic
characterization of the flow.

24.140
Admission

• After a router receives the flow specification from an application, it


decides to admit/ deny service.
• Decision is based on previous commitments of router and current
availability of the resource.

24.141
RSVP

• It is a signaling protocol that helps IP create a flow and consequently


make a resource reservation.
• It is an independent protocol
• May be used in other models in future.

24.142
Figure Path messages

24.143
Figure Resv messages

24.144
Figure Reservation merging

24.145
Problems with Integrated Services

• Scalability
The Integrated Services model requires that each router keep
information for each flow.
• Service-Type Limitation
The Integrated Services model provides only two types of services,
guaranteed and control-load.

24.146
DIFFERENTIATED SERVICES

Differentiated Services (DS or Diffserv) was introduced


by the IETF (Internet Engineering Task Force) to
handle the shortcomings of Integrated Services.

Topics discussed in this section:


DS Field

24.147
Two fundamental changes were made:
• The routers do not have to store information about flows.
The applications, or hosts, define the type of service they
need each time they send a packet.

• The per-flow service is changed to per-class service. The


router routes the packet based on the class of service
defined in the packet, not the flow.

• This solves the service-type limitation problem. We can


define different types of classes based on the needs of
applications.

24.148
Note

Differentiated Services is a class-based


QoS model designed for IP.

24.149
Differentiated Service
• In Diffserv, each packet contains a field called the DS
field. The value of this field is set at the boundary of
the network by the host or the first router designated
as the boundary router.

• The DS field contains two subfields: DSCP and CU.


• The DSCP (Differentiated Services Code Point) is a 6-
bit subfield that defines the per-hop behavior (PHB).
The 2-bit CU (currently unused) subfield is not
currently used.

24.150
Continue..

• The Diffserv capable node (router) uses the DSCP 6 bits as an index to
a table defining the packet-handling mechanism for the current
packet being processed.

• The Diffserv model defines per-hop behaviors (PHBs) for each node
that receives a packet.

24.151
Figure DS field

24.152
Traffic Conditioner

• To implement Diffserv, the OS node uses traffic conditioners such as


meters, markers, shapers, and droppers.

• Meters:- The meter checks to see if the incoming flow matches the
negotiated traffic profile. The meter also sends this result to other
components. The meter can use several tools such as a token bucket
to check the profile.

24.153
• Marker A marker can remark a packet that is using best-effort delivery (OSCP:
000000) or down-mark a packet based on information received from the meter.
Downmarking (lowering the class of the flow) occurs if the flow does not match
the profile. A marker does not up-mark (promote the class) a packet.

• Shaper A shaper uses the information received from the meter to reshape the
traffic if it is not compliant with the negotiated profile.

24.154
Figure 24.27 Traffic conditioner

24.155

You might also like