csci 4550/8556 computer networks comer, chapter 16: protocols and layering

32
CSCI 4550/8556 Computer Networks Comer, Chapter 16: Protocols and Layering

Post on 21-Dec-2015

220 views

Category:

Documents


1 download

TRANSCRIPT

CSCI 4550/8556Computer Networks

Comer, Chapter 16:Protocols and Layering

Introduction

LAN/WAN hardware can't solve all computer communication problems

Software for LAN and WAN systems is large and complicated

Layering is a structuring technique to organize networking software design and implementation

Why Network Software? Sending data through raw hardware is awkward

and inconvenient - doesn't match programming paradigms well

Equivalent to accessing files by making calls to disk controller to position read/write head and accessing individual sectors

May not be able to send data to every destination of interest without other assistance

Network software provides high-level interface to applications

Why Protocols?The name is derived from the Greek protokollen, the index to a scroll

Diplomats use rules, called protocols, as guides to formal interactions

A network protocol or computer communication protocol is a set of rules that specify the format and meaning of messages exchanged between computers across a network.

The format is sometimes called syntax

The meaning is sometimes called semantics

Protocols are implemented by protocol software

One Protocol, or Many Protocols?

Computer communication across a network is a very hard problem.

Complexity requires multiple protocols, each of which manages a part of the problem.

The protocols may be simple or complex, but they must all work together.

Protocol “Suites”A set of related protocols that are designed for compatibility is called a protocol suite .

Protocol suite designers: analyze communication problem

divide the problems into subproblems

design a protocol for each subproblem

A well-designed protocol suite is efficient and effective - solves the problem without redundancy and makes best use of network capacity

allows replacement of individual protocols without changes to other protocols

Layered Protocol Design

A layering model is a solution to the problem of complexity in network protocols.

The model suggests dividing the network protocol into layers, each of which solves part of the network communication problem.

These layers have several constraints, which ease the design problem.

A network protocol suite is designed to have a protocol or protocols for each layer.

The ISO 7-Layer Reference ModelThe International Organization for Standards (ISO) defined a 7-layer reference model as a guide to the design of a network protocol suite.

The layers are named and numbered; reference to “layer n” often means the nth layer of the ISO 7-layer reference model.

The Layers in the ISO ModelCaveat - many modern protocols do not exactly fit the ISO model, and the ISO protocol suite is mostly of historic interest.

The concepts are still very useful and terminology persists.

The layers:Layer 7: Application - Application-specific protocols such as FTP and SMTP (electronic mail) Layer 6: Presentation - Common formats for representation of data Layer 5: Session - Management of sessions such as login to a remote computer Layer 4: Transport - Reliable delivery of data between computers Layer 3: Network - Address assignment and data delivery across a physical network Layer 2: Data Link - Format of data in frames and delivery of frames through network interface Layer 1: Physical - Basic network hardware - such as RS-232 or Ethernet

Layered Software Implementation

Software implemented from layered design has layered organization.

Software modules can be viewed as shown on the right.

Layered Software and Stacks

Related modules from previous figure are called a protocol stack or simply a stack.

There are two constraints: The software for each layer depends only on the services of the software provided by lower layers.

The software at layer n at the destination receives exactly the same protocol message sent by layer n at the sender.

These constraints mean that protocols can be tested independently and can be replaced within a protocol stack.

The Layering Principle

Messages and Protocol Stacks

On the sender, each layer: accepts an outgoing message from the layer above, adds a header and perhaps performs other processing,then passes resulting message to next lower layer.

On the receiver, each layer: receives an incoming message from the layer below, removes the header for that layer and performs other processing, then passes the resulting message to the next higher layer.

Examples of Commercial Stacks

Protocol HeadersThe software at each layer communicates with the corresponding remote layer through information stored in headers. Each layer adds its header to the front of the message from the next higher layer. Headers are nested at the front of the message as the message traverses the network.

Control Packets

Protocol layers often need to communicate directly without exchanging data. For example, they might

acknowledge incoming data, or request the next data packet.

To accomplish this, the layers use control packets. Those control packets generated by layer n on sender are interpreted by layer n on the receiver.The control packets are ransmitted like any other packet by layers n-1 and below.

Techniques for Reliable Network Communication

The model - reliable delivery of a block of data from one computer to another means

no data values have been changed,the data is in the same order as when transmitted,no data is missing, and no data is duplicated.

Example - parity bit, checksum and CRC can be used to ensure the data is unchanged.

Out of Order Delivery

Packets may be delivered out of order - especially in systems that include multiple networks. Out of order delivery can be detected and corrected through sequencing .

The sender attaches a sequence number to each outgoing packet. The receiver uses sequence numbers to put packets back in order and to detect missing packets.

Duplicate Packet Delivery

Packets may be duplicated during transmission. Sequencing can be used to

detect duplicate packets (which will have duplicate sequence numbers), anddiscard those duplicate packets.

Lost Packets

Perhaps the most widespread problem is that of lost packets.Any error – a single bit error or incorrect length - causes the receiver to discard the packet. This is a difficult problem to solve: how does the receiver decide when a packet has been lost?

RetransmissionMost protocols use positive acknowledgment with retransmission (PAR) to deal with the problem of lost packets The receiver sends a short message acknowledging receipt of good packets.The sender infers packets have been lost from missing acknowledgments for those packets.The sender retransmits those lost packets.The sender sets a timer for each outgoing packet, and saves a copy of the packet until an acknowledgement for it is received.If the timer expires before the acknowledgment is received, the sender can retransmit the saved copy. Protocols define an upper bound on retransmission to detect unrecoverable network failure.

Avoiding the Replay of Old PacketsSufficiently delayed packets may be inserted into later sessions; this is called a replay error.Example:

Suppose two computers exchange data with packets numbered 1 to 5. Packet 4 encounters an extraordinary delay; the computers use retransmission to deliver a valid copy of packet 4. Later on, two computers exchange different data with packets numbered 1 to 10. Now the initial “packet 4” arrives (during the second session), so that the data from that old packet (rather than the current “packet 4”) is inserted into the data stream!

Protocols may attach a session number to each packet in a protocol session to differentiate packets from different sessions.

Flow Control

Data overrun can occur when a sender transmits data faster than the receiver can process the incoming data. Protocols use flow control mechanisms through which the receiver can control the rate of data transmission. Two common mechanisms are

stop-and-go sliding windows

Stop and Go Flow Control

The receiver sends a small control packet when it is ready for the next packet. The sender waits for the control packet before sending the next packet. This technique can be very inefficient of network bandwidth if the delivery time is large (as it is with satellite networks).

Sliding Windows

This common technique allows the sender to transmit multiple packets before receiving an acknowledgment. The number of packets that can be sent and their sequence number range is defined by the protocol and is called the window .As acknowledgments arrive from the receiver, the window is moved along the data packets.This is the origin of the term “sliding window.”

Example of a Sliding Window

Transmission begins with (a). In (b), two packets have been acknowledged.In (c), eight packets have been acknowledged, and the four packets in the window are being transmitted.

Stop-and-Go vs. Sliding Window

In (a), we see the sequence of transmissions for a protocol using stop-and-go. If one packet takes N time units to traverse the network, the time required is 8N.In (b), we see the sequence of transmissions for the same packets using a sliding window.

Transmission TimesFor stop-and-go, each packet takes 2L time to deliver (where L is the latency, or network delivery time). Sliding window can improve by the number of packets in the window (W is window size, Tw is sliding window throughput, Tg is stop-and-go throughput):

Transmission time is also limited by the network transmission rate (B is maximum network bandwidth):

WTT gw

WTBT gw ,min

Network CongestionNetwork congestion arises in network systems that include multiple links (see the figure below for an example). If the input to some link exceeds the maximum bandwidth, packets will queue up at the connection to that link.Eventually, packets will be discarded and packets will be retransmitted. Ultimately, the network will experience congestion collapse.This problem is related to, but not identical to, that of data overrun.

Avoiding and Recovering From Congestion

Protocols attempt to avoid congestion and recover from network collapse by monitoring the state of the network and taking appropriate action. They may use two techniques:

notification of congestion from packet switches, andinferring congestion from packet loss.

Packet loss can be used to detect congestion because modern networks are reliable and rarely lose packets through hardware failure. A sender can infer congestion from packet loss through missing acknowledgments. The rate or percentage of lost packets can be used to estimate the degree of congestion.

The Art of Protocol DesignProtocol design mixes engineering and art. There are well-known techniques for solving specific problems. But, those techniques can interact in subtle ways.Protocol details must be chosen carefully.The resulting protocol suite must account for interaction (e.g. between flow control and congestion). Efficiency, effectiveness, and economy must all be balanced in a successful protocol design.

Summary

Layering is a technique for guiding protocol design and implementation. Protocols are grouped together into related protocol suites. A collection of layered protocols is called a protocol stack. Protocols use a variety of techniques for reliable delivery of data.