Computer Networks- Introduction and Data Link Layer

123
COMPUTER NETWORKS Deepak John Department Of MCA,SJCET-Pala

description

Lecture notes,Computer Networks,Introduction,Basics,Data Link layer(DLL), Deepak John,Department Of MCA,SJCET-Pala

Transcript of Computer Networks- Introduction and Data Link Layer

Page 1: Computer Networks- Introduction and Data Link Layer

COMPUTER NETWORKS

Deepak JohnDepartment Of MCA,SJCET-Pala

Page 2: Computer Networks- Introduction and Data Link Layer

Computer Network A computer network is a group of interconnected computers. It allows

computers to communicate with each other and to share resources andinformationinformation.

Applications1 Resource Sharing(Hardware & Software)1. Resource Sharing(Hardware & Software)2. Information Sharing

Easy accessibility from anywhere (files, databases) Search Capability (WWW)

3. Communication Email Email Message broadcast

4. Remote computingp g5. Distributed processing (GRID Computing)

Page 3: Computer Networks- Introduction and Data Link Layer

Classification of networksC ass cat o o etwo s

1. By Size or Scale2. By Structure / Functional Relationship3. By Topology / Physical Connectivity

Page 4: Computer Networks- Introduction and Data Link Layer

1. By Size or Scale Personal Area Networks(PAN) Local Area Networks(LAN)

Wid A N k (WAN) Wide Area Networks(WAN) Metropolitan Area Networks(MAN) Internetworks Internetworks

Page 5: Computer Networks- Introduction and Data Link Layer

Personal Area Network (PAN) Personal Area Network (PAN) Very small scale network Range is less than 2 metersg Cell phones, PDAs, MP3 players Local Area Network (LAN) Contains printers, servers and computers Systems are close to each other

C i d i ffi b ildi Contained in one office or building Organizations often have several LANS Wide Area Networks (WAN) Wide Area Networks (WAN) Two or more LANs connected over a large geographic area Typically use public or leased lines(Phone lines,)Satellite Typically use public or leased lines(Phone lines,)Satellite The Internet is a WAN

Page 6: Computer Networks- Introduction and Data Link Layer

Metropolitan Area Network (MAN) Large network that connects different organizations Large network that connects different organizations Shares regional resources Ex:Cable television network Internet A collection of interconnected networks. global computer network

Page 7: Computer Networks- Introduction and Data Link Layer

2. By Structure / Functional Relationship

Client / Server Peer to Peer (P2PN) Peer to Peer (P2PN)

Client/Server network Nodes and servers share data Nodes are called clients Servers are used to control access Server is the most important

computer

Page 8: Computer Networks- Introduction and Data Link Layer

Peer to peer networks (P2PN) All nodes are equal Nodes access resources on other nodes

E h d t l it Each node controls its own resources Most modern OS allow P2PN Distributed computing is a form Distributed computing is a form

Page 9: Computer Networks- Introduction and Data Link Layer

3. By Topology / Physical Connectivity

N k T l f h L i l l f i d i• Network Topology refers to the Logical layout of wires and equipment• Choice affects

Network performance

• Different network topologies are

pNetwork sizeNetwork collision detection

• Different network topologies are BUS STAR RING MESH TREE

Page 10: Computer Networks- Introduction and Data Link Layer

BUS Also called linear bus One wire connects all nodes Advantages Easy to setup Small amount of wire

i d Disadvantages Slow Easy to crash Easy to crash

Page 11: Computer Networks- Introduction and Data Link Layer

STAR Most common topology All nodes connect to a hub Packets sent to hub Packets sent to hub Hub sends packet to destination

Advantages Easy to setup One cable can not crash network

Disadvantages Disadvantages One hub crashing downs entire network Uses lots of cable

Page 12: Computer Networks- Introduction and Data Link Layer

RING Nodes connected in a circle

T k d i d Tokens used to transmit data Nodes must wait for token to send

Advantages Advantages No data collisions

Disadvantagesg Slow Lots of cable

• Single ring – All the devices on thenetwork share a single cable .

• Dual ring The dual ring topology allows• Dual ring – The dual ring topology allowsdata to be sent in both directions.

Page 13: Computer Networks- Introduction and Data Link Layer

MESH• All computers connected togetherp g• Internet is a mesh network• Advantage

- Data will always be delivered• Disadvantages

- Lots of cable- Hard to setup

Page 14: Computer Networks- Introduction and Data Link Layer

TREE Hierarchal Model Hierarchal Model extended star topology Advantages Advantages Scalable Easy Implementation Easy Troubleshooting

Page 15: Computer Networks- Introduction and Data Link Layer

Simplified Network ModelSimplified Network Model

Page 16: Computer Networks- Introduction and Data Link Layer

Protocols and protocol architecture.Protocols and protocol architecture. Protocol• A standard that allows entities (i.e. application programs) from( pp p g )

different systems to communicate. It contains conventions andassociated rulesI l d t ti d ti i• Includes syntax, semantics, and timingSyntax(Data formats, Signal levels etc)Semantics(Control information Error handling etc)Semantics(Control information, Error handling etc)Timing(Speed matching (e.g., indicates flow control),Sequencing

(e.g., avoid packet duplication))( g , p p ))

Page 17: Computer Networks- Introduction and Data Link Layer

Principles of Protocol Architecture

Layered structure Protocol stack

Each layer provides services to upper layer; expect services from Each layer provides services to upper layer; expect services fromlower one Layer interfaces should be well-defined

Peer entities communicate using their own protocol peer-to-peer protocols independent of protocols at other layers independent of protocols at other layers if one protocol changes, other protocols should not get affected

Page 18: Computer Networks- Introduction and Data Link Layer

Simplified File Transfer Architecture• file transfer could use three modules

1 Fil f li i1. File transfer application2. Communication service module3. Network access module

Page 19: Computer Networks- Introduction and Data Link Layer

File Transfer Application Layer

•Application specific commands passwords and the actual file(s) –•Application specific commands, passwords and the actual file(s) –

high level data

C i i S i M d lCommunications Service Module

• reliable transfer of data – error detection, ordered delivery of data

packets, etc.

Network Module

• actual transfer of data and dealing with the network – if the network

changes, only this module is affected, not the whole systemc a ges, o y s odu e s a ec ed, o e w o e sys e

Page 20: Computer Networks- Introduction and Data Link Layer

A General Three Layer ModelNetwork Access LayeryTransport LayerApplication Layer

Page 21: Computer Networks- Introduction and Data Link Layer

Network Access Layer• Exchange of data between the computer and the network• Sending computer provides address of destination• need specific drivers and interface equipment depending on type

f k d( k CKT i h d N k )of network used(packet or CKT switched Network etc.) Transport Layer

• Ensures reliable data exchange between 2 hostsEnsures reliable data exchange between 2 hosts• to make sure that all the data packets arrived in the same order in

which they are sent out• Packets nor received or received in error are retransmitted

Application Layer• Support for different user applications• Support for different user applications• e.g. e-mail, file transfer

Page 22: Computer Networks- Introduction and Data Link Layer

Addressing in layered architecture Port

IP Address

Page 23: Computer Networks- Introduction and Data Link Layer

Protocol Data Units User data is passed from layer to layer User data is passed from layer to layer Control information is added/removed to/from user data at each

layery Header (and sometimes trailer) each layer has a different header/trailer

Data + header + trailer = PDU (Protocol Data Unit) This is basically what we call packet h l h diff t PDU each layer has a different PDU

Page 24: Computer Networks- Introduction and Data Link Layer

Transport PDU Transport layer may fragment user data Each fragment has a transport header ,that contains Destination port Sequence number since the transport layer may split application data into smaller

packetspackets Error detection code

Network PDUAdds network header

•network address for destination computer•optional facilities from network (e g priority level)optional facilities from network (e.g. priority level)

Page 25: Computer Networks- Introduction and Data Link Layer
Page 26: Computer Networks- Introduction and Data Link Layer

Standard Protocol Architectures

Two approaches (standard)Two approaches (standard)•OSI Reference model(never used widely, but well known)•TCP/IP protocol suite(Most widely used)

Another approach (proprietary)IBM’s Systems Network Architecture (SNA)

Page 27: Computer Networks- Introduction and Data Link Layer

OSI (Open Systems Interconnection)Reference ModelReference Model Reference model provides a general framework for standardization

d fi f l i h ifi i defines a set of layers with specific services one or more protocols can be developed for each layer

Developed by the International Organization for Standardization (ISO) Developed by the International Organization for Standardization (ISO) 7 Layers1. Physical2. Data link 3. Network4 Transport4. Transport5. Session 6. Presentation7. Application

Page 28: Computer Networks- Introduction and Data Link Layer
Page 29: Computer Networks- Introduction and Data Link Layer

Advantage Each layer performs a set of communication functionsy p Each layer relies on the next lower layer to perform more primitive

functions Each layer provides services to the next higher layer Each layer provides services to the next higher layer Changes in one layer should not require changes in other layers Layers are entirely independent and transparent to other layers

Page 30: Computer Networks- Introduction and Data Link Layer

OSI as Framework for Standardization

Page 31: Computer Networks- Introduction and Data Link Layer

Physical Layer Purpose Deals with the representation ,transmission and synchronization

of bitsT l ti f bit i t i l Translation of bits into signals

Define data rate and transmission mode Define the interface to the card Define the interface to the card Electrical Mechanical Functional Example: Pin count on the connector

Page 32: Computer Networks- Introduction and Data Link Layer

Data Link Layer Purpose Manages the flow of data over the physical media Framing

Responsible for error-free transmission over the physical media Subdivided into two1 MAC (M di A C t l)1. MAC (Media Access Control) Gives data to the NIC Controls access to the media through :CSMA/CD and Token passing Controls access to the media through :CSMA/CD and Token passing

2. LLC (Logical Link Layer) Manages the data link interface or Service Access Points (SAPs)) Can detect some transmission errors using a CRC

Page 33: Computer Networks- Introduction and Data Link Layer

Network layer Purposep Logical Addressing and routing the packets Routing of data, Based on priority or Best path at the time of

transmissiontransmission. Congestion control Address translation from logical to physicalg p y

Ex: Google ----------> 102.13.345.25 Example application at the router

If the packet size is large, splits into small packets then routethe packet

Page 34: Computer Networks- Introduction and Data Link Layer

Transport Layer Purpose End to end exchange of data In sequence, no losses, no duplicates

If d d l d li i ll i If needed, upper layer data are split into smaller units

Page 35: Computer Networks- Introduction and Data Link Layer

Session Layer Purposep Oversee a communication session Establish Maintain Terminate

S h i ti b t d d i Synchronization between sender and receiver Assignment of time for transmission Start time Start time End time etc.

Page 36: Computer Networks- Introduction and Data Link Layer

Presentation Layer Purposep Formats data for exchange between points of communication

Protocol conversion Data translation Encryption

Application LayerPurposeSupport for various applicationsSupport for various applicationsProvides an interface for the end userProvides variety of protocolsE il i R t l i fil d t fEx: mail services ,Remote login, file access and transfer

Page 37: Computer Networks- Introduction and Data Link Layer
Page 38: Computer Networks- Introduction and Data Link Layer

TCP/IP ProtocolTCP/IP Protocol Most widely used interoperable network protocol architecture Funded by the US Defense Advanced Research Project Agencyy j g y

(DARPA) for its packet switched network (ARPANET) Used by the Internet and WWW Layers of TCP/IP.

1. Application Layer2 Host to host2. Host to host3. Internet Layer4. Network Access Layere wo ccess ye

Page 39: Computer Networks- Introduction and Data Link Layer

Network Access Layer• Exchange of data between end system and the networkg y• Formatting the data into a unit called frame and convert that frame into

electric or analog pulses.• Responsible to deliver frames reliably from hop to hop (hop could bedevice such as bridges or switches)

• Guarantee Error Free Delivery of Data from one hop to the other• Guarantee Error Free Delivery of Data from one hop to the other• Acknowledging receipt of data frames and resending frames if ack is

not received• Core protocols: Ethernet, Token-Ring

Page 40: Computer Networks- Introduction and Data Link Layer

Internet Layer• PackagingPackaging• Addressing• Routingg• deals with end-to-end transmission• Implemented in end systems and routers as the Internet Protocol (IP)

G E F D li f P k f N/W h h• Guarantee Error Free Delivery of Packets from one N/W to the otherN/W

• Core protocols: IP(Internet Protocol),ICMP(Internet Control Messagep ( ) ( gProtocol),ARP(Address Resolution Protocol)

Page 41: Computer Networks- Introduction and Data Link Layer

IP (Internet Protocol) The core of the TCP/IP protocol suitep Two versions co-exist v4 – the widely used IP protocol(32 bit) 6 h b t d di d i 1996 b t till t id l v6 – has been standardized in 1996, but still not widely

deployed(128bit), for modern high speed networks

Page 42: Computer Networks- Introduction and Data Link Layer

Transport Layer• Guarantee Error Free Delivery of Message from source-host toGuarantee Error Free Delivery of Message from source host to

the destination-host (End-to-End reliability)• Offers connection oriented and connection less services• Reliability includes: Error detection and correction, flow control,

packet duplication etc…• Runs only on host not on the network• Runs only on host not on the network

Core Protocols1. TCP(Transmission Control Protocol)C ( s ss o Co o o oco )2. UDP(User Datagram Protocol)

Page 43: Computer Networks- Introduction and Data Link Layer

TCP One-to-one and connection-oriented reliable protocol

U d i h i i f l f d Used in the accurate transmission of large amount of data Slower compared to UDP because of additional error checking being

performedp

UDP• One-to-one or one-to- many, connectionless and unreliable protocoly, p• Used for the transmission of small amount of data• Used in video and audio casting(Multicasting and Broadcasting )• Also used for multimedia transmission• Faster as compared to TCP

Page 44: Computer Networks- Introduction and Data Link Layer

Application Layer•Provide interface between end-user & applications•Support several users applications

For example: FTP, HTTP, SMTPLayer Protocols

Application

Transport

HTTP TELNET FTP SMTP SNMP

TCP UDPTransport

Internet

TCP UDP

IP ICMP

Network Access(Host-to-network) ETHERNET PACKET RADIO

TCP/IP Layers with Protocols

Page 45: Computer Networks- Introduction and Data Link Layer

Operation of TCP and IP

Page 46: Computer Networks- Introduction and Data Link Layer

PDU in TCP/IP

Dest PortDest. PortSequence numberChecksum….

Dest. AddressSource address

….

Dest. Network AddressAddress

Priority info

Page 47: Computer Networks- Introduction and Data Link Layer

Comparison OSI and TCP/IPp

Page 48: Computer Networks- Introduction and Data Link Layer

OSI1)It has 7 layers

TCP/IP1)Has 4 layers) y

2)Separate presentation layer) y

2)No presentation layer,characteristics are provided by

li ti l

3) Separate session layer

application layer3)No session layer, characteristics

are provided by transport layer

4)Network layer provides bothconnectionless and connection

p y p y

4)Network layer provides onlyconnectionless and connectionoriented services connection less services

Page 49: Computer Networks- Introduction and Data Link Layer

5)It defines the services, interfacesand protocols very clearly and

5)It does not clearly distinguishesbetween service, interface and

makes a clear distinctionbetween them

6)The protocol are better hidden

protocols.

6)It i t t l th6)The protocol are better hiddenand can be easily replaced as thetechnology changes

6)It is not easy to replace theprotocols

7)OSI truly is a general model 7)TCP/IP can not be used for anyother application

Page 50: Computer Networks- Introduction and Data Link Layer

CritiquesOSI Bad timing, by the time the OSI protocols appeared, the competition

TCP/IP l l d i id d

q

TCP/IP protocols were already in widespread use. Bad technology, both the model and the protocols are imperfect and

very complex.very complex. Bad implementation, (poor quality) Bad politics, it was thought to be the creature of the government.

Page 51: Computer Networks- Introduction and Data Link Layer

TCP/IP The model does not clearly distinguish the concepts of services The model does not clearly distinguish the concepts of services,

interface, and protocol. It is not at all general and is poorly suited to describing any protocolg p y g y p

stack other than TCP/IP. The host-to-network layer is not really a layer. The model does not distinguished the physical and data link layers

Page 52: Computer Networks- Introduction and Data Link Layer

Novel Netware.Novel Netware. Novell introduced its multiprocessing network operating system

named NetWare N t i Netware versions1. Version 3 – popular but older User logs onto a particular server and maintains directory systemg p y y

2. Version 4 allows single network login and Directory system replaced by

powerful NDS databasepowerful NDS database3. Version 5 Allows to use IP protocol instead of Novell’s proprietary IPX/SPX

protocols4. Version 6 Remote manager Native File Access iFolder and iPrint Remote manager, Native File Access , iFolder and iPrint

5. Version 6.5

Page 53: Computer Networks- Introduction and Data Link Layer

NetWare loadable modules (NLM ) When considering NetWare, note the number of NetWare loadable

modules (NLMs) used by each service•NLMs are routines that enable the server to run a range of programsand offer a variety of servicesand offer a variety of services•Each NLM consumes some of the server’s memory and processorresources (at least temporarily)

Page 54: Computer Networks- Introduction and Data Link Layer

NetWare Directory Services (NDS)Provides a system for managing multiple servers and their resourcesy g g p

•NDS treeThe logical representation of resources in a NetWare enterprise

Page 55: Computer Networks- Introduction and Data Link Layer

Protocols IPX: Internetwork Packet Exchangeg RIPX: Routing Information Protocol BCAST: Broadcast DIAG:Diagnostic Responder SER: Serialization SPX: Sequenced Packet Exchange SAP: Service Advertising Protocol NCP: Netware Core Protocol NCP: Netware Core Protocol NDS: Netware Directory Services NLSP: Netware Link Services ProtocolNLSP: Netware Link Services Protocol

Page 56: Computer Networks- Introduction and Data Link Layer

The Novell protocol suite is illustrated here in relation to the OSI model:

Page 57: Computer Networks- Introduction and Data Link Layer

IPXInternet Protocol Exchange (IPX) is a connectionless datagramg ( ) gprotocol that delivers packets across the Internet and provides NetWareworkstations and file servers with addressing and internetworkingrouting servicesrouting services. RIPXThe Routing Information Protocol (RIP), is used to collect, maintaing ( ), ,and exchange correct routing information among gateways within theInternet.

BCAST BCASTThe Broadcast (BCAST) protocol deals with announcements from thenetwork informing the user that he has received a message.network informing the user that he has received a message.

Page 58: Computer Networks- Introduction and Data Link Layer

DIAGThe Diagnostic Responder (DIAG) protocol is useful in analyzingg p ( ) p y gNetWare LANs. DIAG can be used for connectivity testing,configuration and information gathering. SER SERthe operating system broadcasts copy-protection packets, calledSerialization packets, to determine whether there are multiple copiesp , p pof the same operating system on the network. WDOGThe Watchdog (WDOG) protocol provides constant validation ofactive workstation connections and notifies the NetWare operatingsystem when a connection may be terminated as a result of lengthysystem when a connection may be terminated as a result of lengthyperiods without communication.

Page 59: Computer Networks- Introduction and Data Link Layer

SPXThe Sequential Packet Exchange (SPX), is a transport layer protocolproviding a packet delivery service for third party applications. SAPSAP i id i f ti ll th k th h tSAP services provide information on all the known servers throughoutthe entire internetwork. BMP (Burst)( )The Burst Mode Protocol (BMP) was designed to allow multipleresponses to a single request for file reads and writes.

Page 60: Computer Networks- Introduction and Data Link Layer

NCPThe Netware Core Protocol (NCP) manages access to the primary( ) g p yNetWare server resources. NDSNetWare Directory Services (NDS) providing access to all networkservices. NLSP NLSPNetWare Link Services Protocol (NLSP) provides link state routing forInternetwork Packet Exchange networks.

Page 61: Computer Networks- Introduction and Data Link Layer

Data Link LayerData Link Layer Two Types of networks in DLL Broadcast Networks: All stations share a single communication Broadcast Networks: All stations share a single communication

channel Point-to-Point Networks: Pairs of hosts (or routers) are directly

connected

The main design issues of the data link layer are: The main design issues of the data link layer are:1. Services provided to the Network Layer2. Framing2. Framing3. Flow Control4. Error Control

Page 62: Computer Networks- Introduction and Data Link Layer

1. Provides a well-defined service interface to the network layer. Principal Service Function of the data link layer is to transfer the data

from the network layer on the source machine to the network layer onthe destination machine.

(a) Virtual communication. (b) Actual communication.

Page 63: Computer Networks- Introduction and Data Link Layer

Possible Services Offered to network layera. Unacknowledged connectionless service.gb. Acknowledged connectionless service.c. Acknowledged connection-oriented service.a. Unacknowledged Connectionless Service

• It consists of having the source machine send independent frames to thedestination machine without having the destination machineacknowledge them.

•Example: Ethernet Voice over IP etcExample: Ethernet, Voice over IP, etc.

Page 64: Computer Networks- Introduction and Data Link Layer

b. Acknowledged connectionless service• Each frame send by the Data Link layer is acknowledged and they y g

sender knows if a specific frame has been received or lost.• Typically the protocol uses a specific time period that if has passed

ith t tti k l d t it ill d th fwithout getting acknowledgment it will re-send the frame.c. Acknowledged Connection Oriented Service• Source and Destination establish a connection first• Source and Destination establish a connection first.• Each frame sent is numbered It guarantees that each frame is received only once and that allg y

frames are received in the correct order.• Examples: Satellite channel communication,

Page 65: Computer Networks- Introduction and Data Link Layer

2. Framing Determines how the bits of the physical layer are grouped into frames(f i )(framing). frame header, payload and frame trailer.

Three popular solutions:1. Character count

Fl b i h b ffi2. Flag bytes with byte stuffing3. Starting and ending flags, with bit stuffing

Page 66: Computer Networks- Introduction and Data Link Layer

It uses a field in the header to specify the number of bytes in the frame. Once the header information is being received it will be used to

1. Character Count

Once the header information is being received it will be used todetermine end of the frame.

See figure, Destination may be able to detect that the frame is in errorbut it does not have a means how to correct it.

Page 67: Computer Networks- Introduction and Data Link Layer

2. Byte stuffing The sender inserts a special byte (ESC-Escape Character) just before

each flag byte in the data.each flag byte in the data. beginning and ending byte in the frame are called flag byte. The receiver’s link layer removes this special byte before the data

are given to the network layerare given to the network layer.

(a) frame delimited by flag bytes (b)Four examples of byte sequences before and after byte stuffing.

Page 68: Computer Networks- Introduction and Data Link Layer

3. Bit stuffing each frame starts with a flag byte “01111110”. Whenever the sender encounters five consecutive 1s in the data, it

automatically stuffs a 0 bit into the outgoing bit stream. When the receiver sees five consecutive incoming 1 bits followed by a When the receiver sees five consecutive incoming 1 bits, followed by a

0 bit, it automatically deletes the 0 bit. USB uses bit stuffing.g

Page 69: Computer Networks- Introduction and Data Link Layer

Bit t ffiBit stuffing:(a) The original data.(b) The data as they appear on the line.(c) The data as they are stored in the receiver’s memory after destuffing.

Page 70: Computer Networks- Introduction and Data Link Layer

3. Flow Control Flow control will control the rate of frame transmission and ensure the

sending entity does not overwhelm the receiving entity It uses some feedback mechanism(acknowledgement) If th f i t d / d b th i th l ill th If the frame is accepted /processed by the receiver then only will the

sender send the next frame. Flow control ensures that the speed of sending the frame, by thep g , y

sender, and the speed of processing the received frame by the receiverare compatible.T h d h b d l d l fl f d Two methods have been developed to control flow of data acrosscommunications links:

1. Stop and Wait1. Stop and Wait2. Sliding Window

Page 71: Computer Networks- Introduction and Data Link Layer

Model of Frame Transmission

Page 72: Computer Networks- Introduction and Data Link Layer

1 Stop-and-Wait Flow Control1. Stop and Wait Flow Control

a single frame is send at a time. Source transmits a frame Source transmits a frame. Destination receives the frame, and replies with a small frame called

acknowledgement (ACK). Source waits for the ACK before sending the next frame. It will then send the next frame only after the ACK has been received. Sender keeps a copy of the frame until it receives an

acknowledgement. Destination can stop the flow by not sending ACK (e g if the Destination can stop the flow by not sending ACK (e.g., if the

destination is busy …).

Page 73: Computer Networks- Introduction and Data Link Layer

For identification, both dataframes and acknowledgementsg(ACK) frames are numberedalternatively 0 and 1.

Sender has a control variable (S)that holds the number of the

tl t f (0 1)recently sent frame. (0 or 1)

Receiver has a control variable Rthat holds the number of the nextframe expected (0 or 1).

Stop and wait strategy

Page 74: Computer Networks- Introduction and Data Link Layer

The advantage of stop and- wait is simplicity:Each frame is checked and acknowledged before theEach frame is checked and acknowledged before thenext frame is sent.

The disadvantage is inefficiency:• In stop-and-wait, at any point in time, there is only

one frame that is sent and waiting to beacknowledgedacknowledged.

• stop-and-wait is slow. Each frame must travel all theway to the receiver and an acknowledgment musttravel all the way back before the next frame can besent.

Page 75: Computer Networks- Introduction and Data Link Layer

2 Sliding window2.Sliding window Idea: allow multiple frames to transmit Receiver has a buffer of W frames Transmitter can send up to W frames without receiving ACK

So the link is utilized in a more efficient manner Each data frame carries a sequence number for its identification ACK includes the sequence number of the next expected frame by the

receiverreceiver. All the previous data frames are assumed acknowledged on receipt

of an acknowledgement The sender sends the next n frames starting with the last received

sequence number that has been transmitted by the receiver (ACK).

Page 76: Computer Networks- Introduction and Data Link Layer

In this mechanism we maintain two types of windows:sending window and receiving window

sending window Sending window maintains sequence numbers of frames sent out but

t k l d d d f hi h t t b t itt dnot acknowledged and frames which are next to be transmitted. At the beginning of a transmission, the sender’s window contains n

frames. As frames are sent out, the left boundary of the window moves inward,

shrinking the size of the window. Once an ACK arrives, the window expands to allow in a number of

new frames equal to the number of frames acknowledged by thatACK.ACK.

Page 77: Computer Networks- Introduction and Data Link Layer
Page 78: Computer Networks- Introduction and Data Link Layer

receiving windowThe receiver window maintains the set of frames permitted to accept.At the beginning of transmission, the receiver window contains n

spaces for frames.As new frames come in, the size of the receiver window shrinkAs new frames come in, the size of the receiver window shrinkAs each ACK is sent out, the receiving window expands to include as

many new placeholders as newly acknowledged frames

Page 79: Computer Networks- Introduction and Data Link Layer
Page 80: Computer Networks- Introduction and Data Link Layer

4. Error control An error occurs when a bit is altered between transmission and

receptioni. Single bit errors O bit i lt d One bit is altered Adjacent bits are not affected

ii Burst errorsii. Burst errors A cluster of bits altered a number of bits in error More common and more difficult to deal

Page 81: Computer Networks- Introduction and Data Link Layer

Error control in the data link layer is based on Automatic RepeatRequest(ARQ), which is the retransmission of data.

Page 82: Computer Networks- Introduction and Data Link Layer

i. Stop-and-Wait ARQ keeping a copy of the sent frame and retransmitting of the frame

when the timer expires.when the timer expires. use sequence numbers to number the frames The source station is equipped with a timer. S t it i l f d it f ACK If th f i Source transmits a single frame, and waits for an ACK,If the frame is

lost…the source retransmits the frame. If receiver receives a damaged frame, discard it and the source

retransmits the frame. If everything goes right, but the ACK is damaged or lost, the source

will not recognize it, the source will retransmit the frame, Receiverwill not recognize it, the source will retransmit the frame, Receivergets two copies of the same frame! Solution: use sequence numbers,

Page 83: Computer Networks- Introduction and Data Link Layer

There are four different scenarios that can happen:

Normal Operation Normal OperationWhen ACK is lostWhen frame is lostWh ACK ti tWhen ACK time out occurs

• Simple but inefficient for long distance and high speed• Simple, but inefficient for long distance and high speedapplications.

Page 84: Computer Networks- Introduction and Data Link Layer

Stop-and-Wait ARQ-Normal Operation

Sender is sending frame0 and Sender is sending frame0 and waits for ACK1

Once it receives ACK1 in time (allotted time) it will send frame1.

This process will be continuous This process will be continuous till complete data transmission takes place.

Page 85: Computer Networks- Introduction and Data Link Layer

Stop-and-Wait -lost ACK frame If the sender receives a damagedIf the sender receives a damaged

ACK, it discards it. Here, as the time expires for ACK0 it

will retransmit frame1 Receiver has already received frame1

and expecting to receive frame0and expecting to receive frame0(R=0). Therefore it discards thesecond copy of frame1. Thus the numbering mechanism

solves the problem of duplicate copyof frames.of frames.

Page 86: Computer Networks- Introduction and Data Link Layer

Stop-and-Wait ARQ- lost frame

If the receiver receives If the receiver receivescorrupted/damaged frame it willsimply discard it and assumes that thef l t thframe was lost on the way.

the sender will not get ACK The sender will be in waiting stage The sender will be in waiting stage

for ACK till its time out occurs in thesystem.

As soon as time out occurs in thesystem, the sender will retransmit thesame frame and the receiver will sendsame frame and the receiver will sendthe acknowledgment

Page 87: Computer Networks- Introduction and Data Link Layer

Stop-and-Wait, delayed ACK frame

The ACK can be delayed at thereceiver or due to some problemIt i i d ft th ti f It is received after the timer forframe0 has expired.

Sender retransmitted a copy offrame0.However, R=1 meansreceiver expects to see frame1.Receiver discards the duplicateframe0.

Sender receives 2 ACKs, itdiscards the second ACK.discards the second ACK.

Page 88: Computer Networks- Introduction and Data Link Layer

ii. Go-Back-N ARQ Based on sliding-window flow control. allowing transmission of more than one frame without waiting for

acknowledgementIf th d ti ti ill d ACK l ith t f If no error, the destination will send ACK as usual with next frameexpected (positive ACK, RR: receive ready)

If error, the destination will reply with rejection (negative ACK, If error, the destination will reply with rejection (negative ACK,REJ: reject) Receiver discards that frame and all future frames, until the

f i i d lerroneous frame is received correctly. Source must go back and retransmit that frame and all succeeding

frames that were transmitted.frames that were transmitted. This makes the receiver simple, but decreases the efficiency

Page 89: Computer Networks- Introduction and Data Link Layer

Damaged Frame Suppose A is sending frames to B. After each transmission, A sets a

timer for the frame. In Go-Back-N ARQ, if the receiver detects error in frame i

• Receiver discards the frame, and sends REJ-IReceiver discards the frame, and sends REJ I• Source gets REJ-I• Source retransmits frame i and all subsequent frames

Lost Frame 1Lost Frame 1Assume receiver has received frame i-1. If frame i is lost. Source

subsequently sends i+1Receiver gets frame i+1 out of order, this means the lost of a frame!Receiver sends REJ-I, Source gets REJ-i, and so goes back to frame

i and retransmits frame i, i+1, …d e s s e , , …

Page 90: Computer Networks- Introduction and Data Link Layer

Lost Frame 2 Assume receiver has received frame i-1 Frame i is lost and no additional frame is sent Receiver gets nothing and returns neither acknowledgement nor

rejectionrejection Source times out and sends a request to receiver asking for

instructions Receiver responses with RR frame including the number of the Receiver responses with RR frame, including the number of the

next frame it expects, i.e., frame I Source then retransmits frame i

Page 91: Computer Networks- Introduction and Data Link Layer

Damaged RR Receiver gets frame i and sends RR(i+1) which is lost or damaged Acknowledgements are cumulative, so the next acknowledgement,

i.e., RR(i+n) may arrive before the source times out on frame I If source times out, it sends a request to receiver asking forIf source times out, it sends a request to receiver asking for

instructions, just like the previous example

Page 92: Computer Networks- Introduction and Data Link Layer
Page 93: Computer Networks- Introduction and Data Link Layer

iii. Selective Repeat ARQ Pros: Only rejected frames are retransmitted Subsequent frames are accepted by the receiver and buffered Minimizes the amount of retransmissions

Cons:R i t i t i l h b ff d t t i l i Receiver must maintain large enough buffer, and must contain logicfor reinserting the retransmitted frame in the proper sequence

Also more complex logic in the sourcep g

Page 94: Computer Networks- Introduction and Data Link Layer

Retransmission mechanism Timer: When the timer expires, only the corresponding frame is

t itt dretransmitted. NAK: Whenever an out-of-sequence frame is observed at the

receiver, a NAK frame is sent with sequence number Rnext. When, qthe transmission receives such a NAK frame, it retransmits thespecific frame, Rnext.

Page 95: Computer Networks- Introduction and Data Link Layer
Page 96: Computer Networks- Introduction and Data Link Layer

Performance More efficient than the other two protocols because it reduces

number of retransmissions for noisy links The receiver and transmitter processing logic is more complex Receiver must be able to reinsert the retransmitted (lost delayed Receiver must be able to reinsert the retransmitted (lost, delayed,

damaged) frame in the proper sequence after it arrives The sender should be able to send out of order frame when

requested by the sender using NAKrequested by the sender using NAK Needs more memory than Go-Back-N ARQ at the receiver side.

Page 97: Computer Networks- Introduction and Data Link Layer

Error Detection Error detecting codes.

Include only enough redundancy (which means adding extra

Error Detection

bits for detecting errors at the destination)to allow the receiver todeduce that an error has occurred.

Page 98: Computer Networks- Introduction and Data Link Layer

Error-Detecting Codes

Page 99: Computer Networks- Introduction and Data Link Layer

i. Parity CheckA parity bit is added to every data unit so that the total number of1 (i l di th it bit) b f it h k1s(including the parity bit) becomes even for even-parity check orodd for odd-parity check

Simple parity check

Page 100: Computer Networks- Introduction and Data Link Layer

• Suppose the sender wants to send the word world. In ASCII the fivecharacters are coded as

1110111 1101111 1110010 1101100 1100100

The following shows the actual bits sentThe following shows the actual bits sent

11101110 11011110 11100100 11011000 11001001

received by the receiver without being corrupted in transmissionreceived by the receiver without being corrupted in transmission.

11101110 11011110 11100100 11011000 11001001

The receiver counts the 1s in each character and comes up with even numbers (6, 6, 4, 4, 4). The data are accepted.

Page 101: Computer Networks- Introduction and Data Link Layer

ii. Cyclic Redundancy CheckSender• In CRC sender divides frame (data) by using a predeterminedIn CRC sender divides frame (data) by using a predetermined

Generator Polynomial.• A generating polynomial is an industry approved bit string that is used

t t li h k i dto create cyclic checksum remainder• The reminder obtained after division is appended to the end of the

original message and is transmitted over the medium.Receiver• At the destination, the incoming data unit is divided by the same

generating polynomialgenerating polynomial.• If there is no remainder, the data unit is assumed to be correct and is

therefore acceptedA i d i di t th t th d t it h b d d i t it• A remainder indicates that the data unit has been damaged in transmitand therefore must be rejected.

Page 102: Computer Networks- Introduction and Data Link Layer
Page 103: Computer Networks- Introduction and Data Link Layer

• Suppose a m bit message is to be transmitted and we are using agenerating polynomial of length n+1

• Multiply the original message by 2n and divide it by generatingpolynomialTh i d f thi di i i t th bit (CRC)• The remainder of this division process generates the n-bit (CRC)remainder which will be appended to the m-bit messageproducing (m+n) bit frame for transmission

• On receiving the packet, the receiver divides the (m+n) bit frameby the same generating polynomial and if it produces noremainder no error has occuredremainder ,no error has occured

Page 104: Computer Networks- Introduction and Data Link Layer

Ex:GivenMessage D = 1010001101 (10 bits)P tt P 110101(6 bit )Pattern P = 110101(6 bits)Remainder R =to be calculated(5 bits)

Thus m= 10, n+1 = 6,n = 5.The message is multiplied by 25 yielding 101000110100000.This product is divided by P

Page 105: Computer Networks- Introduction and Data Link Layer

The division process is defined as follows:1. Call the uppermost n+1 bits of the message the remainder2. Beginning with the most significant bit in the original message and

for each bit position that follows, look at the n+1 bit remainder:• If the most significant bit of the remainder is a one, the divisor isIf the most significant bit of the remainder is a one, the divisor is

said to divide into it. In this case of binary division, we simply:• Set the appropriate bit in the quotient to a one, and• XOR the remainder with the divisor and store the result back• XOR the remainder with the divisor and store the result back

into the remainder• Otherwise (if the first bit is not a one):

• Set the appropriate bit in the quotient to a zero, and• XOR the remainder with zero (no effect)

• Left-shift the remainder, shifting in the next bit of the message.e s e e de , s g e e b o e ess ge.

Page 106: Computer Networks- Introduction and Data Link Layer
Page 107: Computer Networks- Introduction and Data Link Layer
Page 108: Computer Networks- Introduction and Data Link Layer

• The remainder is added to D to give T=1 0 1 0 0 0 1 1 0 1 0 1 1 1 0which is transmitted.

• If there are no errors, the receiver receives T intact. The receivedframe is divided by P

• If there is no Remainder it is assumed that there have been no errorsIf there is no Remainder it is assumed that there have been no errors

Page 109: Computer Networks- Introduction and Data Link Layer
Page 110: Computer Networks- Introduction and Data Link Layer

iii. ChecksumSender Side The unit is divided into k sections, each of n bits. All sections are added together to get the sum. The sum is complemented and becomes the checksum. The checksum is sent with the data.Receiver Side The unit is divided into k sections, each of n bits. All sections are added together to get the sum All sections are added together to get the sum. The sum is complemented. If the result is one, the data are accepted: otherwise, they are rejected. If the result is one, the data are accepted: otherwise, they are rejected.

Page 111: Computer Networks- Introduction and Data Link Layer
Page 112: Computer Networks- Introduction and Data Link Layer

HDLC(High-Level Data Link Control)

It is a bit-oriented protocol developed by ISO where information issend as a sequence of bits.

Frames are used as a transport mechanism to transport data from onepoint to another.

f t features :i. Reliable protocol (selective repeat or go-back-N)ii Full-duplex communication (receive and transmit at the same time)ii. Full-duplex communication (receive and transmit at the same time)iii. Bit-oriented protocoliv. Flow control (adjust window size based on receiver capability).( j p y)v. Uses physical layer clocking and synchronization to send and

receive frames

Page 113: Computer Networks- Introduction and Data Link Layer

To satisfy a variety of applications, HDLC defines 3 types of stations,two link configuration and three data transfer modes

The three station types are: Primary station Has the responsibility of controlling the operation of data flow Has the responsibility of controlling the operation of data flow . Handles error recovery Frames issued by the primary station are called commands.

S d t ti Secondary station, Operates under the control of the primary station. Frames issued by a secondary station are called responses. The primary station maintains a separate logical link with each

secondary station. Combined station, Acts as both as primary and secondary station.

Page 114: Computer Networks- Introduction and Data Link Layer

The two link configurations are:i Unbalanced Configuration: Consists of one primary and two ori. Unbalanced Configuration: Consists of one primary and two or

more secondary.i. Balanced Configuration: Consists of two combined stations andg

supports both full-duplex and half-duplextransmission

Page 115: Computer Networks- Introduction and Data Link Layer

PrimaryCommands

Unbalanced Mode

Primary

Secondary Secondary

Responses

Combined CombinedBalanced mode

Co b ed Co b ed

commands/Responses

Page 116: Computer Networks- Introduction and Data Link Layer

The three modes of data transfer operations are Normal Response Mode (NRM) Secondary station can send only when the primary station instruct Secondary station can send only when the primary station instruct

it to do so Two common configurations

Point to Point link (one primary and one secondary station)a. Point-to-Point link (one primary and one secondary station)b. Multipoint link (primary station maintain different sessions with

different secondary stations) As nchrono s Response Mode (ARM) Asynchronous Response Mode (ARM) More independent secondary station Can send data or control information without explicit permission to

ddo so Asynchronous Balanced Mode (ABM) used in point-to-point links, for communication between combined

istations Either stations can send data, control information and commands

Page 117: Computer Networks- Introduction and Data Link Layer

Frames

HDLC FRAMES

U-frame I-frame S-frame

Unnumbered frames, used in link setup and disconnection, Information frames, which carry actual information. S i f hi h d f d fl l Supervisory frames, which are used for error and flow control

purposes and hence contain send and receive sequence numbers

Page 118: Computer Networks- Introduction and Data Link Layer

Frame structure

Flag: bit pattern that shows both the beginning and the end of a frame. Address: contains the address of the secondary station and identifies

whether the frame is a command or response Control: Identifies the type of HDLC frame i e (I S or U frames) Control: Identifies the type of HDLC frame i.e..(I,S or U-frames) Information: present only in I-frames and some U-frames.Frame Check Sequence (FCS): This field contains a 16-bit, or 32-bitFrame Check Sequence (FCS): This field contains a 16 bit, or 32 bit

CRC bits which is used for error detection

Page 119: Computer Networks- Introduction and Data Link Layer

Operation Three phasesp initialization by either side, set mode & information

d t t f data transfer with flow and error control using both I & S-framesg

disconnect when ready or fault noted

Page 120: Computer Networks- Introduction and Data Link Layer

LAPB -Linked Access Protocol (Balanced) X.25 is a network interface commonly used for interconnecting

LANs The X.25 defines the lowest three layers of the OSI Reference Model

: Physical layer, Data link Layer and Network Layer LAPB i bit i t d h t l d t LAPB is a bit-oriented synchronous protocol used to manage

communication between data terminal equipment (DTE) and the datacircuit-terminating equipment (DCE) devices

Data terminal equipment devices are end systems that communicateacross the X.25 network. They are usually terminals, personalcomputers or network hosts and are located on the premises ofcomputers, or network hosts, and are located on the premises ofindividual subscribers.

Page 121: Computer Networks- Introduction and Data Link Layer

DCE devices are communications devices, such as modems and packetswitches

The address field can contain only one of two fixed (DTE or DCE)addresses

Page 122: Computer Networks- Introduction and Data Link Layer

LAPD- Linked Access Protocol (D Channel) protocol for the D channel,D channel is the data or signaling channel

which is used for carrying control and signalling information

LAPD Linked Access Protocol (D Channel)

handle the handshaking(commands and responses), signalling, andcontrol for all of the voice and data calls that are setup through the ISDND channelD channel

works in the Asynchronous Balanced Mode (ABM),This mode is totallybalanced (i.e., no master/slave relationship). Each station may initialize,

i f d d f t tisupervise, recover from errors, and send frames at any time The objective is to provide a secure, error-free connection between two

end-points so as to reliably transport Layer 3 messages.p y p y g shares the same frame format, frame types, and field functions as HDLC

and provides framing, sequence control, error detection, and recovery

Page 123: Computer Networks- Introduction and Data Link Layer

SAPI: Identifies the port at which LAPD services are provided toLayer 3.

C/R: Indicates whether the frame contains a command or a response. TEI:Identifies either a single terminal or multiple terminals

compatible with the ISDN networkcompatible with the ISDN network.