Computer Networks I
Computer Networks I
Computer Networks I
COMPUTER
NETWORKS-I
For S.Y.B.Sc. Computer Science : Semester – IV (Paper – II)
[Course Code CS 242 : Credits - 2]
CBCS Pattern
As Per New Syllabus, Effective from June 2020
Price ` 330.00
N5542
COMPUTER NETWORKS-I ISBN 978-93-90506-39-2
First Edition : January 2021
© : Authors
The text of this publication, or any part thereof, should not be reproduced or transmitted in any form or stored in any computer
storage system or device for distribution including photocopy, recording, taping or information retrieval system or reproduced on any disc,
tape, perforated media or other information storage device etc., without the written permission of Authors with whom the rights are
reserved. Breach of this condition is liable for legal action.
Every effort has been made to avoid errors or omissions in this publication. In spite of this, errors may have crept in. Any mistake, error
or discrepancy so noted and shall be brought to our notice shall be taken care of in the next edition. It is notified that neither the publisher
nor the authors or seller shall be responsible for any damage or loss of action to any one, of any kind, in any manner, therefrom.
DISTRIBUTION CENTRES
PUNE
Nirali Prakashan : 119, Budhwar Peth, Jogeshwari Mandir Lane, Pune 411002, Maharashtra
(For orders within Pune) Tel : (020) 2445 2044; Mobile : 9657703145
Email : [email protected]
Nirali Prakashan : S. No. 28/27, Dhayari, Near Asian College Pune 411041
(For orders outside Pune) Tel : (020) 24690204; Mobile : 9657703143
Email : [email protected]
MUMBAI
Nirali Prakashan : 385, S.V.P. Road, Rasdhara Co-op. Hsg. Society Ltd.,
Girgaum, Mumbai 400004, Maharashtra; Mobile : 9320129587
Tel : (022) 2385 6339 / 2386 9976, Fax : (022) 2386 9976
Email : [email protected]
DISTRIBUTION BRANCHES
JALGAON
Nirali Prakashan : 34, V. V. Golani Market, Navi Peth, Jalgaon 425001, Maharashtra,
Tel : (0257) 222 0395, Mob : 94234 91860; Email : [email protected]
KOLHAPUR
Nirali Prakashan : New Mahadvar Road, Kedar Plaza, 1st Floor Opp. IDBI Bank, Kolhapur 416 012
Maharashtra. Mob : 9850046155; Email : [email protected]
NAGPUR
Nirali Prakashan : Above Maratha Mandir, Shop No. 3, First Floor,
Rani Jhanshi Square, Sitabuldi, Nagpur 440012, Maharashtra
Tel : (0712) 254 7129; Email : [email protected]
DELHI
Nirali Prakashan : 4593/15, Basement, Agarwal Lane, Ansari Road, Daryaganj
Near Times of India Building, New Delhi 110002 Mob : 08505972553
Email : [email protected]
BENGALURU
Nirali Prakashan : Maitri Ground Floor, Jaya Apartments, No. 99, 6th Cross, 6th Main,
Malleswaram, Bengaluru 560003, Karnataka; Mob : 9449043034
Email: [email protected]
Other Branches : Hyderabad, Chennai
Note : Every possible effort has been made to avoid errors or omissions in this book. In spite this, errors may have crept in. Any type of
error or mistake so noted, and shall be brought to our notice, shall be taken care of in the next edition. It is notified that neither the publisher,
nor the author or book seller shall be responsible for any damage or loss of action to any one of any kind, in any manner, therefrom. The
reader must cross check all the facts and contents with original Government notification or publications.
[email protected] | www.pragationline.com
Also find us on www.facebook.com/niralibooks
Preface …
The book has its own unique features. It brings out the subject in a very simple and lucid
manner for easy and comprehensive understanding of the basic concepts. The book covers
theory of Introduction to Networks and Network Models, Lower Layers, Network Layer and
Transport Layer.
A special word of thank to Shri. Dineshbhai Furia, and Mr. Jignesh Furia for
showing full faith in us to write this text book. We also thank to Mr. Amar Salunkhe and
Mrs. Prachi Sawant of M/s Nirali Prakashan for their excellent co-operation.
We also thank Mr. Ravindra Walodare, Mr. Sachin Shinde, Mr. Ashok Bodke,
Mr. Moshin Sayyed and Mr. Nitin Thorat.
Although every care has been taken to check mistakes and misprints, any errors,
omission and suggestions from teachers and students for the improvement of this text book
shall be most welcome.
Authors
Syllabus …
1. Introduction to Networks and Network Models (4 Hrs.)
1.1 Data Communication, Components, Data Representation
1.2 Networks, Network Criteria, Network Types - LAN, WAN, Switching, The Internet,
Accessing the Internet
1.3 Network Software - Protocol Hierarchies, Design Issues of the Layer, Connection Oriented
and Connectionless Services
1.4 Reference Models - OSI Reference Models, TCP/IP Reference Model, Connection Devices
in different Layers, Comparison of OSI and TCP/IP Reference Models
2. Lower Layers (10 Hrs.)
2.1 Communication at the Physical Layer, Data Rate Limits - Noiseless Channel (Nyquist Bit
Rate), Noisy Channel (Shannon Capacity), Performance - Bandwidth, Throughput, Latency,
Bandwidth-Delay Product, Jitter
2.2 Design Issues of Data Link Layer, Services - Framing, Flow Control, Error Control,
Congestion Control, Link Layer Addressing
2.3 Framing Methods - Character Count, Flag Bytes with Byte Stuffing, Flags Bits with Bit
Stuffing, Physical Layer Coding Violations
2.4 The Channel Allocation Problem, Static and Dynamic Allocation, Media Access Methods -
Taxonomy of Multiple - Access Protocols
2.5 Switching and TCP/IP Layers, Types - Circuit Switching, Packet Switching and Message
Switching
2.6 Wired LANs - Standard Ethernet Characteristics, Addressing, Access Method,
Implementation, Fast and Gigabit Ethernet
2.7 Wireless LANs - Architectural Comparison, Characteristics, Access Control, IEEE 802.11
Architecture, Physical Layer, MAC Sublayer, Bluetooth Architecture, Layers
3. Network Layer (12 Hrs.)
3.1 Network Layer Services - Packetizing, Routing and Forwarding, other Services
3.2 Open and Closed Loop Congestion Control
3.3 IPv4 Addressing - Address Space, Classful Addressing, Subnetting, Supernetting, Classless
Addressing, Network Address Resolution (NAT)
3.4 Forwarding of IP Packets - Based on Destination Address, Based on Label
3.5 Network Layer Protocols - Internet Protocol (IP), IPv4 Datagram Format, Fragmentation,
Options
3.6 Mobile IP - Addressing, Agents, Three Phases
3.7 Next Generation IP - IPv6 Address Representation, Address Space, Address Types, IPv6
Protocol, Packet Format, Extension Header, Difference between IPv4 and IPv6
3.8 Routing - General Idea, Algorithms - Distance Vector Routing, Link State Routing, Path -
Vector Routing
4. Transport Layer (10 Hrs.)
4.1 Transport Layer Services - Process-to-Process Communication, Addressing, Encapsulation
and Decapsulation, Multiplexing and Demultiplexing, Flow Control, Pushing or Pulling,
Flow Control, Buffers, Sequence Numbers, Acknowledgements, Sliding Window,
Congestion Control
4.2 Connectionless and Connection-oriented Service, Port Numbers
4.3 Transport Layer Protocols - User Datagram Protocol, User Datagram, UDP Services
4.4 Transmission Control Protocol - TCP Services, TCP Features, TCP Segment Format, Three -
way Handshake for Connection Establishment and Termination, State Transition Diagram,
Windows in TCP
Contents …
1.0 INTRODUCTION
• Data communications and computer networks are two of the fastest growing
technological areas in today’s modern world. This is because there is an almost
unlimited demand for information transfer.
• The word ‘communication’ is derived from the Latin word ‘communicare’, which
means 'to share'. Communication means the transfer of information between humans,
computers or machines in a meaningful way.
• Communication is the process of establishing connection or link between two entities
for the transfer/exchange of information.
• When we communicate, we share information. This sharing can be local or remote.
Local communication can be face to face between individuals, while remote
communication takes over distance.
• Data communication is a process of exchanging data or information between two
devices (a sender and a receiver) through some kind of transmission/ communication
medium such as coaxial cable or fiber optic cable (wired) and/or air (wireless).
• A group of computers and other devices such as printers, hubs, modems etc.,
connected together is called a network. The interconnected computers can share
resources, which is called networking.
• A computer network provides the facility of information exchange/transfer among the
computers, connected to it.
1.1
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
• A network is a combination of hardware and software that sends data from one point
to another.
o The hardware consists of the physical equipment that carries signals from one
point to the network to another.
o The software consists of instruction sets, that make possible the services that we
expect from a network.
• A reference model in networking is a conceptual layout that describes how
communication between devices should occur.
• For efficient communication, the reference model identifies the tasks involved in
inter-computer communication and divides them in logical groups called layers, with
each layer performing a specific function.
• The purpose of the reference model was to define an architectural framework that
defines the logical communication tasks that are required to move information
between different computer systems.
• In networking the two most common reference models are Open Systems
Interconnection (OSI) reference model and TCP/IP (Transmission Control
Protocol/Internet Protocol) reference model.
• In this chapter we will study basic concepts in data communications and networking,
reference models, network software, Internet and so on.
1.2
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
2. Accuracy: The system must deliver the data accurately i.e., without any error.
3. Timeliness: The system must deliver data in a timely manner. Data delivered late
is useless.
4. Jitter: Jitter refers to the variation in the packet arrival time. Jitter is the uneven
delay in the delivery of audio or video packets.
Medium
Sender Receiver
Fig. 1.2: Components of Data Communications
1.4
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
• The direction of data flow between two linked devices is called as mode of
communication.
• There are three types of direction of data flow namely, simplex communication mode,
half-duplex communication mode and full-duplex communication mode.
1. Simplex Communication Mode:
• In simplex mode, the communication can take place in only one direction.
• In simplex mode, a terminal can only send data and cannot receive it or it can only
receive data but cannot send it. It means that in simplex mode communication is
unidirectional.
• Fig. 1.3 shows simplex mode in data communication.
Direction of data
Mainframe Monitor
• In computer systems, the keyboard, monitor and printer are examples of simplex
communication. The keyboard can only be used to enter data into the computer, while
monitor and printer can only accept (display/print) output.
Advantages of Simplex Communication Mode:
(i) Very simple and easy communication method.
1.6
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
Workstation Workstation
Workstation Workstation
Fig. 1.5: Full Duplex Communication Mode
Advantages:
(i) Enables two-way communication simultaneously.
(ii) Fastest method of data communication.
Disadvantages:
(i) More expensive and complex method.
(ii) Two bandwidth channels is required for data transmission.
1.2 NETWORKS
• A network is the interconnection of a set of devices (like a host (desktop, laptop,
workstation, smartphone) and/or connecting devices like router, switch, modem etc.).
• A network is nothing more than two or more computers connected by a cable or by a
wireless radio waves connection so that they can exchange information.
• A communication network is a set of devices connected by channels on links and
provides a service between users located at various geographical points.
• A network is defined as, “an interconnected collection of autonomous computers”.
Two computers are said to be interconnected if they are capable of exchanging
information.
1.8
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
Computer 1
Printer
Nodes
Links
Server
Computer 2
Server
Network
Network
Users (clients)
• The computer networks are playing an important role in providing services to large or
small or medium organizations as well as to the individual common man.
• Network services are the things that a network can do. The major networking services
are:
1. File Services: This includes file transfer, storage, data migration, file update,
synchronization and achieving.
2. Printing Services: This service provides shared access to valuable printing
devices.
3. Message Services: This service facilitates email, voice mails and coordinate object
oriented applications.
4. Application Services: This services allows us to centralize high profile
applications to increase performance and scalability.
5. Database Services: This involves coordination of distributed data and replication.
1. Performance:
• Performance of computer networks can be measured in many ways, including transit
time (propagation delay) and response time (speed of operation).
• Transit time is the amount of time required for a message to travel from one device to
another in a network. Response time in the network is the elapsed time between an
inquiry and a response.
• The performance of a network depends on a number of factors. Some of them are
explained below:
(i) Type of Transmission Medium:
o The transmission medium defines the speed at which data can travel through a
connection (the data rate). Today's networks are moving to faster and faster
transmission media, such as fiber-optic cabling.
o A transmission medium that can carry data at 100 megabits per second is 10 times
more powerful than a medium that can carry data at only 10 megabits per second.
(ii) Number of Users:
o Having a large number of concurrent users can slow response time in a computer
network not designed to coordinate heavy traffic loads.
o The design of a given computer network is based on an assessment of the average
number of users that will be communicating at any one time.
o When the actual number of users can exceed the average and thereby decrease
performance. How a network responds to loading is a measure of its performance?
(iii) Software:
o The software used to process data at the sender, receiver, and intermediate nodes
also affects network performance.
o Moving a message from node to node through a network requires processing to
transform the raw data into transmittable signals, to route these signals to the
proper destination, to ensure error-free delivery, and to recast the signals into a
form the receiver can use.
o The software that provides these services affects both the speed and the reliability
of a network link. A well designed software can speed the process and make data
transmission more effective and efficient.
(iv) Hardware:
o The types of hardware included in a computer network affect both the speed and
capacity of data transmission. A higher-speed computer with greater storage
capacity provides better performance.
1.12
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
2. Security:
• Network security issues in a computer network include protecting data from
unauthorized access and viruses.
(i) Unauthorized Access:
o For a computer network to be useful, sensitive data must be protected from
unauthorized access. Protection can be accomplished at a number of levels.
o At the lowest level are user identification codes and passwords while at a higher
level are encryption techniques.
o In these mechanisms, data are systematically altered/modified in such a way that if
they are intercepted by an unauthorized user, they will be unintelligible.
(ii) Viruses:
o A computer network is accessible from many points, it can be susceptible to
computer viruses. A virus is an illicitly introduced code that damages the
computer system.
o A good computer network is protected from viruses by hardware and software
designed specifically for that purpose.
3. Reliability:
• In addition to accuracy of delivery, network reliability of a computer network is
measured by following factors:
(i) Frequency of Failure:
o All networks fail occasionally. A network that fails often, however, is of little value
to a user.
(ii) Recovery Time of a Network After a Failure:
o How long does it take to restore service? A computer network that recovers
quickly is more useful than one that does not.
(iii) Catastrophe:
o Computer networks must be protected from catastrophic events such as fire,
earthquake or theft.
o One protection against unforeseen damage is a reliable system to back up
computer network software.
1.13
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
Workstation Workstation
2. Multipoint Connection:
• A multipoint connection is a link between more than two devices. It is also known as
multidrop connection.
• In multipoint connection, a single link is shared by multiple devices. So, it can be said
that the channel capacity is shared temporarily by every device connecting to the link.
• The networks having multipoint connections are called broadcast networks. A
broadcast network has a single communication channel that is shared by all the
machines on the network.
• Examples of multipoint connections are Ethernet and Bus topology based on LAN.
1.14
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
• Fig. 1.10 shows a broadcast network. In Fig. 1.10 we can see that the three
workstations share the common link between the mainframe and the workstations.
Workstation 1 Workstation 2
Link
Mainframe
Workstation 3
1.15
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
Switch/Hub
• In bus topology, all nodes are connected to a central cable which is called a bus. This
bus is also called Trunk or sometimes it was also referred to as Backbone cable.
• Trunk cable was then connected to the branch cables which were further connected to
the PCs. Every network device communicates with the other device through this Bus.
• Nodes are connected to the bus cable by drop lines and taps. A drop line is a
connection running between the device and the main cable.
• A tap is a connector that either splices into the main cable or punctures the sheathing
of a cable to create a contact with the metallic core.
• A node (computer) that wants to send data, it puts the data on the bus which carries it
to the destination node.
1.16
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
• When one computer sends a signal up the wire, all the computers on the network
receive the information, but only one accepts the information.
• The rest regrets the message. One computer can send a message at a time. A computer
must wait until the bus is free before it can transmit.
• Fig. 1.12 shows a bus topology or network.
Laser Printer
Bus/Trunk/Backbone
T-connector
Data flow
Terminator
Terminator
• In ring topology, the computers in the network are connected in a circular fashion
which form of a ring.
• In ring topology, each computer is connected to the next computer, with the last one
connected to the first or we can say each device is connected to other two devices with
a dedicated link in one direction, from device to device. Each computer in the ring
incorporates a repeater.
• When a computer receives a signal intended for another computer, its repeater
regenerates the bits and passes them.
1.17
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
• The message flows around the ring in one direction. Today higher speed LANs has
made this topology less popular.
• Fig. 1.13 shows a ring topology.
Flow of
message
1.18
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
• In a mesh network topology, each of the network nodes, computer and other devices,
are interconnected with one another with dedicated point to point link.
• Dedicated means that a link carries traffic only between the two devices it connects. So
for N number of nodes, there will be a total n(n-1)/2 links required.
• Mesh topology is usually implemented in a limited fashion, as a backbone connecting
the main computers of a hybrid network that can include several other topologies.
• Fig. 1.14 shows a mesh topology. Mesh topology is used in WAN.
1.19
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
• A mesh topology employs one of two connection arrangements, full mesh topology or
partial mesh topology.
1. In a full mesh network, each network node is connected to every other node in
the network. Due to this arrangement of nodes, it becomes possible for a
simultaneous transmission of signals from one node to several other nodes.
2. In a partially connected mesh network, only some of the network nodes are
connected to more than one node. This is beneficial over a fully connected mesh in
terms of redundancy caused by the point-to-point links between all the nodes.
Advantages:
1. Each connection can carry its own data load due to a dedicated link.
2. Eliminates traffic problems.
3. Mesh topology is robust. If one link becomes unusable, it does not affect other
systems.
4. Privacy or security because of dedicated lines.
5. Point-to-point links make fault identification easy and simple.
Disadvantages:
1. More cables are required than other topologies.
2. Overall cost of this network is very high.
3. Installation and reconfiguration is very difficult.
4. Set-up and maintenance of this topology is very difficult.
5. Expensive due to hardware requirements such as cables.
1.20
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
Nodes
Nodes
Concentrator
(Hub)
Backbone cable
1.21
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
Bus
Hub
Hub
Hub
Star
Advantages:
1. Fault detection and troubleshooting is easy in this type of topology.
2. It is easy to increase the size of a network by adding new components, without
disturbing existing architecture.
3. Flexible because this topology can be designed according to the requirements of
the organization and by optimizing the available resources.
4. Hybrid topology is the combination of two or more topologies, so we can design it
in such a way that strengths of constituent topologies are maximized while their
weaknesses are neutralized.
Disadvantages:
1. Hybrid topology is complex and difficult to design.
2. The hubs used to connect two distinct networks are very expensive.
3. As hybrid architectures are usually larger in scale, and so it is time consuming and
difficult to install.
4. Hybrid topology also requires a lot of cables, cooling systems, sophisticated
network devices, etc.
5. Cost is high.
WAN
(Overall World
/Globe)
MAN
(Cities, states, etc.)
LAN
(Building,
cyber cafe etc.)
LAN
LAN
• Generally, LAN will use only one type of transmission medium wired or wireless. The
most common LAN topologies are bus, ring or star.
• Early LAN had data rates in the 4 to 16 mbps range. Today, speeds are normally 100 to
1000 mbps. Wireless LANs are the newest evolution in LAN technology.
• A LAN may be set up using wired or wireless connections. A LAN that is completely
wireless is called Wireless LAN (WLAN).
• WLAN helps us to link single or multiple devices using wireless communication within
a limited area like home, school, or office building. Today most modern day's WLAN
systems are based on IEEE 802.11 standards.
• On most LANs, cables are used to connect nodes like computers, printers, etc. Fig. 1.20
shows a typical LAN.
1.24
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
Advantages of LAN:
1. The reliability of LAN is high because the failure of one computer in the network
does not affect the functioning for other computers.
2. Addition of a new computer to the network is easy and simple.
3. High rate of data transmission is possible.
4. Peripheral devices like magnetic disk, printer etc. can be shared by other
computers.
5. Less expensive to install.
Disadvantages of LAN:
1. Used for small geographical areas (less than 1 km).
2. Limited computers are connected in LAN.
3. Special security measures are needed to stop unauthorized users from using
programs and data.
4. LANs need to be maintained by skilled technicians.
5. In LAN if the file server develops a serious fault, all the users are affected.
1.25
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
LAN 3
LAN 2
Communication subnet
• The function of the subnet is to carry messages from host to host. The subnet consists
of two important components; namely, transmission lines and switching elements.
• Transmission lines move bits from one machine to another. The switching elements
are specialized computers used to connect two or more transmission lines. When data
arrives on an incoming line, the switching element must choose an outgoing line to
forward them.
• The switching elements are either called as packet switching nodes, intermediate
systems, data switching exchanges or routers.
• When a packet is sent from one router to another via one or more intermediate
routers, the packet is received at an intermediate router. It is stored in the routers
until the required output line is free and then forwarded.
• A subnet using this principle is called a point to point, store-forward or packet
switched subnet.
• WAN's may use public, leased or private communication devices, and can spread over
a wide geographical area. A WAN that is wholly owned and used by a single company
is often called an enterprise network.
• The transmission in WAN is based on a point-to-point technology involving the process
of switching.
Point-to-Point WAN:
• A point-to-point WAN is a network that connects more than two communicating
devices through a transmission media like cable or air.
• The point-to-point WAN is normally a line leased from a telephone or cable TV
provider that connects a home computer or a small LAN to an Internet Service
Provider (ISP).
• A point-to-point WAN is often used to provide Internet access. Fig. 1.24 shows an
example of a point-to-point WAN.
1.28
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
Advantages of WAN:
1. WAN covers a large geographical area.
2. WAN shares software and resources with connecting workstations.
3. Using WAN messages can be sent very quickly to anyone else on the network.
4. Expensive things (like printers or phone lines to the internet etc.) can be shared by
all the computers on the network.
5. WAN adds fluidity to user’s information communication.
Disadvantages of WAN:
1. WANs are expensive.
2. WANs need a good firewall to restrict outsiders from entering and disrupting the
network.
3. Setting up a network can be an expensive and complicated experience. The bigger
the network the more expensive it is.
4. Security is a real issue when many different people have the ability to use
information from other computers. Protection against hackers and viruses adds
more complexity and expense.
5. Slower than LAN and MAN.
Difference between LAN, MAN and WAN: (April 17)
Parameters LAN WAN MAN
1. Stand for Local Area Network. Wide Area Metropolitan Area
Network. Network.
2. Area covered Covers small area Covers large Covers larger areas
i.e. within the geographical than LAN and
building (less than areas, like smaller than WAN
1 km). country, state etc. like cities.
Contd...
1.29
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
1.30
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
• Now the company has an internetwork, or a private internet (with lowercase i) and
the communication between offices is now possible. Fig. 1.11 shows this internetwork
or internet.
Fig. 1.26: An internetwork made up of Two LANs and One Point-to-Point WAN
• When a host in the west coast office sends a message to another host in the same
office, the router blocks the message, but the switch directs the message to the
destination.
• On the other hand, when a host on the west coast sends a message to a host on the east
coast, router R1 routes the packet to router R2, and the packet reaches the destination.
• Fig. 1.27 shows another internet with several LANs and WANs connected. One of the
WANs is a switched WAN with four switches.
Fig. 1.27: A Heterogeneous Network made of Four WAN and Three LANs
• Today most end users who want Internet connection use the services of Internet
Service Providers (ISPs). There are international, national, regional and local service
providers.
1.31
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
1.2.6 Switching
• An internet is a switched network in which a switch connects at least two links
together. A switch needs to forward data from a network to another network when
required.
• The two most common types of switched networks are circuit-switched network and
packet-switched network.
1.32
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
• In Fig. 1.28, the four telephones at each side are connected to a switch. The switch
connects a telephone set at one side to a telephone set at the other side.
• The thick line in Fig. 1.28 connecting two switches is a high-capacity communication
line that can handle four voice communications at the same time; the capacity can be
shared between all pairs of telephone sets.
• The switches used in this example have forwarding tasks but no storing capability.
• Now assume that the capacity of the thick line is only twice the capacity of the data
line connecting the computers to the routers.
• If only two computers (one at each site) need to communicate with each other, there is
no waiting for the packets.
• However, if packets arrive at one router when the thick line is already working at its
full capacity, the packets should be stored and forwarded in the order they arrived.
• The two simple examples show that a packet-switched network is more efficient than a
circuit-switched network, but the packets may encounter some delays.
1.2.7 Internet
• The term Internet is derived from the words ‘interconnection’ and ‘networks’. The
Internet is also known as ‘Net’.
• A network is a collection of two or more computers, which are connected together to
share information and resources.
• The Internet is a worldwide system of computer networks, i.e. network of networks.
• Through the Internet, computers become able to exchange information with each
other and find diverse perspectives on issues from a global audience.
• The Internet is the global system of interconnected computer networks that uses
the Internet protocol suite (TCP/IP) to communicate between networks and devices.
• The Internet is a network of networks that consists of private, public, academic,
business, and government networks of local to global scope, linked by a broad array of
electronic, wireless, and optical networking technologies.
• An internet (note the lowercase i) is two or more networks that can communicate with
each other. The most notable internet is called the Internet (uppercase I) and is
composed of thousands of interconnected networks.
• Fig. 1.30 shows a conceptual (not geographical) view of the Internet which shows the
Internet as several backbones, provider networks, and customer networks.
• At the top level, the backbones are large networks owned by some communication
companies like Sprint, Verizon (MCI), AT&T, and so on.
1.34
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
• The backbone networks are connected through some complex switching systems,
called peering points. At the second level, there are smaller networks, called provider
networks, that use the services of the backbones for a fee.
• The provider networks are connected to backbones and sometimes to other provider
networks. The customer networks are networks at the edge of the Internet that
actually use the services provided by the Internet.
• The customer networks pay fees to provider networks for receiving services.
Backbones and provider networks are also called Internet Service Providers (ISPs).
• The backbones are often referred to as international ISPs, the provider net- works are
often referred to as national or regional ISPs.
1.35
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
(ii) DSL Service: Digital Subscriber Line (DSL) service provides a connection to the
Internet through the telephone network. Unlike dial-up, DSL can operate using a
single phone line without preventing normal use of the telephone line for voice
phone calls. DSL uses the high frequencies, while the low (audible) frequencies of
the line are left free for regular telephone communication. Since the advent of the
Internet, some telephone companies have upgraded their telephone lines to
provide higher speed Internet services to residences or small
businesses/organizations. The DSL service also allows the line to be used
simultaneously for voice and data communication. Faster forms of DSL, are also
available like High Data Rate Digital Subscriber Line (HDSL), Very High Data Rate
1.36
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
1.37
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
• Fig. 1.33 shows how internet is accessed using Cable TV connection. A cable modem is
used to access this service, provided by the cable operator.
• The Cable modem comprises two connections: one for internet service and other for
Cable TV signals.
• Since Cable TV internet connections share a set amount of bandwidth with a group of
customers, therefore, data transfer rate also depends on the number of customers
using the internet at the same time.
1.39
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
1.40
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
1.41
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
1.42
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
1.43
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
• Network software is a general phrase for software that is designed to help set up,
manage, and/or monitor computer networks.
• Networking software applications are available to manage and monitor networks of
all sizes, from the smallest home networks to the largest enterprise networks.
Functions of Network Software:
1. Helps to set up and install computer networks.
2. Enables users to have access to network resources in a seamless manner.
3. Allows administrations to add or remove users from the network.
4. Helps to define locations of data storage and allows users to access that data.
5. Helps administrators and security systems to protect the network from data
breaches, unauthorized access and attacks on a network.
• With the advent of Software Defined Networking (SDN), software is separated from
the hardware thus making it more adaptable to the ever-changing nature of the
computer network.
1.44
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
Fig. 1.39
• Every layer removes the header part attached by the corresponding layer from the
sender's machine. None of the headers for layers below n are passed up to layer n.
Layer
Layer 5 protocol
M M
5
Layer 4 protocol
H4 M H4 M
4
Layer 3 protocol
3 H 3 H 4 M1 H 3 M2 H 3 H 4 M1 H 3 M2
Layer 2
protocol
2 H2 H3 H4 M1 T2 H2 H3 M2 T2 H2 H3 H4 M1 T2 H2 H3 M2 T2
1
Source machine Destination machine
1.47
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
One solution is both entities agree upon the data rate to control the flow. Another
solution involves some kind of feedback from the receiver to the sender about the
receiver’s current situation. This subject is called flow control.
5. Disassembling and Reassembling of Messages: Another problem that must be
solved at several levels is the inability of all processes to accept arbitrarily long
messages. One solution is to divide long messages into multiple small messages,
transmit them and combine them at the receiving end.
6. Multiplexing and Demultiplexing: When it is inconvenient or expensive to set up
a separate connection for each pair of communicating processes, the underlying
layer may decide to use the same connection for multiple, unrelated
conversations. This is known as multiplexing. Multiplexing is needed in the
physical layer.
7. Routing: When multiple paths between source and destination are available, a
route must be chosen depending upon certain criteria. Criteria may be current
traffic or situation of the subnet. Criteria is called a routing protocol and this
process is called routing.
8. Order of Messages: Not all communication channels preserve the order of
messages sent on them. To deal with possible loss of sequencing, the protocol must
make explicit provision for the receiver to allow the pieces to be reassembled
properly.
9. Scalability: Networks are continuously evolving. The sizes are continually
increasing leading to congestion. Also, when new technologies are applied to the
added components, it may lead to incompatibility issues. Hence, the design should
be done so that the networks are scalable and can accommodate such additions
and alterations.
10. Security: A major factor of data communication is to defend it against threats like
eavesdropping and surreptitious alteration of messages. So, there should be
adequate mechanisms to prevent unauthorized access to data through
authentication and cryptography.
11. Resource Allocation: Computer networks provide services in the form of network
resources to the end users. The main design issue is to allocate and deallocate
resources to processes. The allocation/deallocation should occur so that minimal
interference among the hosts occurs and there is optimal usage of the resources.
1.48
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
1.49
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
• The network considers each datagram or data packet as an independent entity i.e., no
relationship is considered between the packets belonging to the same message.
• Each datagram carries its source and destination address. The router uses the
destination address to route the datagram to its destination.
• The packets received at the destination may be received out of order. Hence, the
datagrams are assembled to recreate the original message.
1.51
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
Sender Receiver
1.53
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
• The process of sending a letter by one friend to another is difficult, if there are no
services available by post office.
• In the Fig. 1.43, we have a sender, a receiver and a carrier. At sender and receiver’s
end, all the activities done are grouped in three layers.
• The task of transporting the letter between the sender and receiver is done by the
carrier. At the sender site, the letter must be written and dropped in the mailbox
before being picked up by the letter carrier and delivered to the post office.
• At the receiver site, the letter must be dropped in the recipient mailbox before being
picked up and read by the recipient. Every step must be carried out sequentially one
by one. In the same way computers also work. Each layer at sending and site uses
services of the layer immediately below it.
• There are two computer network models namely, OSI Model and TCP/IP Model on
which the whole data communication process relies. In this section, we will study
these two network models with layers and functions of each layer.
1.54
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
7 Application
6 Presentation
5 Session
4 Transport
3 Network
2 Data Link
1 Physical
Physical communication
Fig. 1.45: Interactions between OSI model layer or Layered Architecture of OSI Model
1.56
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
• At the physical layer, communication is direct i.e., Machine X sends a stream of bits to
machine Y.
• At the higher layers, however, communication must move down through the layers on
machine X, over to machine Y, and then back up through the layers.
• Each layer in the sending machine adds its own information to the message it receives
from the layer just above it and passes the whole package to the layer just below it.
This information is added in the form of headers or trailers (control data appended to
the beginning or end of a data parcel).
• Headers are added to the message at layers 6, 5, 4, 3, and 2. X trailer is added at
layer 2.
• Headers are added to the data at layers 6, 5, 4, 3, and 2. Trailers are usually added only
at layer 2. At layer 1 the entire package is converted to a form that can be transferred
to the receiving machine.
• At the receiving machine, the message is unwrapped layer by layer, with each process
receiving and removing the data meant for it.
• For example, layer 2 removes the data meant for it, then passes the rest to layer 3.
Layer 3 removes the data meant for it and passes the rest to layer 4, and so on.
Sender Receiver
L7 data 7 7 L7 data
L7 data H6 6 6 L7 data H6
L6 data H5 5 5 L6 data H5
L5 data H4 4 4 L5 data H4
L4 data H3 3 3 L4 data H3
L3 data H2 2 2 L3 data H2
T2 T2
1 1
0 0101010101101010000010000 0 0101010101101010000010000
Transmission medium
1.57
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
1.58
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
(v) Line Configuration: Physical layer also defines the way in which the devices are
connected to the medium. Two different line configurations are used point to
point configuration and multipoint configuration.
(vi) Physical Topology: The physical topology defines how devices are connected to
form a network. Devices can be connected by using star, ring, mesh, bus etc.
topologies.
(vii)Transmission Mode: Physical layer also defines the way in which the data flows
between the two connected devices. The various transmission modes possible are
simplex, half-duplex and full-duplex.
• The major protocols used by the physical layer include Bluetooth, OTN (Optical
Transport Network), DSL, IEEE.802.11, IEEE.802.3, and so on. Hub, Repeater, Modem,
Cables etc., are physical layer connecting devices.
2. Data Link Layer:
nd
• The 2 layer of the OSI model is the data link layer. The goal of the data link layer is to
provide reliable, efficient communication between adjacent machines connected by a
single communication medium.
• Data link layer sends data frames from the Network layer to the Physical layer. The
data link layer divides the stream of bits received from the network layer to
manageable data units called frames.
• Data link layer is divided into following two sub layers:
(i) Media Access Control (MAC): The MAC sub layer controls the means by which
multiple devices share the same media channel. This includes contention
methods and other media access details. The MAC layer also provides addressing
information for communication between network devices.
(ii) Logical Link Control (LLC): The LLC sub layer establishes and maintains links
between communicating devices. LLC sublayer provides interface between the
media access methods.
• Functions of data link layer are given below:
(i) Framing: Framing provides a way for a sender to transmit a set of bits that are
meaningful to the receiver. Data link layer performs various framing functions
like frame traffic control, frame sequencing, frame delimiting, frame error
checking and so on.
(ii) Physical Addressing: After creating frames, the data link layer adds physical
addresses (MAC address) of sender and/or receiver in the header of each frame.
(iii) Flow Control: Flow control is the traffic regulatory mechanism implemented by a
data link layer that prevents the fast sender from drowning the slow receiver.
1.59
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
(iv) Error Control: It provides the mechanism of error control in which it detects and
retransmits damaged or lost frames. Data link layer also deals with the problem
of duplicate frames, thus providing reliability to the physical layer.
(v) Media Access Management: Data link layer determines when the node "has the
right" to use the physical medium.
(vi) Access Control: When two or more devices are connected to the same link, data
link layer protocols decide which device has control over the link at a given time.
Means data link layer protocols decides which device is going to use the link (for
transmission etc.) at what time.
• The protocols are used by the Data Link Layer includes Point-to-Point Protocol (PPP),
Point-to-Point High-Level Data Link Control (HDLC), Serial Line Internet Protocol
(SLIP), Spanning Tree Protocol (STP,) Address Resolution Protocol (ARP), IEEE.802.3,
ARCNET etc. Switch and Bridge are data link layer connecting devices.
3. Network Layer:
rd
• The 3 layer of the OSI model is the network layer. The network layer is responsible
for the delivery of individual packets from the source host to the destination host.
• When source and destination are from the same network, there is usually no need for
network layer, delivery of packets is handled by data link layer.
• However, if source and destination are from different network, network layer is
responsible for delivery of data packets.
• Functions of network layer are given below:
(i) Logical Addressing: Large numbers of different networks can be combined
together to form bigger networks or internetwork. In order to identify each
device on internetwork uniquely, the network layer defines a logical addressing
scheme, which distinguishes each device uniquely and universally on the
Internet. When source and destination are from different networks, to deliver the
packet logical addresses (IP) are required.
(ii) Routing: When independent networks or links are combined together to create
internet works, multiple routes are possible from source machine to destination
machine. The network layer protocols determine which route or path is best from
source to destination. This function of the network layer is known as routing.
Routes frames among networks.
(iii) Congestion Control: This layer is also responsible for handling the congestion
problem at the node, when there are too many packets stored at the node to be
forwarded to the next node.
(iv) Internetworking: One of the main responsibilities of a network layer is to
provide internetworking between different networks. It provides a logical
connection between different types of network.
1.60
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
(v) Packetizing: The network layer receives the data from the upper layers and
creates its own packets by encapsulating these packets. The process is known as
packetizing. This packetizing is done by Internet Protocol (IP) that defines its own
packet format.
(vi) Fragmentation: Fragmentation means dividing the larger packets into small
fragments. The maximum size for a transportable packet is defined by physical
layer protocol. For this, network layer divides the large packets into fragments so
that they can be easily sent on the physical medium.
• The network layer uses protocols such as Internet Protocol (IP), Internet Protocol
version 4 (IPv4), Internet Protocol version 6 (IPv6), Internet Control Message
Protocol (ICMP), Internet Group Management Protocol (IGMP), Internet Protocol
Security (IPsec), Internetwork Packet Exchange (IPX), Routing Information
Protocol (RIP) etc. Network layer uses networking connecting devices such as routers
and gateway.
4. Transport Layer:
th
• The 4 layer of the OSI model is the transport layer. Transport layer is responsible for
the process to process delivery of the entire message. A process is an application
program running on a host.
• Transport layer ensures that packets are delivered error free, in sequence with no
losses or duplications. Transport layer unpacks, reassembles and sends receipt of
messages at the receiving end.
• Transport layer provides flow control, error handling, and solves transmission
problems. The transport layer is responsible for source-to-destination, (end-to-end)
delivery of the entire message.
• Transport layer provides following two types of services:
(i) In Connection Oriented Transmission the receiving device sends an
acknowledgment, back to the source after a packet or group of packet is received.
This type of transmission is also known as a reliable transport method. Because
connection oriented transmission requires more packets to be sent across the
network, it is considered a slower transmission method.
(ii) In Connectionless Transmission the receiver does not acknowledge receipt of a
packet that the packet arrives just fine. This approach allows for much faster
communication between devices.
• Functions of transport layer are given below:
(i) Service Point Addressing (Port Addressing): The purpose of the transport layer
is to deliver messages from one process running on source machine to another
process running on destination machine. It may be possible that several
1.61
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
1.62
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
1.63
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
• Application layer provides user interfaces and support for services such as e-mail,
remote file access and transfer, shared database management and other types of
distributed information services.
• Functions of application layer are given below:
(i) Network Virtual Terminal: A network virtual terminal is a software version of a
physical terminal and it allows a user to log onto a remote host. The remote host
believes it is communicating with one of its own terminals and allows the user to
log on.
(ii) File Transfer, Access and Management (FTAM): This application allows a user
to access files in a remote host, to retrieve files from a remote host for use in the
local computer and to manage or control files in a remote computer locally.
(iii) Mail Services: This application provides e-mail operations like forwarding and
storage.
(iv) Remote Logins: This layer allows logging into a host which is remote.
(v) Directory Services: This application provides distributed database sources and
access for global information about various objects and services.
• Application layer uses protocols such as Secure Shell (SSH), File Transfer
Protocol (FTP), Trivial File Transfer Protocol (TFTP), Simple Mail Transfer
Protocol (SMTP), Internet Message Access Protocol (IMAP), Reverse Address Resolution
Protocol (RARP), Bootstrap Protocol (BOOTP), Simple Network Management
Protocol (SNMP), Border Gateway Protocol (BGP), Hypertext Transfer Protocol (HTTP)
etc.
• The original TCP/IP protocol suite was defined as four software layers built upon the
hardware. Today, however, TCP/IP is thought of as a five-layer model as shown in
Fig. 1.47.
1.65
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
Transport Transport
Network Network
Physical Physical
Switch Router Switch
LAN LAN
Router
Fig. 1.49: Logical Connection between Layers of the TCP/IP Protocol Suite
• Using logical connections in TCP/IP protocol suite makes it easier for us to think about
the duty of each layer.
• As the Fig. 1.49 shows the duty of the application, transport, and network layers is end-
to-end.
• However, the duty of the data-link and physical layers is hop-to-hop, in which a hop is
a host or router. In other words, the domain of duty of the top three layers is the
internet, and the domain of duty of the two lower layers is the link.
1.66
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
1.67
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
• Any protocol that can take the datagram and carry it through the link suffices for the
network layer. The data-link layer takes a data-gram and encapsulates it in a packet
called a frame.
• Each link-layer protocol may provide a different service. Some link-layer protocols
provide complete error detection and correction, some provide only error correction.
• Examples of data-link layer protocols are Ethernet, IEEE 802.2 framing and Point-to-
Point Protocol (PPP) framing.
3. Network Layer:
• The network layer in TCP/IP protocol suite is responsible for creating a connection
between the source computer and the destination computer. The communication at
the network layer is host-to-host.
• However, since there can be several routers from the source to the destination, the
routers in the path are responsible for choosing the best route for each packet.
• The network layer is responsible for host-to-host communication and routing the
packet through possible routes.
• The network layer in the Internet includes the main protocol Internet Protocol (IP),
that defines the format of the packet, called a datagram at the network layer. IP also
defines the format and the structure of addresses used in network layers.
• IP is also responsible for routing a packet from its source to its destination, which is
achieved by each router forwarding the datagram to the next router in its path.
• IP is a connectionless protocol that provides no flow control, no error control, and no
congestion control services.
• The network layer in TCP/IP protocol suite also has some auxiliary protocols that help
IP in its delivery and routing tasks. Some of them are:
(i) The Internet Control Message Protocol (ICMP) helps IP to report some
problems when routing a packet.
(ii) The Internet Group Management Protocol (IGMP) helps IP in multitasking.
(iii) The Dynamic Host Configuration Protocol (DHCP) helps IP to get the network-
layer address for a host.
(iv) The Address Resolution Protocol (ARP) helps IP to find the link-layer address of
a host or a router when its network-layer address is given.
4. Transport Layer:
• The logical connection at the transport layer in TCP/IP protocol suite is also end-to-end.
The transport layer at the source host gets the message from the application layer,
encapsulates it in a transport-layer packet (called a segment or a user datagram in
different protocols) and sends it, through the logical (imaginary) connection, to the
transport layer at the destination host.
1.68
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
• In other words, the transport layer in TCP/IP protocol suite is responsible for giving
services to the application layer, to get a message from an application program
running on the source host and deliver it to the corresponding application program on
the destination host.
• There are a few transport layer protocols in the Internet, each designed for some
specific task. The main protocol of transport layer is Transmission Control Protocol
(TCP).
• TCP is a connection-oriented protocol that first establishes a logical connection
between transport layers at two hosts before transferring data. TCP creates a logical
pipe between two TCPs for transferring a stream of bytes.
• TCP provides flow control (matching the sending data rate of the source host with the
receiving data rate of the destination host to prevent overwhelming the destination),
error control (to guarantee that the segments arrive at the destination without error
and resending the corrupted ones), and congestion control to reduce the loss of
segments due to congestion in the network.
• The other common transport layer protocol is User Datagram Protocol (UDP), UDP is a
connectionless protocol that transmits user datagrams without first creating a logical
connection.
• In UDP, each user datagram is an independent entity without being related to the
previous or the next one (the meaning of the term connectionless).
• UDP is a simple protocol that does not provide flow, error, or congestion control. UDP’s
simplicity, which means small overhead, is attractive to an application program that
needs to send short messages and cannot afford the retransmission of the packets
involved in TCP, when a packet is corrupted or lost.
• A new protocol, Stream Control Transmission Protocol (SCTP) is designed to respond to
new applications that are emerging in the multimedia.
5. Application Layer:
• Fig. 1.49 shows the logical connection between the two application layers is end-to-
end. The two application layers’ exchange messages between each other as though
there were a bridge between the two layers. However, we should know that the
communication is done through all the layers.
• Communication at the application layer is between two processes (two programs
running at this layer). To communicate, a process sends a request to the other process
and receives a response.
• Process-to-process communication is the duty of the application layer. The application
layer in the Internet includes many predefined protocols, but a user can also create a
pair of processes to be run at the two hosts.
1.69
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
• The HyperText Transfer Protocol (HTTP) is a vehicle for accessing the World Wide
Web (WWW or Web). The Simple Mail Transfer Protocol (SMTP) is the main protocol
used in electronic mail (e-mail) service.
• The File Transfer Protocol (FTP) is used for transferring files from one host to another.
The Terminal Network (TELNET) and Secure Shell (SSH) are used for accessing a site
remotely.
• The Simple Network Management Protocol (SNMP) is used by an administrator to
manage the Internet at global and local levels.
• The Domain Name System (DNS) is used by other protocols to find the network-layer
address of a computer. The Internet Group Management Protocol (IGMP) is used to
collect membership in a group.
1.4.3 Comparison of OSI and TCP/IP Models (Oct. 17, 18; April 18, 19)
Sr.
OSI Reference Model TCP/IP Model
No.
1. OSI refers to Open Systems TCP refers to Transmission Control
Interconnection. Protocol/ Internet Protocol.
2. OSI model had Seven (7) layers. TCP/IP model has five (5) layers.
3. OSI is less reliable. TCP/IP is more reliable.
4. Developed by ISO (International Developed by the Department of Defense
Standard Organization). (DoD).
5. OSI is a conceptual model. TCP/IP is a client-server model, i.e. when
the client requests for service it is provided
by the server.
6. Protocol independent standard. Protocol dependent standard.
7. OSI follows a horizontal approach. TCP/IP follows a vertical approach.
8. OSI model follows a bottom-up TCP/IP follows a top-bottom approach.
approach.
9. In the OSI model, model was In the TCP/IP model, protocol were
developed before the development developed first and then the model was
of protocols. developed.
10. Model describes any type of Model only describes TCP/IP which is not
network. useful for describing any other networks.
1.70
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
Application
Session
Fig. 1.51: Comparison Diagram for ISO-OSI and TCP/IP Network Reference/Models
• Computer network connecting devices are physical devices which are required for
communication and interaction between devices on a computer network.
• The network devices are playing an important role in network communication, each
device has a different role.
Network Connecting Devices for OSI Model:
• Fig. 1.52 shows positions of network devices in OSI model.
1.71
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
receives signal from the source, amplifies it and sends it to multiple destinations or
computers.
2. Switch: It is used in to send data point to point, meaning directly from one
computer to another through a switch. Network switch is a small hardware device
that joins multiple computers together within one Local Area Network
(LAN). Network switches operate at layer two (Data Link Layer) of the OSI
model. A network switch can be defined as the device that connects the network
devices or network segments. Switches available with 4, 8, 12, 24, 48, 64 ports.
3. Repeater: The repeaters are used in places where amplification of input signal is
necessary. A repeater (or regenerator) is an electronic device that operates on a
physical layer of the OSI model. A repeater is an electronic device that receives
a signal and retransmits it. Repeaters are used to extend transmissions so that the
signal can cover longer distances.
4. Router: A router is a networking device that forwards data packets between
computer networks. Routers perform the traffic directing functions on the
Internet. A router operates in the Network, Data link, and Physical layers of the
OSI model.
5. Gateway: Needed when two different network technologies are being used.
Gateway acts as translator switch-intelligent device which sends data to a
particular port. Gateway works on all seven (7) layers of the OSI model. Gateway is
a network device used to connect two or more dissimilar networks. In networking
parlance, networks that use different protocols are dissimilar networks.
6. Bridge: A network bridge is a computer networking device that creates a single
aggregate network from multiple communication networks or network segments.
This function is called network bridging. Bridging is distinct from routing. Routing
allows multiple networks to communicate independently and yet remain separate,
whereas bridging connects two separate networks as if they were a single
network. It works at the Data Link layer of the OSI Model and connects the
different networks together and develops communication between them. If one or
more segments of the bridged network are wireless, the device is known as
a wireless bridge.
7. Modem: Modem is a device that enables a computer to send or receive data over
telephone or cable lines. The modem works at the Physical Layer of the OSI model.
The main function of the modem is to convert digital signals into analog and vice
versa. Modem is a combination of two devices − modulator and demodulator.
The modulator converts digital data into analog data when the data is being sent
by the computer. The demodulator converts analog data signals into digital data
when it is being received by the computer.
1.72
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
PRACTICE QUESTIONS
Q.I Multiple Choice Questions:
1. Which is refers to the exchange of data between two devices through some form of
wired or wireless transmission media?
(a) Data communication (b) Networking
(c) Data transfer (d) None of these
2. Which is an interconnection of computers and computing equipment using either
wires or ratio waves and can share data and computing resources?
(a) Data Communication (b) Computer Network
(c) Data Transmission (d) None of these
3. Which means the transfer of information between humans, computers or
machines in a meaningful way?
(a) Communication (b) Networking
(c) Data exchange (d) None of these
4. A network of networks is called an ______.
(a) Internetwork (b) Internet
(c) Both (a) and (b) (d) None of these
5. Components of data communication includes ______.
(a) Sender and Message (b) Protocol and Receiver
(c) Transmission Medium (d) All of these
6. Which plays an important role in networking?
(a) Data (b) Protocol
(c) Message (d) All of these
7. Data can be represented as ______.
(a) Text and Numbers (b) Audio and Video
(c) Images/Graphics (d) All of these
1.73
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
8. In which mode, the communication can take place in both directions, but only in
one direction at a time.
(a) Simplex (b) Full-duplex
(c) Half-duplex (d) All of these
9. Which is an interconnected collection of autonomous computers?
(a) Protocol (b) Network
(c) Communication (d) All of these
10. Network criteria includes ______.
(a) Performance (b) Reliability
(c) Type of communication media (d) All of these
11. Connection between two directly interconnected devices/nodes is referred to as
______ connection.
(a) Multipoint (b) Point-to-point
(c) Broadcast (d) All of these
12. Which refers to the way in which a network is laid out physically?
(a) Protocol (b) Message
(c) Topology (d) None of these
13. In which topology all nodes are connected to a central cable?
(a) Star (b) Bus
(c) Topology (d) None of these
14. Which is a privately-owned network covering a small geographical area, (less than
1 km) like a home, office etc.
(a) WAN (b) MAN
(c) LAN (d) All of these
15. Which is a combination of several point-to-point WANs that are connected by
switches.
(a) Point-to-point WAN (b) Switched WAN
(c) Multipoint MAN (d) All of these
16. A ______ needs to forward data from a network to another network when required.
(a) Switch (b) Hub
(c) Gateway (d) Router
17. In which network, a dedicated connection, (called a circuit) is always available
between the two end systems.
(a) Packet switched (b) Message switched
(c) Circuit switched (d) None of these
1.74
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
18. Which is the global system of interconnected computer networks that uses
the Internet protocol suite (TCP/IP) to communicate between networks and
devices.
(a) Internet (b) LAN
(c) WAN (d) MAN
19. Internet access is done by ______.
(a) Dial-up service (b) DSL Service
(c) Cable modem (d) All of these
20. Which is a conceptual layout in networking that describes how communication
between devices should occur.
(a) Reference model (b) Network model
(c) Both (a) and (b) (d) All of these
21. How many layers contains OSI model?
(a) 4 (b) 7
(c) 5 (d) 6
22. Design issues of the layer includes ______.
(a) Addressing and Routing (b) Error and Flow control
(c) Security and Scalability (d) All of these
23. How many layers contains TCP/IP model?
(a) 4 (b) 7
(c) 5 (d) 6
24. A ______ operates in the Network, Data link, and Physical layers of the OSI model.
(a) Hub (b) Router
(c) Switch (d) Repeater
ANSWERS
1. (a) 2. (b) 3. (a) 4. (c) 5. (d) 6. (a) 7. (d)
8. (c) 9. (b) 10.(d) 11. (b) 12. (c) 13. (b) 14. (c)
15. (b) 16. (a) 17. (c) 18. (a) 19. (d) 20. (c) 21. (b)
22. (d) 23. (c) 24. (b)
Q. II Fill in the Blanks:
1. A system of interconnected computers and computerized peripherals such as
printers is called computer ______.
2. ______ is the process of establishing connection or link between two entities for the
transfer/exchange of information.
1.75
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
25. The ______ is the conceptual model and set of communications protocols used on
the Internet and similar computer networks.
ANSWERS
1. Network 2. Communication 3. Networking 4. Software
5. Data 6. Information 7. Message 8. Protocol
9. Full-duplex 10. Internet 11. Architecture 12. Communication
13. Point-to-point 14. Star 15. Ring 16. LANs
17. MAN 18. Connection 19. Internetworks 20. Internet Service
Provider (ISP)
21. Telephone 22. Dial-up 23. Layered 24. OSI
25. TCP/IP
Q. III State True or False:
1. The process of sending or receiving data between two points/entities of a computer
networks is known as data communication.
2. A network is a set of devices (sometimes called nodes or stations) interconnected
by media links.
3. A data communication network is a collection of two or more computing devices
that are interconnected to enable them to share data.
4. A computer network is a set of electronically connected computers which can
share information and resources among themselves.
5. The hardware consists of the physical equipment that carries signals from one
point to the network to another.
6. A computer network is an interconnection of computers and computing
equipment using either wires or radio waves over small or large geographic area.
7. The term topology refers to the way a network is laid out, either physically or
logically.
8. Internet is computer based global information system which composed with
number of interconnected computer networks.
9. A data communication system has five components namely sender, message,
receiver, transmission medium, and protocol.
10. In reference model a layer is a grouping of related tasks involving the transfer of
information.
11. In full-duplex mode, the communication can take place in only one direction.
12. Computer network is divided in to wired and wireless network.
13. In point-to-point connection, a single link is shared by multiple devices.
1.77
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
14. In a mesh network topology, each of the network node, computer and other
devices, are interconnected with one another with dedicated point to point link.
15. A WAN is a geographically-dispersed collection of LANs.
16. The switched WAN connects the end systems.
17. An internetwork is a collection of individual networks, connected by intermediate
networking devices, that functions as a single large network.
18. In a computer network, the communication between the two ends is done in
blocks of data known as packets.
19. The Internet is the global system of interconnected computer networks that uses
the Internet protocol suite (TCP/IP) to communicate between networks and
devices.
20. A cable modem can be added to or integrated with a set-top box that provides the
TV set for Internet access.
21. The entities comprising the corresponding layers on different machines are called
peers.
22. A network consists of a series of levels called layers.
23. TCP/IP stands for Transmission Control Protocol/Internet Protocol.
24. Connection-oriented service is modeled after the postal system. In this type of
services, no connection is established between source and destination.
25. The seven layers of OSI model are physical layer, data link layer, network layer,
transport layer, session layer, presentation layer and application layer.
26. TCP/IP protocol suite also called as Internet protocol suite.
27. The original TCP/IP protocol suite was defined as four software layers built upon
the hardware. Today, however, TCP/IP is thought of as a five-layer model.
28. Data in networking can be available in the form of text, number, images, audio
and video.
29. Internet is a world-wide global system of interconnected computer networks.
30. Networking hardware is designed to help set up, manage, and/or monitor
computer networks.
ANSWERS
1. (T) 2. (T) 3. (T) 4. (T) 5. (T) 6. (T)
7. (T) 8. (T) 9. (T) 10. (T) 11. (F) 12. (T)
13. (F) 14. (T) 15. (T) 16. (T) 17. (T) 18. (T)
19. (T) 20. (T) 21. (T) 22. (T) 23. (T) 24. (F)
25. (T) 26. (T) 27. (T) 28. (T) 29. (T) 30. (F)
1.78
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
(iii) Mesh
(iv) Star
(v) Ring.
9. Compare LAN, MAN and WAN.
10. Explain point-to-point WAN and switched WAN with diagram.
11. What is circuit switched network? Explain in detail.
12. Define internet? Enlist ways for accessing internet.
13. Explain protocol hierarchies in detail.
14. Describe design issues of layers in detail.
15. With the help of diagram describe connection-oriented and connection-less
services.
16. Describe OSI model with its layers. Also explain functions of each layer.
17. Explain TCP/IP OSI model with its layers. Also explain functions of each layer.
18. Differentiate between OSI and TCP/IP models.
April 2017
1. Define protocol with its key elements. [1 M]
Ans. Refer to Section 1.1.2, Point (4).
2. Define mesh topology. [1 M]
Ans. Refer to Section 1.2.4.2.4.
3. Which devices operate at physical layer? [1 M]
Ans. Refer to Section 1.4.4.
4. State the difference between LAN and WAN. [5 M]
Ans. Refer to Page No. 1.29 and 1.30.
5. What are the responsibilities of session and presentation layer? [5 M]
Ans. Refer to Section 1.4.1.2, Points (5) and (6).
1.80
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
October 2017
1. List two similarities between TCP/IP and OSI model. [1 M]
Ans. Refer to Section 1.4.3.
2. For n devices in a network, what is the number of cables required for ring
topology? [1 M]
Ans. Refer to Section 1.2.4.2.3.
3. Explain the OSI reference model in detail. [5 M]
Ans. Refer to Section 1.4.1.
4. Write in detail about simplex, half duplex and full duplex data communication. [5 M]
Ans. Refer to Section 1.1.4.
April 2018
1. Write any two advantages of star topology. [1 M]
Ans. Refer to Section 1.2.4.2.1.
2. What is the responsibility of physical layer. [1 M]
Ans. Refer to Section 1.4.1.2, Point (1).
3. Give the diagrammatic representation of mesh topology. [1 M]
Ans. Refer to Sections 1.2.4.2.4.
4. What is topology? Explain the ring topology with advantages and
disadvantages. [5 M]
Ans. Refer to Sections 1.2.4.2 and 1.2.4.2.3.
5. Compare and contrast OSI and TCP/IP model. [5 M]
Ans. Refer to Section 1.4.3.
October 2018
1. Define protocols. What are its key elements? [1 M]
Ans. Refer to Section 1.1.2, Point (4).
2. Which topology requires a multipoint connection? [1 M]
Ans. Refer to Section 1.2.4.2.
3. Which device operates in physical layer? [1 M]
Ans. Refer to Section 1.4.4.
4. Explain similarities and differences between OSI and TCP/IP reference
models. [5 M]
Ans. Refer to Section 1.4.3.
1.81
Computer Networks – I (S.Y.B.Sc. Comp. Science) Introduction to Networks & Network Models
April 2019
1. Write disadvantages of star topology. [1 M]
Ans. Refer to Section 1.2.4.2.1.
2. List any four application layer protocols. [1 M]
Ans. Refer to Section 1.4.1.2, Point (7).
3. What is computer network? [1 M]
Ans. Refer to Section 1.2.1.
4. Compare and contrast OSI and TCP/IP model. [5 M]
Ans. Refer to Section 1.4.3.
5. State advantages and disadvantages of mesh topology. [2 M]
Ans. Refer to Section 1.2.4.2.4.
❖❖❖
1.82
CHAPTER
2
Lower Layers
Objectives…
To understand Lower Layers (Physical and Data Link)
To learn Design Issues and Services of Data Link Layer
To study Framing Methods Channel Allocation Problem with its Methods
To understand Switching and its various Techniques
To study Wired LAN and Wireless LAN
• The physical layer (layer 1) and data link layer (layer 2) are the lower layers of the OSI
model. The physical layer defines the physical characteristics and functions of the
physical devices and interfaces so that transmission can occur.
• The data link layer is responsible for the reliable transfer of data frames from one
node to another connected by the physical layer.
• The physical layer is concerned with transmission of raw bits over a communication
channel/medium.
• The physical layer specifies the mechanical, electrical and procedural network
interface specifications and the physical transmission of bit streams over a
transmission medium connecting two pieces of communication equipment.
• To be transmitted, data must be transformed to electromagnetic signals. It is the layer
which actually interacts with transmission media, which connects network
components together.
• The physical layer provides services to the data link layer. The data in the data link
layer is organized in 0’s and 1’s in smaller frames. These streams of 0’s and 1’s must be
converted into signals. Physical layer does that.
• The data link layer is the second lower layer in the OSI model, above the physical
layer, which ensures that the error free data is transferred between the adjacent
nodes in the network.
2.1
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• It is also the job of the physical layer to retrieve these individual signals from the
media, restore them to their bit representations, and pass the bits up to the data link
layer as a complete frame.
• The OSI physical layer provides the means to transport across the network media the
bits that make up a data link layer frame.
• The physical layer accepts a complete frame from the data link layer and encodes it as
a series of signals that are transmitted onto the local media.
• In data communication, a very important consideration is how fast we can send data,
in bits per second, over a channel. Data rate depends upon:
1. The bandwidth available,
2. The level of the signals we use, and
3. The quality of the channel (the level of noise).
• The maximum rate at which data can be correctly communicated over a channel in
presence of noise and distortion is known as its channel capacity.
• Two formulas were developed to calculate the data rate: one by Nyquist for a noiseless
channel, another by Shannon for a noisy channel.
Nyquist Bit Rate Formula for Noiseless Channel:
• For a noiseless channel, the Nyquist bit rate formula defines the theoretical maximum
bit rate.
Bit rate = 2 × bandwidth × log2L
• Bandwidth is the bandwidth of the channel. L is the number of signal levels used to
represent data. Bit rate is the bit rate in bits per second.
• Practically, there is a limit on bit rate. Increasing the levels of a signal may reduce the
reliability of the system.
Example 1: Consider a noiseless channel with a band width of 4000 Hz transmitting a
signal with two signal levels. What will be the maximum bit rate?
Solution:
Bit Rate = 2 × bandwidth × log2 L
= 2 × 4000 × log22
= 8000 bps.
Example 2: We need to send 265 kbps over a noiseless channel with a bandwidth of 20
kHz. How many signal levels do we need?
Solution:
Bit Rate = 2 × bandwidth × log2L
265,000 = 2 × 20,000 × log2L
Log2L = 6.625
6.625
L =2
L = 98.7 levels
Example 3: Let us consider the telephone channel having bandwidth B = 4 kHz.
Assuming there is no noise, determine channel capacity for the encoding levels-128.
2.4
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
Solution:
Bit Rate = 2 × bandwidth × log2L
= 2 × 4000 × log2128
= 8000 × 7 = 56 Kbits/s
Shannon’s Law for Noisy Channel: (Oct. 17)
• In reality, we cannot have a noiseless channel, the channel is always noisy. When
there is noise present in the medium, the limitations of both bandwidth and noise
must be considered.
• A noise spike may cause a given level to be interpreted as a signal of greater level, if it
is in positive phase or a smaller level, if it is negative phase. Noise becomes more
problematic as the number of levels increases.
• In 1994, Shannon introduced a formula, called Shannon capacity, to determine the
theoretical highest data rate for noisy channels.
Capacity = Bandwidth × Log2 (1 + SNR)
• Bandwidth is bandwidth of the channel. SNR is signal to noise ratio; capacity is the
capacity of the channel in bits per second.
• Signal to noise ratio (SNR) is calculated as,
Average signal power
SNR = Average noise power
Example 4: Calculate the theoretical highest bit rate of a regular telephone line. A
telephone line normally has a bandwidth of 3000 Hz assigned for data communication.
The signal to noise ratio is usually 3162. Calculate the capacity.
Solution: C = B log2 (1 + SNR)
= 3000 log2 (1 + 3162)
= 3000 log2 3163
= 3000 × 11.62
Capacity = 341860 bps
Example 5: The digital signal is to be designed to permit 160 kbps for a bandwidth of
20 KHz. Determine (a) number of levels and (b) S/N ratio.
Solution:
(a) Apply Nyquist Bit Rate to determine number of levels.
C = 2B log2(L),
3 3
160 × 10 = 2 × 20 × 10 log2(L)
log2(L) = 4
4
L = 2 , which means 4bits/baud.
2.5
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
2.1.2.1 Bandwidth
• In computer networks, the term bandwidth refers to the speed of data transmissions.
It is a measure of the data that can be transmitted from one point to another in a given
amount of time.
• To measure network performance, the one characteristic is bandwidth. In networking,
we use the term bandwidth in two contexts with following two different measuring
values:
1. Bandwidth in Hertz (Hz): Bandwidth in hertz refers to the range of frequencies in
a composite signal or the range of frequencies that the channel can pass. For
example, the bandwidth of a subscriber telephone line is 4kHz.
2. Bandwidth in bits per second (bps): Bandwidth in bits per second refers to the
speed of bit transmission in a channel or link. For example, the bandwidth of a
Fast Ethernet network or the links is a maximum of 100 Mbps means this network
can send 100 Mbps.
• There is an explicit relationship between in hertz and bandwidth in bits per seconds.
An increase in bandwidth in hertz means an increase in bandwidth in bits per second.
2.1.2.2 Throughput
• The throughput is a measure of how fast we can actually send data through a network.
Throughput is the rate of successful message delivery over a communication
channel/medium.
• Bandwidth in bits per second and throughput seems to be the same, but they are
different. Throughput is controlled by available bandwidth.
• A link may have bandwidth of B bps, but we can only send T bps through this link with
T always less than B. Bandwidth is a potential measurement of a link and throughput
is an actual measurement of how fast we can send data.
• Consider a highway designed to transmit 1000 cars per minute from one point to
another. However, if there is congestion on the road, this can be reduced to 200 cars
per minute. So bandwidth is 1000 cars per minute and throughput is 200 cars per
minute.
Example 8: A network with bandwidth of 10 Mbps can pass only an average of 12,000
frames per minute with each frame carrying an average of 10,000 bits. What is the
throughput of this network?
Solution: Throughput is the amount of data moved successfully from one place to
another place. That is 12,000 frames per minute and each Frame is carrying 10,000 bits.
2.7
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
12,000 × 10,000
Throughput = 60
= 2 × 1000000 bits/seconds
= 2Mbps
• The latency or delay defines how long it takes for an entire message to completely
arrive at the destination from the time the first bit is sent out from the source.
• Latency is the time it takes for a packet to get across the network, from source to
destination.
Latency = Propagation time + Transmission time + Queuing time + Processing delay
Propagation Time:
• Propagation time measures the time required for a bit to travel from the source to
destination.
Distance between Two Points
Propagation time = Propagation speed
Example 9: What is the propagation time if the distance between the two points is
8
12,000 km? Assume the propagation speed to be 2.4 × 10 m/s in cable.
Solution: We calculate the propagation time as,
12,000 × 1000
Propagation time = 2.4 × 108
= 50 ms
Transmission Time:
• In data communication, a message containing bits is sent. The first bit may take a time
equal to the propagation time to reach its destination; the last bit also may take the
same amount of time.
• However, there is a time between the first bit leaving the sender and the last bit
arriving at the receiver. The first bit leaves earlier and arrives earlier, the last bit
leaves later and arrives later. The time required for transmission of a message
depends on the size of the message and the bandwidth of the channel.
Message size
Transmission time = Bandwidth
Example 10: What is the propagation time for a 2.5 Kbyte message if the bandwidth of
the network is 1Gbps? Assume that the distance between the sender and the receiver is
8
12,000 km and that light travels at 2.4 × 10 m/s.
2.8
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
12000 × 1000
Solution: Propagation time = 2.4 × 10
8 = 50 ms
2500 × 8
Transmission Time = 10
9 = 0.020 ms
Queuing Time:
• The third component in latency is the queuing time, the time needed for each
intermediate or end device to hold the message before it can be processed.
• The queuing time is not fixed; it depends upon the load on the network. When there is
heavy traffic on the network, the queuing time increases.
2.1.2.4 Bandwidth-Delay Product
• By bandwidth and delay, we measure the performance of a network. In data
communication, the product of bandwidth and delay is very important.
• The bandwidth-delay product defines the number of bits that can fill the network link.
It gives the maximum amount of data that can be transmitted by the sender at a given
time before waiting for acknowledgment.
• Let us elaborate this issue, using two hypothetical cases as examples.
Case 1:
• Let us consider that we have a link with a bandwidth of 1bps and the delay of the link
is 5s. From the Fig. 2.3 we can say that the bandwidth delay product is 1 × 5, which is
the maximum number of bits that can fill the link. There can be no more than 5 bits at
any time on the link.
• The above two cases show that the product of bandwidth and delay is the number of
bits that can fill the link.
2.1.2.5 Jitter
• Another performance issue that is related to delay is jitter. Jitter is the variance in time
delay in milliseconds (ms) between data packets over a network. It is a disruption in
the normal sequence of sending data packets.
• In technical terms, jitter is a “packet delay variance”. The jitter is considered as a
problem when different packets of data face different delays in a network and the
data at the receiver application is time-sensitive, i.e. audio or video data.
• If real-time data (audio/video) on a packet switched network requires the preservation
of the time relationship between packets of a session.
• For example, consider a server sending 3 packets to a client. Every packet contains 10
sec video information.
• The first packet starts at 00.00.00, the second at 00.00.10 and the third at 00.00.20. Also
consider 1s is required for every packet to reach upto destination. The receiver can
play the first packet at 00:00:01, the second at 00:00:11 and the third at 00:00:21.
• Fig. 2.5 shows this idea.
2.10
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• But if the first packet arrives at 00:00:01 (1s delay), the second arrives at 00:00:15 (5s
delay), and the third arrives at 00:00:27 (7s delay) the receiver is not able to play
packets.
• After playing the first packet, he has to wait for the second. There is a gap between the
first and second packets and between second and third as the video is viewed at the
remote site.
• This concept is called jitter and shown in Fig. 2.6.
2.11
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• Data link layer transforms the physical layer, a raw transmission facility to a reliable
link. It is responsible for moving frames from one hop (node) to the next i.e. hop-to-
hop delivery.
• The data link layer takes services from the Physical layer and gives services to the
network layer. Framing is a function of the data link layer. It provides a way for a
sender to transmit a set of bits that are meaningful to the receiver.
• Data link layer provides the mechanism of error control in which it detects and
retransmits damaged or lost frames.
• The data link layer converts the raw transmission facility provided by the physical
layer to a reliable and error-free link.
• The flow control function of data link layer coordinates that amount of data that can
be sent before receiving acknowledgement.
• The data link layer also supports access control function. When a single
communication channel is shared by multiple devices, the MAC sub-layer of the data
link layer helps to determine which device has control over the channel at a given
time.
• Data link layer has two sub-layers:
1. Logical Link Control (LLC): It deals with protocols, flow-control, and error
control
2. Media Access Control (MAC): It deals with actual control of media.
2.12
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• The following are the some of the important design issues of the data link layer:
1. Services provided to the Network Layer: The data link layer acts as a service
interface to the network layer. How to provide a well-defined service interface in
the network layer on source machine to the network layer on destination machine.
2. Frame Synchronization/Framing: Frame synchronization is the major issue of
data link layer. The source machine sends data in blocks called frames to be the
destination machine. The starting and ending of each frame should be identified so
that the frame can be recognized by the destination machine. This design issue
determines how the bits of the physical layer are grouped into frames.
3. Flow Control: It deals with how to regulate the flow of frames so that slow
receivers are not swamped by fast senders.
4. Error Control: This design issue deals with transmission errors. It must provide
an error control mechanism to detect and retransmit damaged, duplicate, or lost
frames from source to destination.
2.2.2 Services
• Data link layer provides several services to the network layer. The one of the major
services provided is transferring the data from the network layer on the source
machine to the network layer on the destination machine.
• The source machine data link layer receives the data from the network layer and the
destination machine passes on this data to the network layer as shown in Fig. 2.7.
Fig. 2.7
2.13
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• The path shown in Fig. 2.7 (a) is the virtual path. But the actual path is Network layer
-> Data link layer -> Physical layer on source machine, then to physical media and
thereafter physical layer -> Data link layer -> Network layer on destination machine.
• The data link layer services differ from system to system. The three main services are
Unacknowledged connectionless service, Acknowledged connectionless service and
Acknowledged connection oriented service.
1. Unacknowledged Connectionless Service:
• In this service, the sender machine sends the frames to the destination machine
without having the destination machine acknowledge them.
• No logical connection is established between sender and receiver beforehand. If the
frame is lost, no attempt is made to detect the loss or recover from it in the data link
layer.
• This is best suited when the error rate is very low, so the error recovery is left to
higher layers. It is best suited for real-time traffic, in which late data is worse than bad
data.
• Most LAN uses unacknowledged connectionless service.
2. Acknowledged Connectionless Service:
• In this service, no logical connection is used, but each frame sent is individually
acknowledged.
• Sender knows each frame has reached safety or not. In case of any error, it can be sent
again.
• This is used for unreliable channels, such as wireless systems.
3. Acknowledged Connection Oriented Service:
• Here, source and destination machines establish a connection before any data is
transferred. Each frame sent in a numbered and data link layer guarantees that each
frame sent is received.
• It also guarantees that each frame is received exactly once and that all frames are
received in the right order. Connection oriented service provides a reliable bit stream.
• Connection-oriented has three distinct phases:
(i) The connection is established when some initialization takes place.
(ii) The actual transmission of one and more frames.
(iii) The connection is released freeing the variables, buffers and other resources.
• Framing is an important function of the data link layer. Group of physical layer bits
stream into units (messages) called frames. Breaking the bit stream into frames is
called framing.
2.14
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• Data link layer is intermediate between the network layer and the physical layer. So
the data link layer must use the services provided by the physical layer.
• Physical layer accepts raw bit stream which is not guaranteed to be error free, and
attempts it to deliver it to destination.
• So it is the responsibility of the data link layer to detect errors such as the number of
bits received may be less or contain different values etc.
• The data link layer breaks the bit stream into the frames and computes checksum for
each frame. When frame comes at destination, the checksum is recomputed, if it is
different an error has occurred and it will be corrected.
• One method to achieve this framing is to insert time gaps between frames. But this
method is not useful because networks rarely male any guarantees about timings, so
these gaps might be squeezed or other gaps might be inserted during transmission. So
other methods have been devised.
• A frame is "the unit of transmission in a link layer protocol, and consists of a link layer
header followed by a packet.
• Framing in the data link layer separates a message from one source to a destination by
adding a sender address and a destination address.
• The destination address defines where the packet is to go; the sender address helps the
recipient acknowledge the receipt.
Sending machine Receiving machine
Packet Packet
Frame
Fig. 2.8
• At the data link layer, it extracts messages from sender and provides it to receiver by
providing sender’s and receiver’s address.
• The advantage of using frames is that data is broken up into recoverable chunks that
can easily be checked for corruption.
Parts of a Frame:
• A frame has the following parts, (See Fig. 2.9):
1. Frame Header: It contains the source and the destination addresses of the frame.
2. Payload Field: It contains the message to be delivered.
2.15
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• Consider a situation, the sender is running on a fast computer (or lightly loaded) and
the receiver is running on a slow (or heavily loaded) computer.
• The sender keeps on sending the frames at high speed, but the receiver is not able to
accept it.
• After some time, the receiver is totally swamped out. Even though the transmission
line is error free, at a certain point the receiver will be unable to handle frames and
start losing them.
• To prevent such types of situations flow control mechanisms are used by the data link
layers.
• Flow control is a technique for ensuring that a transmitting entity does not flood the
receiving entity with data.
• The data link layer regulates flow control so that a fast sender does not drown a slow
receiver.
• Flow control refers to a set of procedures used to restrict the amount of data the
sender can send before waiting for acknowledgment.
• The two flow control mechanisms are Feedback-based flow control, and Rate-based
flow control.
1. In feedback-based flow control, the receiver sends back information to the
sender giving it permission to send more data or at least telling the sender how the
receiver is doing.
2. In rate-based flow control, the protocol has a built-in mechanism that limits the
rate at which senders may transmit data, without using feedback from the
receiver.
• If any frames are lost or damaged during transmission, the error control mechanism
allows the receiver to inform the sender about it and coordinates the re-transmission
of those frames by the sender.
• The data link layer ensures error free link for data transmission. The issues it caters to
with respect to error control are:
1. Dealing with transmission errors.
2. Sending acknowledgement frames in reliable connections.
3. Retransmitting lost frames.
4. Identifying duplicate frames and deleting them.
5. Setting timer as soon as the frame is sent (if the acknowledgment does not receive
in the specified time, the same frame is retransmitted).
• If the acknowledgment does not reach before the timer runs out there will duplicate
copies of frames at the receiver end.
• To prevent this, generally a sequence number is assigned to outgoing frames. So the
receiver can distinguish the retransmission.
• If the source IP address in a datagram changes, the destination host or a router can
never communicate with the source if a response needs to be sent back or an error
needs to be reported back to the source.
• The above discussion shows that we need another addressing mechanism in a
connectionless internet the link layer addresses of the two nodes.
• A link layer address is sometimes called link address, sometimes a physical layer, and
sometimes a MAC address.
• Since, a link is controlled at the data link layer, the addresses need to belong to the
data link layer.
• When a datagram passes from the network layer to the data link layer, the datagram
will be encapsulated in a frame and two data link addresses are added to the frame
header.
• These two addresses are changed every time the frame moves from one link to
another link.
• The framing methods are Character count, Flag bytes with byte stuffing, Starting and
ending flags, with bit stuffing and Physical layer coding violations.
2.18
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• The problem with this method is the count can be garbled by a transmission error. In
Fig. 2.10 (b), the character 5 in frame 2 becomes 7, so destination frames get out of
synchronization and are unable to locate the start of the next frame. So in case of any
error the entire data has to be retransmitted.
2.3.2 Flag Bytes with Byte Stuffing
• The second framing method is flag byte. It solves the problem of resynchronization.
• Every frame starts and ends with a special bit pattern called a flag byte [011111110].
The flag byte is used as starting and ending delimiter as shown in Fig. 2.11.
Fig. 2.11
• If the receiver loses synchronization, it can just search the FLAG byte to find the end of
the current frame. Two consecutive flag bytes indicate the end of one frame and start
and next frame.
• A problem here comes with the binary data or float point numbers are being
transmitted. One way to solve this, a special ESC byte is inserted just before each
accidental flag byte in the data.
• The data link layer on the receiving end removes the escape byte before the data are
given to the network layer. This is known as byte stuffing or character stuffing.
• A major drawback is it uses 8-bit characters. Not all character codes use 8-bit
characters. Unicode uses 16-bit characters. So, it cannot be used for arbitrary sized
characters.
2.3.3 Starting and Ending Flags with Bit Stuffing (April 16)
• Here, it allows character codes with an arbitrary number of bits per character. Each
frame begins and ends with a special bit pattern, 01111110.
2.19
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• Whenever, the sender's data link layer-encounters a five consecutive 1s in the data, it
automatically stuffs a 0-bit into the outgoing bit stream. So this is a bit stuffing.
• When the receiver sees 5 consecutive 1-bit followed by a 0-bit, it automatically de-
stuffs the 0-bit. If the user data contain the flag pattern, 01111110, this is transmitted
as 011111010 but stored in the receiver's memory as 01111110.
• The Fig. 2.12 shows the bit of stuffing.
Fig. 2.12: (a) Original Data (b) The Data appear on the Line
(c) The Data at Receivers Site
Polling TDMA
CSMA/CA
• CSMA/CA is for collision avoidance which defines a procedure to avoid the collision.
CSMA/CD is for collision detection which defines to be followed if a collision is
detected.
2.24
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
Station 1
Station 2
Frame 3.2
Frame 3.1
Time
Time
Station 4
Fig. 2.15: Frames in Pure ALOHA
• If acknowledgement is not received within specified time, the station assumes that the
frame (or acknowledgement) has been destroyed.
• If the frame is destroyed because of a collision the station waits for a random amount
of time and sends it again. This waiting time must be random otherwise the same
frames will collide again and again.
• Therefore, pure ALOHA dictates that when the time-out period passes, each station
must wait for a random amount of time before resending its frame. This randomness
will help avoid more collisions.
• The pure ALOHA protocol has a second method to prevent congesting the channel
with retransmissions. It is shown in Fig. 2.16.
• A node or station sends the frame. Then wait for a period of time which is 2 times the
maximum propagation delay.
• If the acknowledgement is received, the transmission is successful. If the
acknowledgement is not given, then the station has to use a back-off strategy and send
the packet again. After several tries, if it is not happening then procedure is aborted.
• Vulnerable Time: Vulnerable time is a time in which there is possibility of collision. It
is calculated as,
Pure ALOHA vulnerable time = 2 × Tfr
2.25
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• Throughput: Let G be the average number of frames generated by the system during
one frame transmission time. Then the average number of successful transmissions
for pure ALOHA is S = G × e -2G. The maximum throughput of pure ALOHA is 0.184 i.e.
not more than 18.4 %.
Slotted ALOHA: (April 16; Oct. 17)
• An improvement to the original ALOHA protocol was "Slotted ALOHA", which
introduced discrete time slots and increased the maximum throughput.
• Slotted ALOHA was invented to improve the efficiency of pure ALOHA as chances of
collision in pure ALOHA are very high.
• In slotted ALOHA, the time of the shared channel is divided into discrete intervals
called slots.
• The stations can send a frame only at the beginning of the synchronized time slot and
only one frame is sent in each slot.
• In slotted ALOHA, if any station is not able to place the frame onto the channel at the
beginning of the slot, i.e. it misses the time slot then the station has to wait until the
beginning of the next time slot.
• In slotted ALOHA, there is still a possibility of collision if two stations try to send at the
beginning of the same time slot as shown in Fig. 2.17.
• Slotted ALOHA still has an edge over pure ALOHA as chances of collision are reduced
to one-half. Slotted ALOHA requires global time synchronization.
2.26
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
Collsion Collsion
Duration Duration
Frame 1.1 Frame 1.2
Time
Station 1
Frame 2.2
Frame 2.1
Time
Station 2
Frame 3.1 Frame 3.2
Time
Station 3
2. Carrier Sense Multiple Access (CSMA): (April 17, 18; Oct. 17)
• To minimize the chance of collision and increase the performance, the CSMA method
was developed. The chance of a collision can be reduced if a station senses the
medium before trying to use it.
• Protocols in which stations listen for a carrier and act accordingly are called Carrier
Sense Protocols.
• CSMA is a network access method used on shared network topologies such as Ethernet
to control access to the network.
• Devices attached to the network cable listen (carrier sense) before transmitting. If the
channel is in use, devices wait before transmitting.
• MA (Multiple Access) indicates that many devices can connect to and share the same
network. All devices have equal access to use the network when it is clear.
• Even though devices attempt to sense whether the network is in use, there is a good
chance that two stations will attempt to access it at the same time.
• On large networks, the transmission time between one end of the cable and another is
enough that one station may access the cable even though another has already just
accessed it.
• The chances of collision still exist because of propagation delay. The frame transmitted
by one station takes some time to reach other stations.
• In the meantime, other stations may sense the channel to be idle and transmit their
frames. This results in the collision, as shown in Fig. 2.18.
2.27
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
2 Starts 3 Starts
at time t1 at time t2
1 2 3 4C
t1
t2
Area where
1’S signals exist
Area where
both signals exist
Area where
2’S signals exist
Time Time
Vulnerable Time:
• The vulnerable time for CSMA is the propagation time Tp1, needed for a signal to
propagate from one end of the medium to the other.
• When a station sends a frame, and any other station tries to send, collision occurs. But
if the first bit of the frame reaches the end of the medium, other stations will already
have heard the bit and will stop ourselves from sending.
1 2 C3 4
2 Senses 3 Senses 4 Senses
here here here
t1
Vulnerable time
=
Propagation time
Frame Propagation
Time
2.28
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• There are three different types of CSMA protocols i.e., I-persistent CSMA, Non-
persistent CSMA and P-persistent CSMA as shown in Fig. 2.20.
CSMA
1-persistent CSMA:
• This method is very simple and straightforward. In 1-persistent CSMA method, a
station that wants to transmit data continuously senses the channel to check whether
the channel is idle or busy. If the channel is busy, the station waits until it becomes
idle.
• When the station detects an idle-channel, it immediately transmits the frame with
probability 1. Hence, it is called I-persistent CSMA.
• This method has the highest chance of collision because two or more stations may find
the channels to be idle at the same time and transmit their frames.
• When the collision occurs, the stations wait a random amount of time and start all
over again.
Continuously sense
Channel ?
Time Busy
Idle
idle channel
Busy channel
Station can transmit
2.29
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• Even if propagation delay time is zero, collision will still occur. If two stations become
ready in the middle of the third station's transmission, both stations will wait until the
transmission of the first station ends and then both will begin their transmission
exactly simultaneously. This will also result in collisions.
Non-persistent CSMA:
• In non-persistent CSMA, a station that has a frame to send senses to the channel. If the
channel is idle, it sends immediately.
• If the channel is busy, it waits for a random amount of time and then senses the
channel again.
• In non-persistent CSMA the station does not continuously sense the channel for the
purpose of capturing it when it detects the end of previous transmission.
Busy Wait
Channel ? Randomely
Idle
Sense Sense
Wait Wait
Time
Idle channel
Busy channel
P-persistent CSMA:
• This method is used when a channel has time slots such that the time slot duration is
equal to or greater than the maximum propagation delay time.
• Whenever a station becomes ready to send, it senses the channel. If the channel is
busy, the station waits until the next slot.
• If the channel is idle, it transmits with a probability p. With the probability q=l-p, the
station then waits for the beginning of the next time slot.
• If the next slot is also idle, it either transmits or waits again with probabilities p and q.
This process is repeated till either frame has been transmitted or another station has
begun transmitting.
• In case of the transmission by another station, the station acts as though a collision has
occurred and it waits a random amount of time and starts again.
Probability outcome does
Continuously sense not allow transmission
Transmit
Time
Channel ?
Busy
Idle
Idle
>p Probability
Channel ? Wait a slot
outcome
Busy <=P
2.31
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• If the channel is busy, the station waits. The wastage of channel time problem is
handled in CSMA/CD.
• In CSMA/CD, the station that places its data onto the channel after sensing the channel
continues to sense the channel even after the data transmission.
• If a collision is detected, the station aborts its transmission and waits for a
predetermined amount of time and then sends its data again. As soon as a collision is
detected, the transmitting station releases a jam signal.
• Jam signals will alert the other stations. The stations are not supposed to transmit
immediately after the collision has occurred. Otherwise there is a possibility that the
same frames would collide again.
• After some back-off delay time the stations will retry the transmission. If the collision
occurs again then the back off delay time is increased progressively.
• Therefore, the CSMA/CD method consists of alternating transmission periods and
collisions with idle periods when none of the stations is transmitting.
Collision
Idle period
Frame Frame
Time
Transmission Transmission
period period
1 2 3 4
t1
First bit of 1
Transmission t2
Transmission
time
t3 time
f C
t4 First bit o 3’ s collision
1’ s collision detection
detection Collision and abortion
and abortion occurs
Time
2.32
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
1 2 3 4
Collision
t1 occurs
Transmission t2 Transmission
time Part of 1’s frame t3 time
frame
t4 Part of 3’s
1 detects
collision and
aborts
3 detects
collision and
Time aborts Time
CSMA/CD Procedure:
• Fig. 2.27 shows a flow chart for the CSMA/CD protocol.
Transmission done
Wait TB time Yes
or
(TB =R X or R X Tfr) Collision detected
No
Choose a random
Transmit
number R between
K and Receive
0 and 2 - 1
No
Kmax is Send a Yes Collision
K > Kmax K=K+1
normally 15 jamming signal detected
Yes No
Abort Success
2.33
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
2.34
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
Time
Contention window
Busy Send frame Time out
2.35
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• Fig. 2.30 shows five stations. In the first, reservation frame stations 1, 3 and 4 have
made the reservations.
• So the reservation frame is first followed by data frames of station 1, 3 and 4. In the
second interval, only station 1 has made the reservation.
2. Polling: (April 16, 19)
• In this method, one station is designated as a primary station and others are secondary
stations. All data transfer should be made through the primary device.
• Primary device controls the link and acts as a master. All secondary devices follow its
instructions.
• The primary device decides as to which device is allowed to use the channel. If the
primary station wants to receive data, it asks the secondaries if they have anything to
send. This method is called polling.
• If the primary station wants to send data, it asks the secondary station to receive the
data. This is called selecting.
1. Select: (April 16, 17, 18, 19; Oct. 17, 18)
• This is used when the primary device sends the data. When the primary station wants
to send data to other machines, it should intimate the other secondary device that it is
sending the data.
2.37
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• To do this, the primary machine first sends the SEL frame in which the address of the
machine (secondary machine) to which it wants to send the data is present.
• Then, the primary machine waits for the acknowledgement from that machine. Once
the acknowledgement is reached then the data is sent.
2. Poll:
• Whenever primary wants to receive data then polling is used. It polls each machine, if
it has something to send.
• The secondary response with MAK frame which means nothing to send or with data
frame if it wants to send data.
• If the response from the secondary device is negative i.e. received MAK frame, then
the next machine is polled until it finds one with data to send.
• When the primary machine gets the data, it accepts the data frame and returns the
acknowledgement.
• Fig. 2.31 shows select and poll functions in the polling access method.
A B C A B C
Primary Primary
SEL Poll
ACK
NAK
Select
Data Poll
Poll
ACK
Data
ACK
(a) (b)
(a) Select Function (b) Poll Function
Fig. 2.31
3. Token Passing:
• In this method, a station is allowed to send data when the station receives a special
frame called a token.
• In token passing, the stations are organized in a logical ring. For every station there is
a predecessor and a successor.
• The right to access the channel has been passed from predecessor to the current
station. The right will be passed to the successor when the current station has no more
data to send.
• Fig. 2.32 shows concepts of token passing.
2.38
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
A B C D
• When the channel is idle then the token circulates around the ring. When the station
wants to send data, it waits for a token, when the token comes, the station captures the
token and sends the data. When the machine finishes the data, it releases the token to
the next machine (the successor).
• Token management is needed for this access method. The token must be monitored to
ensure it has not been lost or destroyed.
• The procedure is as shown in Fig. 2.33.
• In TDMA (Time Division Multiple Access), the entire bandwidth is one channel. Each
station is allocated a time slice. During its time slice, the data is sent.
• In CDMA (Code Division Multiple Access), only one channel occupies the entire
bandwidth of the link. All stations can send data simultaneously.
• Here, the channel carries all transmissions simultaneously. Each station is assigned a
code which is a sequence number called chip.
1. FDMA: (April 17, Oct. 18)
• FDMA is a channel access method used in multiple-access protocols as channelization
protocol.
• In FDMA, the available bandwidth is divided into various frequency bands. Each
station is allocated a band to send its data. This band is reserved for that station for all
the time.
• The frequency bands of different stations are separated by small bands of unused
frequency. These unused frequency bands are called guard bands that prevent station
interference.
• FDM is a physical layer technique whereas FDMA is an access method in the data link
layer.
• FDMA is the process of dividing one channel or bandwidth into multiple individual
bands, each for use by a single user.
• Each individual band or channel is wide enough to accommodate the signal spectra of
the transmissions to be propagated.
Data Data
f f
A B
t t
Common
Channel
Data
f f
C D
t t
Silent Data
2.40
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• The data to be transmitted is modulated on to each subcarrier, and all of them are
linearly mixed together.
• The best example of FDMA is the cable television system. Fig. 2.34 shows the FDMA
concept.
2. TDMA:
• TDMA is a channel access method for stored medium networks.
• TDMA stations share the bandwidth of the channel in time. Every station is allocated a
time slot, in which it can send data.
• TDMA is a digital technique that divides a single channel or band into time slots.
• In TDMA every station needs to know the beginning of its slot and the location of its
slot. To compensate for the delays guard spaces are used.
• In TDMA, the bandwidth is just one channel that is time shared between different
stations.
Data Data
f f
A B
t t
Common
Channel
Data
f f
C D
t t
Silent Data
• TDMA and TDM seem to be conceptually the same, but they are different. TDM is a
physical layer technique, whereas TDMA is a Data link layer access method.
• The Data link layer in each station tells its Physical layer to use the allocated time slot.
3. CDMA: (Oct. 17)
• CDMA means communication with different codes. For example, consider a large hall
with many people. Some of them understand only English, some Hindi, some Chinese
etc.
2.41
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• The people communicate with a language, which they understand. The common
channel (hall) allows communication between several people, but in different
languages (codes).
• CDMA is also called spread-spectrum and code division multiplexing, one of the
competing transmission technologies for digital mobile phones.
• The transmitter mixes the packets constituting a message into the digital signal stream
in an order determined by a Pseudo-Random Number (PRN) sequence.
• PRN is also known to the intended receiver, which uses it to extract those parts of the
signal intended for itself. Hence, each different random sequence corresponds to a
separate communication channel.
• Unlike TDMA, in CDMA all stations can transmit data simultaneously, there is no
timesharing. CDMA allows each station to transmit over the entire frequency spectrum
all the time.
• Multiple simultaneous transmissions are separated using coding theory. In CDMA each
user is given a unique code sequence.
• If a network is a LAN, we can have point to point or broadcast links. But for WAN,
such topologies are not possible.
• A better solution is switching. A switched network consists of a series of interlinked
nodes, called switches.
• Switches are devices capable of creating temporary connection between two or more
devices linked to the switch.
• In switched networks, some of these nodes are connected to the end systems
(computers or telephones). Others are used only for routing.
• Fig. 2.36 shows switched network.
• Circuit switching takes place at the physical layer of the TCP/IP reference model.
Circuit switched networks consist of a set of switches connected by physical links.
2.43
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• In a circuit switched network, two nodes communicate with each other over a
dedicated communication path.
• Circuit switching is commonly used technique in telephony, where the caller sends a
special message with the address of the callee (i.e. by dialing a number) to state its
destination.
• Fig. 2.38 shows the concept of circuit switching. In Fig. 2.38, six different rectangles
are shown. Each rectangle represents a carrier switching office (end office, toll office
etc.).
• As an example, we have shown every office has three incoming and three outgoing
lines.
• When a call passes through a switching office, a physical conceptual temporary
connection is established between the line on which the call came in and one of the
output lines, as shown by dotted lines.
• Once a call has been set up, a dedicated path between both ends exists and will
continue to exist until the call is finished.
2.45
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
Advantages:
1. In packet switching, no circuit set up is required in advance.
2. In packet switching, the quality of data transmission is kept high (error free).
3. In packet switching, no bandwidth is reserved.
4. Packet switching is more fault tolerant.
5. Better utilization of the network segments in terms of the usage of the network
path.
6. Efficient for busty data and efficient used network paths.
7. In packet switching, computers at each node allow dynamic data routing.
Disadvantages:
1. In packet switching, different packets can follow different paths, so they may
arrive out of order.
2. If the network becomes overloaded, packets are delayed or discarded or dropped.
This leads to retransmission of lost packets by the sender. This often leads to loss
of critical information if errors are not recovered.
3. Packet switching network cannot be used in applications requiring very little delay
and higher quality of service e.g., reliable voice calls.
4. Protocols used in the packet switching are complex and require high initial
implementation costs.
• The two types of packet switching are Datagram Packet Switching and Virtual Circuit
Packet Switching.
Datagram Packet Switching: (Oct. 18)
• In a datagram network, each packet is routed individually by network devices based
on the destination address contained within each packet.
• Due to each packet is routed individually, the result is that each packet is delivered
out-of-order with different paths of transmission, it depend on the networking devices
like (switches and routers) at any given time.
2.46
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• After reaching the recipient location, the packets are reassembling to the original
form. Datagram packet switching is normally implemented in the network layer. Each
packet carries a header that contains the full information about the destination.
• When the switch receives the packet, the destination address in the header of the
packet is examined; the routing table is consulted to find the corresponding port
through which the packet should be forwarded.
2.48
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
2.49
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
D F
Path of Message 2
Path of Message 1
Fig. 2.42: Message Switching Technique
Advantages:
1. In message switching, no circuit setup is required in advance.
2. As more devices share the same channel simultaneously for message transfer, it
has higher channel efficiency compared to circuit switching.
3. Data rate conversion is possible in message switching.
2.50
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
2.52
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• Today Ethernet is by far the dominant technology. Other technologies survived for a
while. Fig. 2.43 shows an example of four computers connected in a traditional
Ethernet LAN.
2.53
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
2.6.1.1 Characteristics
• Some characteristics of the Standard Ethernet are explained below:
1. Connectionless and Unreliable Service:
• Ethernet provides a connectionless service which means each frame sent is
independent of the previous or next frame.
• Ethernet has no connection establishment or connection termination phases. The
sender sends a frame whenever it has it; the receiver may or may not be ready for it.
2.54
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• The sender may overwhelm the receiver with frames, which may result in dropping
frames. If a frame drops, the sender will not know about it.
• Since IP, which is using the service of Ethernet, is also connectionless, it will not know
about it either. If the transport layer is also a connectionless protocol, such as UDP, the
frame is lost and salvation may only come from the application layer.
• However, if the transport layer is TCP, the sender TCP does not receive
acknowledgement for its segment and sends it again.
2. Unreliable Service:
• Ethernet is also unreliable like IP (Internet Protocol) and UDP (User Datagram
Protocol).
• If a frame is corrupted during data transmission and the receiver finds out about the
corruption, which has a high level of probability of happening because of the CRC-32,
the receiver drops the frame silently. It is the duty of high-level protocols to find out
about it.
3. Frame Format: (April 18; Oct., 18)
• The format of the Ethernet MAC frame is shown in Fig. 2.45, and it contains several
fields.
• Ethernet does not provide any mechanism for acknowledgment of received frames.
Acknowledgments must be implemented at the higher layers.
Physical layer
header
2.55
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
The SFD warns the station or stations that this is the last chance for
synchronization. The last 2 bits is 11 and alerts the receiver that the next field is
the destination address.
(iii) Destination Address (DA): The DA field is of 6 bytes and contains the physical
address of the destination station or stations to receive the packet.
(iv) Source Address (SA): The source address field is also 6 bytes and contains the
physical address of the sender of the packet.
(v) Length or type: This field is defined as a type field or length field. Both uses are
common. The original Ethernet used this field as the type field to define the
upper-layer protocol using the MAC frame. The IEEE standard used it as the
length field to define the number of bytes in the data field.
(vi) Data: This field contains data encapsulated from the upper-layer protocols. Size
of data is minimum of 46 and a maximum of 1500 bytes.
(vii) CRC: This last field contains error detection information.
4. Frame Length:
• Ethernet has forced restrictions about both the minimum and maximum lengths of a
frame, as shown in Fig. 2.46.
Minimum payload length : 46 bytes
Maximum payload length : 1500 bytes
• If we subtract the 18 bytes of header and trailer, the maximum length of the payload is
1500 bytes.
• The maximum length restriction has following two reasons:
(i) Memory was very expensive when Ethernet was designed, this restriction helped
to reduce the size of the buffer.
(ii) The maximum length restriction prevents one station from taking the complete
control of the shared medium, blocking other stations that have data to send.
2.6.2 Addressing
• Every station on an Ethernet network like a PC, workstation, printer etc., has its own
Network Interface Card (NIC), installed inside the station.
• The NIC provides the station with a 6-byte (48 bit) physical address. Fig. 2.47 shows
physical address in hexadecimal notation.
06 : 01 : 02 : 01 : 2C : 4B
• The broadcast address is a special case of the multicast address i.e. the recipients are
all the stations on the LAN. A broadcast destination address contains all forty-eight
(48) bits are 1s.
2.6.3 Access Method: CSMA/CD (April 18)
• CSMA/CD is a type of contention protocol that defines how to respond when a collision
is detected, or when two devices attempt to transmit packages simultaneously.
• In an Ethernet network, slot time is defined in bits. It is the time required for a station
to send 512 bits. For example, for traditional 10mbps LAN it is 51.2µs and calculated as
follows
Slot time = Round-trip Time + Time required to send the Jam Sequence
Slot Time and Collision:
• A 512 bits slot time allows proper functioning of CSMA/CD. To understand this let us
consider two cases.
Case 1:
• In the first case, the sender sends a minimum size packet of 512 bits. Before the sender
can send the entire packet out, the signal travels through the network and reaches the
end of the network.
• If there is another signal at the end of the network collision occurs. The sender can
send a jam signal to abort the sending of a frame.
• The round trip time plus the time required to send the jam signal should be less than
the time needed for the sender to send the minimum frame, 512 bits.
Case 2:
• The sender must be aware of the collision before it has sent the entire frame.
• In the second case, if the sender sends a frame larger than the minimum size, after
sending the first 512 bits, it is guaranteed that collision will not occur during the
transmission of this frame.
• The entire medium belongs to the sender. The sender needs to listen for a collision
only during the time the first 512 bits are sent.
Slot Time and Maximum Network Length:
• A relationship between the slot time and maximum length of the network is
dependent on the propagation speed of the signal in the particular medium.
Max Length = Propagation Speed × Slot Time/2
• The four common Standard Ethernet implementations during the 1980s are shown in
Fig. 2.49.
• In Standard Ethernet implementation (10 Mbps) sender converts data into a digital
signal by using the Manchester scheme, at the receiver, received signals are
interpreted as Manchester and decoded into data.
2.58
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
2.59
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• The transceiver transmits, receives and detects collision. The transceiver is connected
to a station via transceiver cable which provides a separate path for sending and
receiving. Collision can occur only in the coaxial cable.
• In 10Base5 implementation, the maximum length of coaxial cable should not exceed
500 m, otherwise, signal quality is degraded. If cable length is required more than 500
m, a connecting device repeater is used.
2. 10Base2 (Thin Ethernet): (April 19)
• The second implementation is called 10Base2, thin Ethernet, or Cheapernet. The
10Base2 also uses a bus topology, it is more cost effective than 10Base5.
• The cable used in this implementation is much thinner, more flexible and can be bent.
Due to this cable can pass very close to the stations.
• The transceivers are built inside the Network Interface Card (NIC), which is installed
inside the station.
• Thin coaxial is cheaper than thick and the tee (T) connectors are also cheaper than
taps used in 10Base5.
• Installation of 10Base2 is simpler because the thin coaxial cable is very flexible. The
length of each segment cannot exceed 185 m (close to 200 m) due to the high level of
attenuation in thin coaxial cable.
• Fig. 2.52 shows the schematic diagram of a 10Base2 implementation.
Cable end
PC2
PC1
Server
10Base2
10 Mbps 185 m
2.60
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
Baseband
(digital)
Two pairs of
UTP cable
10Base-T hub
Fig. 2.53: 10Base-T Implementation
4. 10Base-F (Fiber Ethernet): (April 19)
• 10Base-F uses a star topology to connect stations to a hub.
• The stations are connected to the hub using two fiber-optic cables as shown in the
Fig. 2.54.
PC1 PC2
Server
10Base-F
Two fiber-optic
10 Mbps Fiber cables
Baseband
(digital)
10Base-F hub
Fig. 2.54: 10Base-T Implementation
Summary of Standard Ethernet Implementation:
Sr.
Characteristics 10Base5 10Base2 10Base-T 10Base-F
No.
1. Media Thick coaxial Thin coaxial 2 UTP 2 Fiber
cable cable
2.61
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• Fast Ethernet is an Ethernet standard for 100-Mbps data transmission defined by the
IEEE 802.3u specification.
• Fast Ethernet was designed to compete with LAN protocols such as FDDI or Fiber
Channel.
• Fast Ethernet is 10 times faster than standard Ethernet and operates at 100 Mbps. Fast
Ethernet is backward compatible to standard Ethernet.
Goals of Fast Ethernet: (April 16)
1. Upgrade the data rate to 100 Mbps.
2. Keep the same 48-bit address.
3. Make it compatible with Standard Ethernet.
4. Keep the same frame format.
5. Keep the same minimum and maximum frame length.
• Autonegotiation is a new feature added to Fast Ethernet. Autonegotiation allows a
station or a hub a range of capabilities. It allows two devices to negotiate the mode or
data rate of operation. CSMA/CD is an access method used by Fast Ethernet.
• Fig. 2.55 shows common Fast Ethernet implementation techniques.
• Fast Ethernet implementation at the physical layer can be categorized as either two-
wire or four-wire.
1. The two-wire implementation can be either category 5 UTP (100Base-TX) or fiber-
optic cable (100Base-FX).
2. The four-wire implementation is designed only for category 3 UTP (100Base-T4).
• Fast Ethernet implementation at the physical layer can be categorized as either two-
wire or four-wire.
2.62
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• Manchester encoding scheme needs a 200-Mbaud bandwidth for a data rate of 100
Mbps.
• Three different encoding schemes are used for three different implementations, as
shown in Fig. 2.56.
1. 100Base-TX: It uses two pairs of twisted-pair cable (either category 5 UTP or STP).
For this implementation, the MLT-3 scheme was used. It supports a data rate of
125 Mbps.
2. 100Base-FX: It uses two pairs of fiber-optic cables. 4B/5B encoding is used for this.
It supports 100 to 125 Mbps, which can easily be handled by fiber-optic cable.
3. 100Base-T4: It was designed to use category 3 or higher UTP. The implementation
uses four pairs of UTP for transmitting 100 Mbps. 8B/6T encoding scheme was
used. This means that 100 Mbps uses only (6/8) x 100 Mbps, or 75 Mbaud.
100Base-TX 100Base-FX
4 × 25 Mbps 4 × 25 Mbps 4 × 25 Mbps 4 × 25 Mbps
Station Station
100Base-T4
100 Mbps 100 Mbps
Station
4 category 3 UTP
2.63
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
Sr.
Characteristics 100Base-TX 100Base-FX 100Base-T4
No.
1. Media Cat 5 UTP or STP Fiber Cat 4 UTP
2. Number of wires 2 2 4
3. Maximum length 100 m 185 m 100 m
4. Block encoding 4B/5B 4B/5B Two
5. Line encoding MLT-3 NRZ-I 8B/6T
2.64
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• Fig. 2.58 shows the encoding/decoding schemes for the four wire implementations of
Gigabit Ethernet.
1000Base-SX, 1000Base-LX, and 1000Base-CX 1000Base-T
8 × 125 Mbps 8 × 125 Mbps 8 × 125 Mbps 8 × 125 Mbps
Station Station
Fig. 2.58: The Encoding/Decoding schemes for the Four Wire Implementations
2.65
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
Sr.
Key Fast Ethernet Gigabit Ethernet
No.
1. Successor Fast Ethernet is the Gigabit Ethernet is the
successor of 10-Base-T- successor of Fast Ethernet.
Ethernet.
2. Network speed Fast Ethernet speed is upto Gigabit Ethernet speed is upto
100 Mbps. 1 Gbps.
3. Complexity Fast Ethernet is simple to Gigabit Ethernet is quiet
configure. complex to configure.
4. Delay Fast Ethernet generates Gigabit Ethernet generates
more delay. less delay than Fast Ethernet.
5. Coverage Limit Fast Ethernet coverage limit Gigabit Ethernet coverage
is upto 10KM. limit is upto 70KM.
6. Round trip Fast Ethernet round trip Gigabit Ethernet round trip
delay delay is 100 to 500 bit times. delay is 4000 bit times.
2.66
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
2.67
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
5. Cost: It can cost less to operate a wireless LAN, which eliminates or reduces wiring
costs during office moves, reconfigurations, or expansions.
6. Mobility: Mobility is a significant advantage of WLANs. Users can access shared
resources without looking for a place to plug in, anywhere in the organization. A
wireless network allows users to be truly mobile as long as the mobile terminal is
under the network coverage area.
• In this case, the wireless LAN is referred to as an infrastructure network and the
connection to the wired infrastructure, such as the Internet, is done via a device called
an Access Point (AP).
• An AP is gluing two different environments together namely, one wired and one
wireless.
• Communication between the AP and the wireless host occurs in a wireless
environment while communication between the AP and the infrastructure occurs in a
wired environment.
4. Isolated LANs:
• The concept of a wired isolated LAN also differs from that of a wireless isolated LAN.
A wired isolated LAN is a set of hosts connected via a link-layer switch (in the recent
generation of Ethernet).
• A wireless isolated LAN, called an ad for network in wireless LAN terminology, is a set
of hosts that communicate freely with each other.
2.69
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• The concept of a link-layer switch does not exist in wireless LANs. Fig. 2.61 shows two
isolated LANs, one wired and one wireless.
5. Moving between Environments:
• A wired LAN or a wireless LAN operates only in the lower two layers of the TCP/IP
protocol suite.
• Means that if we have a wired LAN in a building that is connected via a router or a
modem to the Internet, all we need in order to move from the wired environment to a
wireless environment is to change the network interface cards designed for weed
environments to the ones designed for wireless environments and replace the link-
layer switch with an access point.
• In this change, the link-layer addresses will change (because of changing NICs), but the
network-layer addresses (IP addresses) will remain the same; we are moving from
wired links to wireless links.
2.7.2 Characteristics
• There are a number of characteristics of wireless LANs that either do not apply to
wired LANs or the existence of which is negligible and can be ignored.
• Some of these characteristics are explained below:
1. Interference:
• The main issue is that a receiver may receive signals not only from the intended
sender, but also from other senders if they are using the same frequency band.
2. Attenuation:
• The strength of electromagnetic signals decreases rapidly because the signal disperses
in all directions; only a small portion of it reaches the receiver.
• The situation becomes worse with mobile senders that operate on batteries and
normally have small power supplies.
3. Error:
• The errors and error detection are more serious issues in a wireless network than in a
wired network.
4. Multipath Propagation:
• A receiver may receive more than one signal from the same sender because
electromagnetic waves can be reflected back from obstacles such as walls, the ground,
or objects.
• The result is that the receiver receives some signals at different phases (because they
travel different paths). This makes the signal less recognizable.
2.70
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
2.71
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• The sender assumes there has been a collision if it has not received a CTS from the
receiver. In such a situation, the sender tries again. This concept is known as collision
during handshaking.
Start
Set back-off
to zero
Persistence
strategy
Wait DIFS
Send RTS
Wait back-off
time Set a timer
No CTS received
before time-out ?
Yes
Wait SIFS
Set a timer
No
Yes Yes
Abort Success
2.72
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• IEEE defines a standard for wireless LAN, named IEEE 802.11, which covers the
physical and data link layers.
• IEEE has defined the specifications for a wireless LAN, called IEEE 802.11, which
covers the physical and data-link layers.
• It is sometimes called wireless Ethernet. In some countries, including the United
States, the public uses the term WiFi (Wireless Fidelity) as a synonym for wireless
LAN.
• WiFi however, is a wireless LAN that is certified by the WiFi Alliance, a global,
nonprofit industry association of more than 300 member companies devoted to
promoting the growth of wireless LANs.
• The IEEE 802.11 standard defines two different services BSS and ESS as explained
below:
1. Basic Service Set (BSS): (April 18; Oct. 18)
• BSS is a building block for a Wireless LAN. A BSS is made up of stationary or mobile
wireless station and an optional central base station, known as Access Point (AP).
• The BSS without an AP is a stand-alone network and called as ad hoc architecture.
Such types of networks cannot send data to other BSSs.
• Stations can form a network without the need of AP. Stations can locate one another
and agree to be part of a BSS.
• A BSS with an AP is called an infrastructure network. All stations in such architecture
are communicating through an AP.
• Fig. 2.63 shows two sets of IEEE 802.11 standard.
BSS : Basic Service Set
AP : Access Point
AP
Distribution system
Server or
Gateway
ESS
AP AP AP
Station Types:
• Based on mobility, IEEE 802.11 defines three types of stations in a wireless LAN, as
given below:
1. No-transition: A station with no-transition mobility is either stationary (not
moving) or moving only inside a BSS.
2. BSS-transition: A station with BSS-transition mobility can move from one BSS to
another, but the movement is in one ESS only.
3. ESS-transition: A station with ESS-transition mobility can move from one ESS to
another.
2.74
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• As we know that the physical layer is responsible for converting data streams into
signals, the bits of 802.11 networks can be converted to radio waves or infrared waves.
• The 802.11 physical layer (PHY) is the interface between the MAC and the wireless
media where frames are transmitted and received.
• The specifications of IEEE 802.11 are explained below:
1. IEEE 802.11 Infrared:
• It uses diffused infrared light in the range of 800 to 950 nm. It allows two different
speeds 1 Mbps and 2Mbps.
• For a 1 Mbps data rate, 4 bits of data are encoded into 16 bit code. This 16 bit code
contains fifteen as and a single 1.
• For a 2-Mbps data rate, a 2 bit code is encoded into 4 bit code. This 4 bit code contains
three 0s and a single 1.
• The modulation technique used is Pulse Position Modulation (PPM) i.e. for converting
digital signal to analog.
2. IEEE 802.11 FHSS:
• IEEE 802.11 uses Frequency Hopping Spread Spectrum (FHSS) method for signal
generation.
• The FHSS method uses a 2.4 GHz ISM band. This band is divided into 79 sub-bands of
1MHz with some guard bands.
• In this method, at one moment data is sent by using one carrier frequency and then by
some other carrier frequency at the next moment.
• After this, idle time is there in communication. This cycle is repeated after regular
intervals.
• In FHSS a pseudo random number generator selects the hopping sequence. The
allowed data rates are 1 or 2 Mbps.
• The FHSS method uses frequency shift keying (two level or four level) for
modulation i.e. for converting digital signal to analogy.
3. IEEE 802.11 DSSS:
• This method uses Direct Sequence Spread Spectrum (DSSS) method for signal
generation. Each bit is transmitted as 11 chips using a Barker sequence.
• DSSS uses the 2.4-GHz ISM band. It also allows the data rates of 1 or 2 Mbps.
• It uses Phase Shift Keying (PSK) technique at 1 M baud for converting digital signal to
analog signal.
2.75
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
LLC
sublayer IEEE 802.1
Contention-free service
Contention
Data link service
layer
Point Co-ordination Function (PCF)
MAC
sublayer
2 bits 2 bits 4 bits 1 bit 1 bit 1 bit 1 bit 1 bit 1 bit 1 bit 1 bit
2.77
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
(ii) Type: Type of information: management (00), control (01), or data (10).
(iii) Subtype: Subtype of each type.
(iv) To DS: Defined later.
(v) From DS: Defined later.
(vi) More flag: When set to 1, means more fragments.
(vii) Retry: When set to 1, means retransmitted frame.
(viii) Pwr mgt: When set to 1, means the station is in power management mode.
(ix) More data: When set to 1, means the station has more data to send.
(x) WEP: Wired equivalent privacy (encryption implemented).
(xi) Rsvd: Reserved.
2. D: In all frames, this field defines the duration of the transmission that is used to
set the value of NAV.
3. Addresses: There are four address fields, each 6 bytes long. The meaning of each
address field depends on the value of the To DS and From DS subfields.
Frame Types:
• IEEE 802.11, wireless LAN defines three types of frames, as explained below:
1. Management Frames: Management frames are used for the initial
communication between stations and access points.
2. Control Frames: Control frames are used for accessing the channel and
acknowledging frames.
3. Data Frames: Data frames are used for carrying data and control information.
2.78
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• Bluetooth architecture defines two types of networks i.e., Piconet and Scatternet.
Primary/master
Primary
Secondary
Primary
Secondary Secondary
Secondary Secondary
• Such a station or node can receive messages from the master in the first piconet and
deliver the message to its slaves in other piconet where it is acting as master. This
node is also called bridge slave.
2.80
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
• Thus, a station can be a member of two piconets. A station cannot be a master in two
piconets.
5. L2CAP: Logical Link Control and Adaptation Protocol (L2CAP) supports higher
level protocol multiplexing, packet segmentation and reassembly, and the
conveying of quality of service information.
6. Radio Frequency Communication (RFCOMM): RFCOMM layer takes care of the
communication channel between two devices or between a master and a slave. It
connects the serial ports of all the devices according to the requirement.
7. Service Discovery Protocol (SDP): This layer provides a means for applications to
discover which services are available and to determine the characteristics of those
available services.
8. Telephony Control protocol Specification (TCS): Basic function of this layer is
call control (setup and release) and group management for gateway serving
multiple devices.
9. Application Program Interface (API) Libraries: These are software modules
which connect the host application program to the Bluetooth communications
system. As such they reside and execute on the same processing resource as the
host system application.
Fig. 2.70
• The various fields of Bluetooth frame format are explained below:
1. Access Code: It is a 72 bit field that contains synchronization bits. It identifies the
master.
2. Header: This is a 54-bit field. It contains an 18 bit pattern that is repeated for 3
times. The header field contains following subfields:
(i) Address: This 3 bit field can define up to seven slaves (1 to 7). If the address
is zero, it is used for broadcast communication from primary to all
secondaries.
2.82
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
(ii) (ii)Type: This 4 bit field identifies the type of data coming from upper layers.
(iii) F: This flow bit is used for flow control. When set to 1, it means the device is
unable to receive more frames.
(iv) A: This bit is used for acknowledgement.
(v) S: This bit contains a sequence number of the frame to detect retransmission.
As stop and wait protocol is used, one bit is sufficient.
(vi) Checksum: This 8 bit field contains checksum to detect errors in header.
3. Data: This field can be 0 to 2744 bits long. It contains data or control information
coming from upper layers.
Sr.
Bluetooth Wireless LAN
No.
1. It is a short range technology It refers to a network that connects two
standard which allows devices to or more devices by using wireless data
communicate in a wireless manner. connections over short distances.
2. The distance range is 30 feet to 100 The distance range is Up to 400 feet.
feet.
3. It requires low bandwidth (not for It requires high bandwidth.
transferring large files).
4. Bluetooth has generally lower speed. Wireless LAN is much faster compared to
Bluetooth.
5. Lower cost. Cost is much more expensive than
Bluetooth.
6. Bluetooth chips have lower power It requires more power consumption.
consumption - less drain on battery.
7. It is less secure. More secure.
8. Fairly simple to use. Can be used to It is more complex and requires
connect upto seven devices at a time. configuration of hardware and software.
It is easy to switch between devices or
find and connect to any device.
PRACTICE QUESTIONS
Q. I Multiple Choice Questions:
1. Which are the following lower layers of the OSI model?
(a) Physical layer (b) Data link layer
(c) Both (a) and (b) (d) None of these
2.84
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
11. Which is a process in which a single channel is divided and allotted to multiple
users in order to carry user specific tasks.
(a) Data allocation (b) Communication allocation
(c) Channel allocation (d) All of these
12. In which channel allocation, frequency bands are not permanently assigned to the
users?
(a) Dynamic (b) Static
(c) Fixed (d) All of these
13. Which is a system for coordinating and arbitrating access to a shared
communication Networks channel?
(a) CSMA (b) FDMA
(c) ALOHA (d) None of these
14. Which is a network access method used on shared network topologies such as
Ethernet to control access to the network?
(a) CSMA (b) FDMA
(c) ALOHA (d) None of these
15. In which method, the station needs to make a "before sending data".
(a) Polling (b) Reservation
(c) Select (d) None of these
16. Which is the multiple access method in which the available bandwidth of a link is
shared in time, frequency or through code between different stations?
(a) Polling (b) Reservation
(c) Channelization (d) None of these
17. Which is a channel access method for stored medium networks?
(a) TDMA (b) FDMA
(c) CDMA (d) All of these
18. A switched network consists of a series of interlinked nodes called ______.
(a) Switches (b) Routers
(c) Repeaters (d) All of these
19. Which switching takes place at the physical layer of the TCP/IP reference model?
(a) Message (b) Packet
(c) Circuit (d) None of these
20. Virtual circuit packet switching is normally done at the ______ layer.
(a) Physical (b) Data link
(c) Network (d) None of these
2.86
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
2.87
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
2.88
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
29. ______ Ethernet is an Ethernet standard for 100-Mbps data transmission defined
by the IEEE 802.3u specification.
30. The IEEE initial standard for ______ Ethernet was produced by the IEEE in June
1998 as IEEE 802.3z.
31. Wireless LANs are those Local Area Networks that use high frequency ______
waves instead of cables for connecting the devices in LAN.
32. A wired ______ LAN is a set of hosts connected via a link-layer switch.
33. An ______ is made up of two or more BSSs with APs.
34. A Bluetooth LAN is an ______ network.
35. ______ is formed by combining various piconets.
36. In the data link layer, ______ control restricts the number of frames the sender can
send before it waits for an acknowledgment from the receiver.
37. ______ count method uses a field in the header to specify the number of characters
in the frame.
38. ______ method allows data frames to contain an arbitrary number of bits and
allows character codes with an arbitrary number of bits per character.
39. ______ channel allocation are schemes for allotting shared network channels to
competing users in a dynamic manner as per their requirements.
40. The Bluetooth ______ layer performs functions similar to those in the Internet
model’s MAC sublayer.
ANSWERS
1. Physical 2. Data link 3. Analog, digital 4. Discredit
5. Channel 6. Bandwidth 7. Throughput 8. Latency
9. Bandwidth-delay 10. Jitter 11. Data link 12. Error
13. Unacknowledged 14. Frames 15. Framing 16. Channel
17. Multiple 18. Data link 19. Aloha 20. Token
21. Token passing 22. TDMA 23. Physical 24. Packet
25. Source 26. Messages 27. Wired network 28. Connectionless
(LAN)
29. Fast 30. Gigabit 31. Radio 32. Isolated
33. ESS 34. Ad hoc 35. Scattemet 36. Flow
37. Character 38. Bit stuffing 39. Dynamic 40. Baseband
2.89
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
2.90
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
20. A wireless isolated LAN, called an ad for network in wireless LAN terminology, is
a set of hosts that communicate freely with each other.
21. A ESS is made up of stationary or mobile wireless station and an optional central
base station, known as Access Point (AP).
22. IEEE 802.11 defines two MAC sublayers, Distribution Co-ordination Function
(DCF) and Point Co-ordination Function (PCF).
23. The Point Co-ordination Function (PCF) is an optional access method which is
implemented in an infrastructure network and not in ad hoc network.
24. Piconet is a Bluetooth network that consists of one primary (master) node and
seven active secondary (slave) nodes.
25. Bandwidth describes the volume of data that can be transferred at a given time.
26. Throughput is the actual amount of data that is successfully sent/received over
the communication link.
27. Jitter variation in packet delay at the receiver of the information.
28. Throughput refers to measurement of data transferred in a specific time period.
29. Flow control in the data link layer is the process of detecting and correcting data
frames that have been corrupted or lost during transmission.
30. In the dynamic channel allocation scheme, a fixed portion of the frequency
channel is allotted to each user.
31. In 1-persistent CSMA method, a station that wants to transmit data continuously
senses the channel to check whether the channel is idle or busy.
32. In controlled access, the stations consult one another to find which station has the
right to send.
33. Packet switching is a method of transferring the data to a network in form of
packets.
34. A Gigabit Ethernet network can transmit data at a rate up to 10 Megabits per
second (10 Mbps).
35. The Fast Ethernet standard (IEEE 802.3u) has been established for Ethernet
networks that need higher transmission speeds. This standard raises the Ethernet
speed limit from 10 Mbps to 100 Mbps.
36. There are three types of Fast Ethernet: 100BASE-TX for use with level 5 UTP cable;
100BASE-FX for use with fiber-optic cable; and 100BASE-T4 which utilizes an extra
two wires for use with level 3 UTP cable. The 100BASE-TX standard has become
the most popular due to its close compatibility with the 10BASE-T Ethernet
standard.
2.91
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
37. Gigabit Ethernet (GbE) is the family of Ethernet technologies that achieve
theoretical data rates of 1 gigabit per second (1 Gbps).
38. Wired LANs are wireless computer networks that use high-frequency radio waves
instead of cables for connecting the devices within a limited area forming LAN.
39. The IEEE 802.11 standard for wireless LANs defines two services: basic service set
(BSS) and extended service set (ESS).
40. The physical layer methods used by wireless LANs include frequency-hopping
spread spectrum (FHSS), direct sequence spread spectrum (DSSS), orthogonal
frequency-division multiplexing (OFDM), and high-rate direct sequence spread
spectrum (HR-DSSS).
41. The network allocation vector (NAV) is a timer used for collision avoidance.
42. The Bluetooth radio layer performs functions similar to those in the Internet
model’s physical layer.
ANSWERS
1. (T) 2. (F) 3. (T) 4. (T) 5. (T) 6. (T)
7. (F) 8. (T) 9. (T) 10. (T) 11. (F) 12. (F)
13. (F) 14. (T) 15. (F) 16. (T) 17. (T) 18. (T)
19. (T) 20. (T) 21. (F) 22. (T) 23. (T) 24. (F)
25. (T) 26. (T) 27. (T) 28. (T) 29. (F) 30. (F)
31. (T) 32. (T) 33. (T) 34. (F) 45. (T) 36. (T)
37. (T) 38. (F) 39. (T) 40. (T) 41. (T) 42. (T)
2.92
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
2.93
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
2.94
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
April 2017
1. What is framing? Explain any two framing methods with examples. [4 M]
Ans. Refer to Sections 2.2.3 and 2.3.
2. Explain FDMA in detail. [4 M]
Ans. Refer to Section 2.4.5 Point (1).
3. What are Random access methods? Explain any one mechanism. [4 M]
Ans. Refer to Section 2.4.3.1.
4. Explain Polling "Select" function. [3 M]
Ans. Refer to Section 2.4.4.
5. Which standard is used for wireless LAN? [1 M]
Ans. Refer to Section 2.7.
6. What is Bluetooth? Write any two advantages of Bluetooth. [2 M]
Ans. Refer to Sections 2.7.7 and 2.7.7.4.
October 2017
1. State the strategies used to avoid collisions. [1 M]
Ans. Refer to Section 2.4.3.1.
2. Explain the packet switching with advantages and disadvantages. [5 M]
Ans. Refer to Section 2.5.1.2.
3. Describe the functions performed by Data Link Layer. [5 M]
Ans. Refer to Sections 2.0 and 2.2.
4. Consider a CDMA scheme with 3 stations having chip sequences [+1 –1 +1 –1],
[+1 +1 –1 –1]. Station 1 sends bit 1. Station 2 sends bit 0. Station 3 is silent.
Show the process of encoding and decoding along with the signals. [5 M]
Ans. Refer to Section 2.4.3.1, Point (2).
5. Describe Pure and Slotted ALOHA in brief. [5 M]
Ans. Refer to Section 2.4.3.1, Point (1).
6. Why is CSMA/CD not required in full duplex switched Ethernet? [1 M]
Ans. Refer to Section 2.6.3.
2.95
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
April 2018
1. What is the responsibility of a Physical Layer. [1 M]
Ans. Refer to Section 2.7.5.
2. List the cables used with Ethernet LAN. [1 M]
Ans. Refer to Section 2.6.1.
3. A telephone network is an example of a circuit switched network. State
True/False. [1 M]
Ans. Refer to Section 2.5.1.1.
4. Consider a CDMA scheme with 3 stations having chip sequences [+1 –1 +1 –1],
[+1 +1 –1 –1] and [1+ +1 +1 +1].
Station 1 sends bit 1. Station 2 sends bit 0. Station 3 is silent. Show the process of
encoding and decoding along with the signals. [5 M]
Ans. Refer to Section 2.4.3.1, Point (3).
5. Explain the strategies used by CSMA/CA. [4 M]
Ans. Refer to Section 2.4.3.1, Point (4).
6. What is Framing? List methods of framing. [2 M]
Ans. Refer to Sections 2.2.3 and 2.3.
7. Compare the circuit and packet switching. [4 M]
Ans. Refer to Page No 2.51.
8. Draw BSS with an access point. [1 M]
Ans. Refer to Section 2.7.4, Point (1).
9. Draw the frame format of Ethernet. [2 M]
Ans. Refer to Section 2.6.1.1, Point (3).
October 2018
1. If the bandwidth of the channel is 10 kbps, how long does it take to transmit a
frame of 100000 bits? [1 M]
Ans. Refer to Section 2.1.1.
2.96
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
April 2019
1. If a composite signal is composed of five sine waves of frequencies 100, 300, 500,
700 and 900 Hz. What is the bandwidth of the signal? [1 M]
Ans. Refer to Section 2.1.1.
2. Calculate maximum bit rate using Shannon’s theorem for a channel having
bandwidth 31000 Hz and S/N ratio 20dB. [5 M]
Ans. Refer to Section 2.1.1.
2.97
Computer Networks – I (S.Y.B.Sc. Comp. Science) Lower Layers
2.98
CHAPTER
3
Network Layer
Objectives…
To understand Network Layer
To study IPv4 and Addressing
To learn Basic Concepts in IPv6
To understand Congestion Control
To learn Mobile IP and Routing
Transport Layer
Gives services to
Network Layer
Multicasting
Internetworking Routing
Address
Addressing resolution
Routing
Packetizing Fragmenting
protocols
3.1
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
• When the data packets are routed to remote locations, a logical addressing scheme is
required to differentiate between the source system and the destination system. This is
provided by the network layer.
• One of the main functions of network layer is to provide internetworking
between different networks. It provides a logical connection between different types
of network.
• Fig. 3.1 shows position of network layer in OSI Model.
• The services which are offered by the network layer are as follows:
1. Packetizing:
• The process of encapsulating the data received from upper layers of the network (also
called as payload) in a network layer packet at the source and decapsulating the
payload from the network layer packet at the destination is known as packetizing.
• In other words, one responsibility of the network layer is to carry the data packets
from the source to the destination without changing it or using it.
• The network layer is doing the service of a carrier such as the postal office, is
responsible for delivery of packages from sender to a receiver without changing or
using the content.
• The source host adds a header that contains the source and destination address and
some other relevant information required by the network layer protocol to the
payload received from the upper layer protocol, and delivers the packet to the data
link layer.
• The destination host receives the network layer packet from its data link layer,
decapsulates the packet, and delivers the payload to the corresponding upper layer
protocol.
• The routers in the path are not allowed to change either the source or the destination
address.
• The routers in the path are not allowed to decapsulate the packets they receive unless
they need to be fragmented.
• Packetizing is done by Internet Protocol (IP) that defines its own packet format.
2. Routing and Forwarding:
• Routing and forwarding are two other services offered by the network layer.
• The network layer is responsible for routing the packets from its source to the
destination. With the help of forwarding, data packets are transferred from one place
to another in the network.
3.2
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
• In a network, there are a number of roots available from the source to the destination.
The network layer has some strategies which find out the best possible route. This
process is referred to as routing.
• There are a number of routing protocols which are used in the routing process and
they should be run to help the routers coordinate with each other and help in
establishing communication throughout the network.
• Forwarding is simply defined as the action applied by each router when a packet
arrives at one of its interfaces.
• Normally, a router uses the decision making table for applying this action sometimes
called the forwarding table and sometimes the routing table.
• When a router receives a packet from one of its attached networks, it needs to forward
the packet to another attached network (unicast routing) or to some attached networks
(in case of multicast routing).
Other Services:
1. Flow Control:
• It regulates the amount of data a source can send without overloading the receiver.
• If the source produces data at a very faster rate than the receiver can consume it, the
receiver will be overloaded with data.
• To control the flow of data, the receiver should send feedback to the sender to inform
the latter that it is overloaded with data.
• There is a lack of flow control in the design of the network layer. It does not directly
provide any flow control.
• The datagrams are sent by the sender when they are ready, without any attention to
the readiness of the receiver.
2. Error Control:
• Error control also in the network layer is the process of detecting and correcting data
packets that have been corrupted or lost during transmission.
• For error control network layer uses ICMP protocol. Internet Control Message Protocol
(ICMP) is a network layer protocol that reports errors and provides information
related to IP packet processing.
• ICMP is used by network devices to send error messages indicating, for example, that a
requested service is not available or that a host is not reachable.
3. Quality of Service:
• The Internet has thrived by providing better quality of service to support applications
like real-time communication of audio and video.
3.3
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
4. Congestion Control:
• Congestion is a situation in a network layer in which too many datagrams are present
in an area of the Internet.
• Congestion occurs when the number of datagrams sent by source is beyond the
capacity of network or routers.
• If congestion continues, sometimes a situation may arrive where the system collapses
and no datagrams are delivered.
• Although congestion control is indirectly implemented in the network layer, there is
still a lack of congestion control in the network layer.
5. Security:
• The network layer was designed with no security provision. The network layer uses a
virtual level IPSec for security.
Fig. 3.2: When too Many Packets are Sent, Congestion Occurs and Performance Degrades
3.4
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
• At very high traffic, performance collapses completely and almost no packets are
delivered. Buffers get full, so packets are discarded leading to more retransmissions
and less packets delivered to their destinations.
• Congestion thus tends to feed upon itself and become worse, leading to collapse of the
system.
• Congestion can occur because of several reasons:
1. If there is insufficient memory at the router to hold the packets, congestion occurs
and packets are lost.
2. Slow processors can also cause congestion. If the router’s processor is slow, queues
can build up, even though there is excess line capacity, congestion can occur.
3. Similarly, low bandwidth lines can also cause congestion.
Basic Concept of Congestion Control:
• Congestion control refers to techniques and mechanisms that can either prevent
congestion, before it happens, or remove congestion, after it has happened.
• Congestion control mechanisms are divided into two categories, one category prevents
the congestion from happening (open loop congestion control) and the other category
removes (closed loop congestion control) congestion after it has taken place.
Congestion
control
packets may be received successfully at the receiver side. This duplication may
increase the congestion in the network and make it worse. Therefore, a Selective
repeat window should be adopted as it sends the specific packet that may have
been lost.
(iii) Discarding Policy: A good discarding policy adopted by the routers is that the
routers may prevent congestion and at the same time partially discards the
corrupted or less sensitive package and also be able to maintain the quality of a
message. In case of audio file transmission, routers can discard less sensitive
packets to prevent congestion and also maintain the quality of the audio file.
(iv) Acknowledgment Policy: Since acknowledgement is also part of the load in the
network, the acknowledgment policy imposed by the receiver may also affect
congestion. Several approaches can be used to prevent congestion related to
acknowledgment. The receiver should send acknowledgement for N packets
rather than sending acknowledgement for a single packet. The receiver should
send an acknowledgment only if it has to send a packet or a timer expires.
(v) Admission Policy: In admission policy a mechanism should be used to prevent
congestion. Switches in a flow should first check the resource requirement of a
network flow before transmitting it further. If there is a chance of a congestion
or there is a congestion in the network, the router should deny establishing a
virtual network connection to prevent further congestion.
• All the above policies are adopted to prevent congestion before it happens in the
network.
2. Closed Loop Congestion Control: (Oct. 17)
• Closed loop congestion control technique is used to treat or alleviate congestion after it
happens. Closed loop solutions are based on feedback loops.
• Closed loop congestion control has following three parts:
(i) Monitor the system to detect when and where congestion occurs.
(ii) Pass this information to places where action can be taken.
(iii) Adjust system operations to correct the problem.
• Policies adopted by open loop congestion control are explained below:
(i) Backpressure: Backpressure is a technique in which a congested node stops
receiving packets from upstream nodes. This may cause the upstream node or
nodes to become congested and rejects receiving data from above nodes.
Backpressure is a node-to-node congestion control technique that propagates in
the opposite direction of data flow. The backpressure technique can be applied
3.6
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
only to virtual circuits where each node has information of its above upstream
node.
rd nd
In the Fig. 3.4, the 3 node is congested and stops receiving packets as a result 2
st
node may get congested due to slowing down of the output data flow. Similarly, 1
node may get congested and inform the source to slow down.
Fig. 3.4
(ii) Choke Packet Technique: Choke packet technique is applicable to both virtual
networks as well as datagram subnets. A choke packet is a packet sent by a node
to the source to inform it of congestion. Each router monitors its resources and
the utilization at each of its output lines. whenever the resource utilization
exceeds the threshold value which is set by the administrator, the router directly
sends a choke packet to the source giving it a feedback to reduce the traffic. The
intermediate nodes through which the packets have traveled are not warned
about congestion. Fig. 3.5 shows the idea of a choke packet.
Fig. 3.5
(iii) Implicit Signaling: In implicit signaling, there is no communication between the
congested nodes and the source. The source guesses that there is congestion in a
network. For example, the when the sender sends several packets and there is no
acknowledgement for a while, one assumption is that there is a congestion.
(iv) Explicit Signaling: In explicit signaling, if a node experiences congestion it can
explicitly send a packet to the source or destination to inform about congestion.
The difference between choke packet and explicit signaling is that the signal is
included in the packets that carry data rather than creating different packets as in
case of choke packet technique. Explicit signaling can occur in either forward or
backward direction.
3.7
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
• An IPv4 address is a 32-bit address that uniquely and universally defines the
connection of a device such as a computer or a router to the Internet. Fig. 3.6 shows an
IP address format.
• An IP address consists of two parts namely, a Network ID, which specifies the network
on which a host resides, and a Host ID, which identifies the host within that network.
3.9
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
3. Dotted-decimal Notation (Base 256): To make the IPv4 address more compact
and easier to read, Internet addresses are usually written in decimal form with a
decimal point (dot) separating the bytes. Dotted-decimal notation is the format that
is typically used for displaying the IP address in a human-readable format. An
example of dotted-decimal notation is 192.168.1.100.
Examples:
Example 1: Change the following IPv4 addresses from binary notation to dotted-
decimal notation.
(i) 10000001 00001011 00001011 11101111
(ii) 11000001 10000011 00011011 11111111
(iii) 11100111 11011011 10001011 01101111
(iv) 11111001 10011011 11111011 00001111
Solution:
We replace each group of 8 bits with its equivalent decimal number and add dots
for separation.
(i) 129.11.11.239
(ii) 193.131.27.255
(iii) 231.219.139.111
(iv) 249.155.251.15
Example 2: Change the following IPv4 addresses from dotted-decimal notation to
binary notation.
(i) 111.56.45.78
(ii) 221.34.7.82
(iii) 241.8.56.12
(iv) 75.45.34.78
Solution:
We replace each decimal number with its binary equivalent.
(i) 01101111 00111000 00101101 01001110
(ii) 11011101 00100010 00000111 01010010
(iii) 11110001 00001000 00111000 00001100
(iv) 01001011 00101101 00100010 01001110
Example 3: Change the following IPv4 addresses from binary notation to hexadecimal
notation.
(i) 10000001 00001011 00001011 11101111
3.10
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
3.11
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
• In class A, the network length is 8 bits, but since the first bit, which is 0, defines the
class, we can have only seven bits as the network identifier. This means there are only
7
2 = 128 networks in the world that can have a class A address.
• In class B, the network length is 16 bits, but since the first two bits, which are (10)2,
define the class, we can have only 14 bits as the network identifier. This means there
14
are only 2 = 16384 networks in the world that can have a class B address.
• All addresses that start with (110)2, belong to class C. In class C, the network length is
24 bits, but since three bits define the class, we can have only 21 bits as the network
21
identifier. This means there are 2 = 2,097,152 networks in the world that can have a
class C address.
• Class D (11102 is not divided into NetworkID and HostID. It is used for multicast
addresses. All addresses that start with 1111 in binary belong to class E. As in Class D,
Class E is not divided into NetworkID and HostID and is used as reserve.
3.12
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
(ii) The first 2 bits are 1; the third bit is 0. This is a class C address.
(iii) The first bit is 1; the second bit is 0. This is a class B address.
(iv) The first 4 bits are 1s. This is a class E address.
Example 2: Find the class of each address:
(i) 227.12.14.87
(ii) 193.14.56.22
(iii) 14.23.120.8
(iv) 252.5.15.111
Solution:
(i) The first byte is 227 (between 224 and 239); the class is D.
(ii) The first byte is 193 (between 192 and 223); the class is C.
(iii) The first byte is 14 (between 0 and 127); the class is A.
(iv) The first byte is 252 (between 240 and 255); the class is E.
Basic Concept of Masking:
• A mask used to determine what subnet an IP address belongs to. A process that
extracts the address of the physical network from an IP address is called Masking. If
we do the subnetting, then masking extracts the subnetwork address from an IP
address.
• It may at first seem to be odd that IP address classes are assigned in this way. After all,
there are not any private networks that have 16 million hosts on them, so it makes
little sense even to have Class A addresses. However, it's possible to subdivide IP
addresses even further by creating subnets on them.
• A subnet is simply a subdivision of a network address that can be used to represent
one LAN on an internetwork or the network of one of an ISP's clients.
• Thus, a large ISP might have a Class A address registered to it and it might farm out
pieces of the address to its clients in the form of subnets.
• In many cases, a large ISP's clients are smaller ISPs, which in turn supply addresses to
their own clients.
• A subnet allows the flow of network traffic between hosts to be segregated based on a
network configuration.
• A subnet mask (or number) is used to determine the number of bits used for the
subnet and host portions of the address.
• The mask is a 32-bit value that uses one-bits for the network and subnet portions and
zero-bits for the host portion.
3.13
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
Subnet Masks:
• IP networks can be divided into smaller networks called subnetworks (or subnets).
The subnets are created through the use of subnet masks.
• The subset mask identifies which hits in the IP address are to be used to represent the
network subnet portion of an IP address.
• The network mask is used when a network is not subnetted.
• When we divide a network
into several subnetworks,
we need to create a
subnetwork mask (or subnet
mask) for each subnetwork.
• Fig. 3.10 shows a
subnetwork has sub netid Fig. 3.10: Network Mask and Subnetwork Mask
and hostid.
• Subnetting provides the following advantages:
o Network Traffic Isolation: There is less network traffic on each subnet.
o Simplified Administration: Networks may be managed independently.
o Improved Security: Subnets can isolate internal networks so they are not visible
from external networks.
• A 14-bits subnet mask on a class B network only allows 2 node addresses for WAN
links. A routing algorithm like OSPF (Open Shortest Path First) must be used for this
approach.
• These protocols allow the Variable Length Subnet Masks (VLSM). RIP (Routing
Information Protocol) and IGRP (Interior Gateway Routing Protocol) don't support this.
• Subnet mask information must be transmitted on the update packets for dynamic
routing protocols for this to work.
• The router subnet mask is different from the WAN interface subnet mask. One
network ID is required by each of:
o Subnet,
o WAN connection.
• One host ID is required by each of:
o Each NIC on each host.
o Each router interface.
• Types of subnet masks:
o Default: Fits into a Class A, B, or C network category.
o Custom: Used to break a default network such as a Class A, B or C network into
subnets.
3.14
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
Default Masks
• A subnet is defined by applying a bitmask, the subnet mask, to the IP address. If a bit is
on the mask, the equivalent bit in the address is interpreted as a network bit.
3.15
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
• If the bit in the mask is off, the bit belongs to the host part of the address. The subnet is
only known locally. To the rest of the Internet, the address is still interpreted as a
standard IP address.
2. 200.34.22.156 IP Address
255.255.255.240 Mask
200.34.22.144 Subnetwork Address
3. 125.35.12.57 IP Address
255.255.0.0 Mask
125.35.0.0 Subnetwork Address
• The process of subnetting involves dividing a network up into smaller networks called
subnets or sub networks.
• A subnet is a logical partition of an IP network into multiple, smaller network
segments. Each of these subnets has its own specific address.
• To create these additional sub networks, we use a subnet mask. The subnet mask
simply determines which portion of the IP address belongs to the host.
• The subnet address is created by dividing the host address into network address and
host address.
• To subnet a network, extend the natural mask using some of the bits from the host ID
portion of the address to create a subnetwork ID.
• For example, given a Class C network of 204.15.5.0 which has a natural mask of
255.255.255.0. We can create subnets in the following manner:
204.15.5.0 11001100.00001111.00000101.00000000
255.255.255.224 11111111.11111111.11111111.11100000
---------------------------------(sub)---------------
• By extending the mask to be 255.255.255.224, we have taken three bits (seen above as
"sub") from the original host portion of the address and used them to make subnets.
With these three bits, it is possible to create eight subnets.
• With the remaining five host ID bits. Each subnet can have up to 32 host addresses, 30
of which can actually be assigned to a device since host ids of zeros or all ones are not
allowed (it is very important to remember this).
• So, with this in mind, the following subnets have been created:
204.15.5.0 255.255.255.224 host address range 1 to 30
204.15.5.32 255.255.255.224 host address range 33 to 62
204.15.5.64 255.255.255.224 host address range 65 to 94
204.15.5.96 255.255.255.224 host address range 96 to 126
204.15.5.128 255.255.255.224 host address range 129 to 158
204.15.5.160 255.255.255.224 host address range 161 to 190
204.15.5.192 255.255.255.224 host address range 193 to 222
204.15.5.224 255.255.255.224 host address range 225 to 254
• Using the network subnetting scheme above, which allows for eight subnets, the
network might appear as shown in Fig. 3.16.
Fig. 3.16
3.17
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
• Fig. 3.17 shows a network using class B addresses before subnetting. In this example
we have just one network with almost 216 hosts.
• The whole network is connected, through one single connection, to one of the routers
in the Internet.
Fig. 3.17
• Fig. 3.18 shows the same network in Fig. 3.17 after subnetting. The whole network is
still connected to the Internet through the same router.
• However, the network has used a private router to divide the network into four
subnetworks.
Fig. 3.18
3.18
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
Examples:
Example 1: Assume a company has three offices Central, East, and West. The Central
office is connected to the East and West offices via private, point-to-point WAN lines. The
company is granted a block of 64 addresses with the beginning address 70.12.100.128/26.
The management has decided to allocate 32 addresses for the Central office and divides
the rest of addresses between the two other offices.
1. The number of addresses are assigned as follows:
Central office Nc = 32 East office Ne = 16 West office Nw = 16
2. We can find the prefix length for each subnetwork:
nc = n + log2(64/32) = 27 ne = n + log2 (64/16) = 28 nw = n + log2(64/16) = 28
Solution:
Fig. 3.19 shows the configuration designed by the management. The Central office uses
addresses 70.12.100.128/27 to 70.12.100.159/27. The company has used three of these
addresses for the routers and has reserved the last address in the subblock. The East office
uses the addresses 70.12.100.160/28 to 70.12.100.175/28. One of these addresses is used for
the router and the company has reserved the last address in the subblock. The West office
uses the addresses 70.12.100.160/28 to 70.12.100.175/28. One of these addresses is used for
the router and the company has reserved the last address in the subblock. The company
uses no address for the point-to-point connections in WANs.
Fig. 3.19
3.19
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
Solution:
32–26
The number of addresses for the whole network can be found as N = 2 = 64. The
first address in the network is 130.34.12.64/26 and the last address is 130.34.12.127/26. We
now design the subnetworks:
1. We grant 16 addresses for each subnetwork to meet the first requirement (64/16 is a
power of 2).
2. The subnetwork mask for each subnetwork is:
n1 = n2 = n3 = n4 = n + log2 (N/Ni) = 26 + log24 = 28
3. We grant 16 addresses to each subnet starting from the first available address.
Fig. 3.20 shows the subblock for each subnet. Note that the starting address in each
subnetwork is divisible by the number of addresses in the subnetwork.
3.3.4 Supernetting
• When most of the class A and class B addresses were depleted, there was a huge
demand for midsize blocks.
• The size (only 256) of class C was not sufficient. Even a midsize organization needs
more than 256 addresses. Supernetting is the solution for this problem.
• In supernetting, an organization can combine several class C blocks to create a larger
range of addresses. Several networks are combined to create a supernetworks or a
supernet.
• Supernetting, also called Classless Inter-Domain Routing (CIDR), is a way to aggregate
multiple Internet addresses of the same class.
3.20
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
• Classful means that the IP addresses and subnets are within the same network. The
problem with classful addressing is that there is a lot of unused IP address space.
• For example, a class A IP network has more than 16 million possible host addresses. A
Class B network has more than 65,000 host addresses, but the fact is that only a limited
number of Class A and B address space has been allocated for Internet use.
• However, the size of a class C block with a maximum number of 256 addresses may
not satisfy the needs of an organization. Even a mid-size organization may need more
addresses.
• One solution is supernetting. In supernetting, an organization can combine several
class C blocks to create a larger range of addresses.
• In other words, several networks are combined to create a supernetwork. By doing
this, an organization can apply for a set of class C blocks instead of just one.
• For example, an organization that needs 1000 addresses can be granted four class C
blocks.
• The organization can then use these addresses in one supernetwork as shown in
Fig. 3.21. When we group two or more classful networks together, they are called
supernets.
• The technique supernetting was proposed in 1992 to eliminate the class boundaries
and to make available the unused IP address space.
• Supernetting allows multiple networks to be specified by one subnet mask. In other
words, the class boundary could be overcome.
3.21
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
• Supernetting required a simpler way to indicate the subnet mask. The technique
developed is called Classless Inter-Domain Routing (CIDR). CIDR notation specifies the
number of bits set to a 1 that make up the subnet mask.
• For example, the Class C size subnet mask 255.255.255.0 is listed in CIDR notation as
/24. This indicates the 24 bits are set to a 1. A Class B size subnet is written as /16, and a
Class A subnet is written as /8.
• CIDR can also be used to represent subnets that identify only part of the octet bits in an
IP address. For example, a subnet mask of 255.255.192.0 is written in CIDR as /18.
• The /18 comes from the 18 bits that are set to a 1 as shown below:
255 255 192 0
11111111 11111111 11000000 00000000
• CIDR notation truncates the subnet mask to what is known as “slash” notation. In this
example, the network would be identified as 131.107.0.0/16.
• The “/16” value refers to the fact that the first 16 bits in the subnet mask are all set to
values of binary 1.
Fig. 3.22
Advantages of Supernetting:
1. Control and reduce network traffic.
2. Helpful to solve the problem of lacking IP addresses.
3. Minimizes the routing table.
Disadvantages of Supernetting:
1. It cannot cover different areas of the network when combined.
2. All the networks should be in the same class and all IP should be contiguous.
3.22
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
classes. We can have a block of 1 address, 2 addresses, 4 addresses, 128 addresses, and
so on.
• In classless addressing, the whole address space is divided into variable length blocks.
0 1 2 32
Theoretically, we can have a block of 2 , 2 , 2 , ..… 2 addresses. The only restriction, is
that the number of addresses in a block needs to be a power of 2. An organization can
be granted one block of addresses.
• Fig. 3.23 shows the division of the whole address space into non-overlapping blocks.
• In the classful addressing, routers could just assume the class of an address based on
the network ID. In the classless addressing, subnet mask information must always be
provided when routers exchange information with each other.
• Some routing protocols, such as the Border Gateway Protocol (BGPv4) and OSPF,
support classless addressing.
3.23
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
• The network portion of an IP address is determined by how many 1's are in the subnet
mask. Again, this can be a variable number of bits, and although it can fall on an octet
boundary, it does not necessarily need to.
Fig. 3.24
• As the Fig. 3.24 shows, the private network uses private addresses.
• The router that connects the network to the global address uses one private address
and one global address. The private network is invisible to the rest of the Internet; the
rest of the Internet sees only the NAT router with the address 200.24.5.8.
3.24
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
• When the response comes back from the destination, the router uses the source
address of the packet (as the external address) to find the private address of the
packet.
• Fig. 3.26 shows the idea.
Fig. 3.26
Using a Pool of IP Addresses:
• The use of only one global address by the NAT router allows only one private-network
host to access a given external host. To remove this restriction, the NAT router can use
a pool of global addresses.
• For example, instead of using only one global address (200.24.5.8), the NAT router can
use four addresses (200.24.5.8, 200.24.5.9, 200.24.5.10, and 200.24.5.11).
• In this case, four private-network hosts can communicate with the same external host
at the same time because each pair of addresses defines a separate connection.
Using Both IP Addresses and Port Addresses:
• To allow a many-to-many relationship between private-network hosts and external
server programs, more information in the translation table is required.
• For example, suppose two hosts with addresses 172.18.3.1 and 172.18.3.2 inside a
private network need to access the HTTP server on an external host 25.8.3.2.
3.26
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
• If the translation table has five columns, instead of two, that include the source and
destination port numbers of the transport layer protocol, the ambiguity is eliminated.
• Table 3.1 shows an example of such a table.
Table 3.1: Five-column Translation Table
Private Private External External Transport
Address Port Address Port Protocol
3.27
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
• In this case, forwarding requires a host or a router to have a forwarding table. When a
host has a packet to send or when a router has received a packet to be forwarded, it
looks at this table to find the next hop to deliver the packet to.
• In classless addressing, the whole address space is one entity; there are no classes. This
means that forwarding requires one row of information for each block involved.
• The table needs to be searched based on the network address (first address in the
block). Unfortunately, the destination address in the packet gives no clue about the
network address.
• To solve the problem, we need to include the mask (/n) in the table. In other words, a
classless forwarding table needs to include four pieces of information: the mask, the
network address, the interface number, and the IP address of the next router (needed
to find the link-layer address of the next hop).
• However, we often see in the literature that the first two pieces are combined. For
example, if n is 26 and the network address is 180.70.65.192, then one can combine the
two as one piece of information: 180.70.65.192/26.
• Fig. 3.27 shows a simple forwarding module and forwarding table for a router with
only three interfaces.
• The job of the forwarding module is to search the table, row by row. In each row, the n
leftmost bits of the destination address (prefix) are kept and the rest of the bits (suffix)
are set to 0s.
• If the resulting address (which we call the network address), matches with the address
in the first column, the information in the next two columns is extracted; otherwise
the search continues.
• Normally, the last row has a default value in the first column (not shown in Fig. 3.27),
which indicates all destination addresses that did not match the previous rows.
3.28
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
• Sometimes, the literature explicitly shows the value of the n leftmost bits that should
be matched with the n leftmost bits of the destination address.
• The concept is the same, but the presentation is different. For example, instead of
giving the address-mask combination of 180.70.65.192/26, we can give the value of the
26 leftmost bits as shown below:
10110100 01000110 01000001 11
• Note that we still need to use an algorithm to find the prefix and compare it with the
bit pattern.
• In other words, the algorithm is still needed, but the presentation is different. We use
this format in our forwarding tables in the exercises when we use smaller address
spaces just for practice.
• For example, make a forwarding table for router R1 using the configuration in
Fig. 3.28.
Fig. 3.28
Solution: Table 3.2 shows the corresponding table.
Table 3.2: Forwarding table for router R1 in Fig. 3.28
Network Address/Mask Next Hop Interface
180.70.65.192/26 - m2
180.70.65.128/25 - m0
201.4.22.0/24 - m3
201.4.16.0/22 - m1
Default 180.70.65.200 m2
3.29
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
• Fig. 3.29 showed a simple example of searching in a forwarding table using the longest
mask algorithm. Although there are some more efficient algorithms today, the
principle is the same.
• When the forwarding algorithm gets the destination address of the packet, it needs to
delve into the mask column.
• For each entry, it needs to apply the mask to find the destination network address. It
then needs to check the network addresses in the table until it finds the match.
• The router then extracts the next-hop address and the interface number to be
delivered to the data-link layer.
• Fig. 3.30 shows a simple example of using a label to access a switching table. Since, the
labels are used as the index to the table, finding the information in the table is
immediate.
• The Address Resolution Protocol (ARP) is used to glue the network and data-link
layers in mapping network-layer addresses to link-layer addresses.
3.32
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
• In this section we will study Internet Protocol version 4 (IPv4) which is a widely used
protocol in data communication over different kinds of networks as a delivery of
packets.
• IPv4 protocol has the responsibility of identifying hosts based upon their logical
addresses and to route data among them over the underlying network.
• IPv4 is a connectionless protocol for a packet switched network. Datagrams sent by the
same source to the same destination could arrive out of order. IPv4 relies on the
higher layer for reliability.
3.33
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
• A 20-byte header contains almost 13 multipurpose fields, which hold specific related
object information such as application, data type and source/destination addresses.
• IP header format contains following fields:
1. Version (VER): This 4-bits field defines the current version of IP protocol.
Currently the IP version is 4 (IPv4). This field tells the IPv4 software running in the
processing machine that the datagram has format of version 4 and all fields must
be treated as version 4. However, IP version 6 (IPv6) may replace version 4 in the
future.
2. Header Length (HLEN): This 4-bits field defines the total length of the header. The
length of the header is variable (between 20 to 60 bytes). When there are no
options, the header length is 20 bytes, and value is 5(5 × 4 =20). When the option
field is at its maximum size, the value of this field is 15(15 × 4 = 60).
3. Service Type: This 8-bits field previously known as service type, is now called
differentiated services. Both implementations are shown in Fig. 3.34.
D T R C
Precedence TOS bits Codepoint
3.34
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
(ii) Differentiated Services: The first 6 bits made the code-point subfield, and the last
2 bits are not used.
4. Total length: This 16-bits field defines the total length of the datagram including
the header. IPv4 datagram maximum size is 65,535, of which 20 to 60 bytes are the
header and the rest is data from the upper layer.
Length of data = Total length – Header length
5. Identification: This 16-bits field contains a specific number for primary data
identification. Uniquely identifies the datagram. Usually incremented by 1 each
time a datagram is sent. All fragments of a datagram contain the same
identification value. This allows the destination host to determine which fragment
belongs to which datagram. This field is used in fragmentation.
6. Flags (3-bits): As required by the network resources, if the IP packet is too large to
handle, these ‘flags’ tell if they can be fragmented or not. This router fragment
activity is controlled by following three flags:
Sr. No. Flag Description
1. 0 Reserved, must be zero.
DF (Do not 0 means allow fragmentation;
2.
Fragment) 1 means do not allow fragmentation.
0 means that this is the last fragment of the
MF (More
3. datagram;
Fragments)
1 means that additional fragments will follow.
7. Fragmentation Offset: This 13-bits offset tells the exact position of the fragment in
the original IP packet. This field is used in fragmentation.
8. Time To Live (TTL) (8 bit): Every datagram has a limited lifetime on the Internet.
This field is used to control the maximum number of hops (routers) visited by the
datagram. To avoid looping in the network, every packet is sent with some TTL
value set, which tells the network how many routers (hops) this packet can cross.
At each hop, its value is decremented by one and when the value reaches zero, the
packet is discarded.
9. Protocol: This 8-bits field defines the higher level protocol that uses the services of
IPv4. IPv4 protocol carries data from different other protocols (TCP, UDP, ICMP,
etc.), the value of this field helps the receiving network layer know to which
protocol the data belong.
10. Header Checksum: This 18-bits field is used for error detection.
11. Source address: This 32-bits field defines the source address of a datagram.
12. Destination address: This 32-bits field defines the destination address of a
datagram.
13. Options: This optional field may contain values for options such as Security,
Record Route, Time Stamp, etc.
3.35
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
3.36
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
Offset = 0000/8 = 0
0000 1399
Offset = 0000/8 = 0
Offset = 1400/8 = 175
1400 2799
Byte 0000 Byte 3999
Offset = 2800/8 = 350
2800 3999
1420
14,567 1 000
820
Bytes 0000-1399 14,567 1 175
Fragment 1
4020
14,567 0 000 1420 Bytes 1400-2199
14,567 1 175
Fragment 2.1
620
Bytes 0000-3999 14,567 1 275
Bytes 1400-2799
Original datagram
Fragment 2
Bytes 2800-3999
Fragment 3
3.38
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
3.5.4 Options
• The header of the IP datagram is made of two parts namely, a fixed part and a variable
part.
• The fixed part is 20 bytes long, and the variable part comprises the options, which can
be a maximum of 40 bytes.
• Options, as the name implies, are not required for a datagram. They can be used for
network testing and debugging.
• Fig. 3.39 shows the format of an option.
3.39
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
Options Types:
• Fig. 3.40 shows types of options.
• Options are not required for a datagram, they are used for network testing and
debugging.
No operation
Single-byte
End of option
Options
Record route
Timestamp
• A Home Agent (HA) stores information about mobile nodes whose permanent home
address is in the home agent's network.
• The HA acts as a router on a Mobile Host's (MH) home network which tunnels
datagrams for delivery to the MH when it is away from home, maintains a Location
Directory (LD) for the MH.
• A Foreign Agent (FA) stores information about mobile nodes visiting its network.
Foreign agents also advertise care of addresses, which are used by Mobile IP.
• If there is no foreign agent in the host network, the mobile device has to take care of
getting an address and advertising that address by its own means.
• A Mobile Node (MN) is responsible for discovering whether it is connected to its home
network or has moved to a foreign network. HA’s and FA’s broadcast their presence
on each network to which they are attached.
• A foreign network is the network in which a mobile node is operating when away
from its home network.
• Whenever the mobile node moves, it registers its new care of address with its home
agent. The home agent forwards the packet to the foreign network using the care of
address.
• The delivery requires that the packet header is modified so that the care of address
becomes the destination IP address.
• This new header (See Fig. 3.42) encapsulates the original packet, causing the mobile
node's home address to have no impact on the encapsulated packet's routing. This
phenomenon is called tunneling.
• Fig. 3.41 shows architecture of Mobile IP.
3.42
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
3.43
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
Step 3: At the foreign network, the incoming IP datagram is intercepted by the foreign
agent. The foreign agent is the counterpart of the home agent in the foreign
network. The foreign agent strips off the outer IP header, and delivers the
original datagram to X.
Step 4: A intends to respond to this message and sends traffic to M. In this
example, M is not mobile; therefore M has a fixed IP address. For routing X’s
IP datagram to M, each datagram is sent to some router in the foreign
network. Typically, this router is the foreign agent. X uses M's IP static address
as the destination address in the IP header.
Step 5: The IP datagram from X to M travels directly across the network, using M’s IP
address as the destination address.
• To support the operations illustrated in the previous example, mobile IP needs to
support following three basic capabilities/functions:
1. Discovery: A mobile node uses a discovery procedure to identify prospective
home agents and foreign agents.
2. Registration: A mobile node uses a registration procedure to inform its home
agent of its care-of address.
3. Tunneling: Tunneling procedure is used to forward IP datagrams from a home
address to a care-of address.
3.6.2 Addressing
• The main problem that must be solved in providing mobile communication using the
IP protocol is addressing.
Stationary Hosts:
• The original IP addressing was based on the assumption that a host is stationary,
attached to one specific network. A router uses an IP address to route an IP datagram.
• An IP address has two parts namely, a prefix and a suffix. The prefix associates a host
to a network. For example, the IP address 10.3.4.24/8 defines a host attached to the
network 10.0.0.0/8. This implies that a host on the Internet does not have an address
that it can carry with itself from one place to another.
• The address is valid only when the host is attached to the network. If the network
changes, the address is no longer valid.
• Routers use this association to route a packet; they use the prefix to deliver the packet
to the network to which the host is attached. This scheme works perfectly with
stationary hosts.
1. Mobile Hosts: When a host moves from one network to another, the IP addressing
structure needs to be modified. The solutions are:
3.44
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
2. Changing the Address: One simple solution is to let the mobile host change its
address as it goes to the new network. The host can use DHCP to obtain a new
address to associate it with the new network. This approach has several
drawbacks.
(i) First, the configuration files would need to be changed.
(ii) Second, each time the computer moves from one network to another, it must
be rebooted.
(iii) Third, the DNS tables need to be revised so that every other host in the
Internet is aware of the change.
(iv) Fourth, if the host roams from one network to another during a transmission,
the data exchange will be interrupted.
• This is because the ports and IP addresses of the client and the server must remain
constant for the duration of the connection.
Two Addresses:
• The approach that is more feasible is the use of two addresses. The host has its original
address, called the home address, and a temporary address, called the care-of address.
• The home address is permanent; it associates the host to its home network, the
network that is the permanent home of the host.
• The care of address is temporary. When a host moves from one network to another,
the care-of address changes; it is associated with the foreign network, the network to
which the host moves.
3.6.3 Agents
• Mobile IP enables the transfer of information to and from mobile computers, such as
laptops and wireless communications.
• To make the change of address transparent to the rest of the Internet requires a home
agent and a foreign agent.
3.45
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
• Fig. 3.44 shows the position of a home agent relative to the home network and a
foreign agent relative to the foreign network.
• Home network is a network to which the mobile node originally belongs to as per its
assigned IP address (home address). Foreign Network is the current network to which
the mobile node is visiting (away from its home network).
• Fig. 3.44 shows Home Agent (HA) and Foreign Agent (FA).
1. Home Agent: The home agent is usually a router attached to the home network of
the mobile host. The HA acts on behalf of the mobile host when a remote host
sends a packet to the mobile host. The home agent receives the packet and sends it
to the foreign agent.
2. Foreign Agent: The foreign agent is usually a router attached to the foreign
network. The FA receives packets sent by the home agent and deliver them to the
mobile host.
2. A mobile host must also discover a foreign agent after it has moved to a foreign
network. This discovery consists of learning the care of address as well as the
foreign agent’s address.
• The discovery involves two types of messages namely, advertisement and solicitation.
Agent Advertisement:
• When a router advertises its presence on a network using an ICMP router
advertisement, it can append an agent advertisement to the packet if it acts as an
agent.
• Fig. 3.46 shows how an agent advertisement is piggybacking to the router
advertisement packet.
• Mobile IP does not use a new packet type for agent advertisement, it uses the router
advertisement packet of ICMP (Internet Control Message Protocol) and appends an
agent advertisement message.
• The field descriptions of agent advertisement in Fig. 3.46 are as follows:
1. Type (8-bit) field is set to l6.
3.47
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
2. Length (8-bit) field defines the total length of the extension message (not the
length of the ICMP advertisement message).
3. Sequence Number (16-bit) field holds the message number. The recipient can use
the sequence number to determine if a message is lost.
4. Lifetime field defines the number of seconds that the agent will accept requests. If
the value is a string of 1s, the lifetime is infinite.
5. Code field is an 8-bit flag in which each bit is set (1) or unset (0). The meanings of
the bits are shown in following table:
Bit Meaning
0 Registration required. No collocated care of addresses.
7 Unused (0).
6. Care-of Addresses field contains a list of addresses available for use as care of
addresses. The mobile host can choose one of these addresses. The selection of this
care-of address is announced in the registration request.
ICMP
Advertisement message
Agent Solicitation:
• When a mobile host has moved to a new network and has not received agent
advertisements, it can initiate an agent solicitation by using the ICMP solicitation
message to inform an agent that it needs assistance.
3.48
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
• Mobile IP does not use a new packet type for agent solicitation, it uses the router
solicitation packet of ICMP.
Phase II: Registration:
• This is the second phase in the Mobile IP process, where a mobile node registers its
current location with the foreign agent and the home agent.
• After a mobile host has moved to a foreign network and discovered the foreign agent,
it must register.
• There are following four aspects of registration:
1. The mobile host must register itself with the foreign agent.
2. The mobile host must register itself with its home agent. This is normally done by
the foreign agent on behalf of the mobile host.
3. The mobile host must renew registration if it has expired.
4. The mobile host must cancel its registration (deregistration) when it returns home.
• To register with the foreign agent and the home agent the mobile host uses a
registration request and a registration reply as shown in Figs. 3.47 and 3.48.
Registration Request:
• A registration request is sent from the mobile host to the foreign agent to register its
cartel address and also to announce its home address and home agent address.
• The foreign agent, after receiving and registering the request, relays the message to
the home agent.
• Note that the home agent now knows the address of the foreign agent because the IP
packet that is used for relaying has the IP address of the foreign agent as the source
address.
• Fig. 3.47 shows the format of the registration request.
Home address
Care of address
Identification
Extensions
3.49
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
Home address
Identification
Extensions
Fig. 3.48: Registration Reply Format
3.50
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
• The fields are similar to those of the registration request with the exceptions like the
value of the type field is 3, the code field replaces the flag field and shows the result of
the registration request (acceptance or denial). and the care-of address field is not
needed.
• Registration messages are encapsulated in a UDP user datagram. An agent uses the
well-known part 434; a mobile host uses an ephemeral port.
Phase III: Data Transfer:
• After agent discovery and registration, a mobile host can communicate with a remote
host.
• Fig. 3.49 shows the communication idea.
2. Better Header Format: IPv6 uses a new header format in which options are
separated from the base header and inserted when needed, between base header
and upper layer data. This simplifies and speeds up the routing process because
most of the options do not need to be checked by routers.
3. New Options: IPv6 has new options to allow additional functionalities.
4. Allowance for Extension: IPv6 is designed to allow the extension of the protocol if
required by new technologies or applications.
5. Support for Resource Allocation: In IPv6, the type of service field has been
removed, but a mechanism (called flow label) has been added to enable the source
to request special handling of packets. This mechanism can be used to support
traffic such as real time audio and video.
6. Support for More Security: The encryption and authentication options in IPv6
provide confidentiality and integrity of the packet.
7. Plug and Play: IPv6 includes plug and play in the standard specification. It
therefore must be easier for novice users to connect their machines to network, it
will be done automatically.
8. Clearer Specification: IPv6 follows good practices of IPv4, and rejects its minor
problems.
Abbreviation :
• Although IP addresses in hexadecimal format are very long, many of the digits are
zeros, in this case we can abbreviate the address.
• The leading zeros of the section (four digits between two colons) can be omitted. Only
leading zeros can be dropped, not the trailing zeros, (Refer Fig. 3.51).
Unabbreviated
Abbreviated
• Using this form of abbreviation, 0007 can be written as 7, 000F as F, and 0000 as 0.
Note that 3210 cannot be abbreviated.
• Further abbreviation is possible, if there are consecutive sections consisting of zeros
only.
• We can remove the zeros altogether and replace them with double semicolons. Refer
to the following Fig. 3.52. Note that this type of abbreviation is allowed only once per
address. If there are two runs of zero sections, only one of them can be abbreviated.
Abbreviated
More abbreviated
Fig. 3.52: Abbreviated Address with Consecutive Zeros
128
• The address space of IPv6 contains 2 addresses as shown below and this address
96
space is 2 times of the IPv4 address,
340,282,366,920,938,463,374,607,431,768,211,456
• IPv6 defines two types of unicast addresses namely, geographically based and
provider based.
• A provider based address is generally used. The fields for provider based address are
type identifier, Registry identifier, provider identifier, subscriber identifier, subnet
identifier, and node identifier.
2. Anycast Address:
• An anycast address is assigned to multiple interfaces (usually on multiple nodes). An
anycast address defines a group of computers that all share a single address.
• A packet sent to an anycast address must be delivered to exactly one of the members
of the group – the closest or the most easily accessible.
3.55
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
Features of IPv6:
1. Expanded Addressing Capabilities: IPv6 increases the IP address size from 32
bits to 128 bits, to support more levels in the addressing hierarchy, a much greater
number of addressable nodes, and simpler auto-configuration of addresses.
2. Support for Resource Allocation: In IPv6, the type-of-service field has been
removed, but two new fields, traffic class and flow label have been added to
enable the source to request special handling of the packet. This mechanism can
be used to support traffic such as real-time audio and video.
3. Support for More Security: The encryption and authentication options in IPv6
provide confidentiality and integrity of the packet. IPv6 basic specification
includes security in the form of packet encryption and source authentication
4. Header Format Simplification: Some IPv4 header fields have been dropped or
made optional, in IPv6 to reduce the common-case processing cost of packet han-
dling and to limit the bandwidth cost of the IPv6 header.
5. New Options: IPv6 has new options to allow for additional functionalities.
6. Auto-configuration: lPv6 basic specification includes address auto-configuration.
So, even a novice user can have conned his/her machine to the Internet.
7. Allowance for Extension: IPv6 is designed to allow the extension of the protocol if
required by new technologies or applications.
8. Scalability: IPv6 uses 128-bits address space and this address length is 4 times
longer than IPv4 (32 bits). Thus many more IP addresses can be added to the
Internet.
9. Mobility: IPv6 was designed keeping mobility in mind. This feature enables hosts,
(such as mobile phones) to roam around in different geographical areas and
remain connected with the same IP address. The mobility feature of IPv6 takes
advantage of auto IP configuration and Extension headers.
10. End to End Connectivity: Every system now has a unique IP address and can
traverse through the Internet without using NAT or other translating components.
After IPv6 is fully implemented, every host can directly reach other hosts on the
Internet, with some limitations involved like Firewall, organization policies, etc.
Extension headers
Data packet from upper layer
(optional)
Base Header:
• Fig. 3.58 shows the base header with its eight fields of IPv6 datagram.
32 bits
3.58
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
7. Source Address (128 bits) field identifies the original source of the datagram.
8. Destination Address (128 bits) field identifies the destination of the datagram.
• When Extension Headers are used, IPv6 Fixed Header’s Next Header field points to the
first Extension Header. If there is one more Extension Header, then the first Extension
Header’s ‘Next-Header’ field points to the second one, and so on.
• The last Extension Header’s ‘Next-Header’ field points to the Upper Layer Header.
Thus, all the headers point to the next one in a linked list manner.
• If the Next Header field contains the value 59, it indicates that there are no headers
after this header, not even Upper Layer Header.
• Each extension header is identified by a specific Next Header value, and the most
common values are given in Table 3.5.
3.59
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
• IPv6 extension headers are optional but, when used, have specific ordering
requirements that must be followed. This prevents the destination node from scanning
the packet and looking for a particular type of extension header so chat header call k
processed ahead of the others.
Table 3.5: Extension Headers must be supported as per RFC
Sr. Next Header
Extension Header Description
No. Value
1. Hop-by-Hop options header 0 Read by all devises in the
transit network.
2. Routing header 43 Contains methods to support
making routing decisions.
3. Fragment header 44 Contains parameters of
datagram fragmentation.
4. Destination Options header 60 Read by destination devices.
5. Authentication header 51 Information regarding
authenticity.
6. Encapsulating Security 50 Encryption information.
Payload (ESP) header
• The sequence of Extension Headers should be:
IPv6 header
Routing header
Fragment header
Authentication header
Upper-layer header
Fig. 3.60
• These headers:
1. should be processed by First and subsequent destinations.
2. should be processed by Final Destination.
3.60
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
• Extension Headers are arranged one after another in a linked list manner, as depicted
in the Fig. 3.61.
Fig. 3.61
• When a network device has multiple paths to reach a destination, it always selects one
path by preferring it over others. This selection process is termed as Routing.
• Routing is done by special network devices called routers or it can be done by means
of software processes.
• Routing is the process of establishing the routes that data packets must follow to reach
the destination.
• Routing is a process of selecting the path along which the data can be transferred from
source to the destination. Routing is performed by a special device known as a router.
• Routing is a process which is performed by layer 3 (network layer) devices in order to
deliver the packet by choosing an optimal path from one network to another.
• In internetworking, routing the process of moving a packet of data from source to
destination.
• Routing is an activity that transmits information from a source address to a
destination address through an interconnected network.
• When a router receives an IP packet, the router searches its routing table for the best
matching route based on the destination IP address of the packet and forwards the
packet through the outbound interface or next-hop IP address for the route.
• The routing table contains the routing entries (routes) learned by the router in various
ways. The router can obtain routing entries in static or dynamic mode and maintain
its own routing table.
Role of Router:
• A router selects routes and forwards packets. Upon receiving a packet, a router selects
a proper path, which may have one or multiple hops, to send the packet to the next
router according to the destination address in the packet. The last router is responsible
for sending the packet to the destination host.
• A route is a path along which packets are sent from the source to the destination.
When multiple routes are available to send packets from a router to the destination,
the router can select the optimal route from an IP routing table.
• There are following three types of routing:
1. Static routing is a process in which we have to manually add routes in the routing
table.
2. Dynamic routing makes automatic adjustment of the routes according to the
current state of the route in the routing table.
3.62
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
3. Default routing is the method where the router is configured to send all packets
towards a single router (next hop). It doesn’t matter to which network the packet
belongs, it is forwarded out to the router which is configured for default routing.
A 0 1 2 3 2 1 2
B 1 0 1 2 1 2 3
C 2 1 0 2 1 3 3
D 3 2 2 0 1 2 2
E 2 1 1 1 0 3 2
F 1 2 3 2 3 0 1
G 2 3 3 1 2 1 0
• Distance vector routing protocols are like road signs because routers must make
preferred path decisions based on a distance or metric to a network.
• Just as travelers trust a road sign to accurately state the distance to the next town, a
distance vector router trusts that another router is advertising the true distance to the
destination network.
3.65
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
• In distance vector routing, the least-cost route between any two nodes is the route with
minimum distance (mi). In this protocol, as the name implies, each node maintains a
vector (table) of minimum distances to every node.
• The table at each node also guides the packets to the desired node by showing the next
stop in the route (next-hop routing).
• The table for node A in Fig. 3.64 shows how we can reach any node from this node. For
example, our least cost to reach node E is 6. The route passes through C.
• Initialization: The tables in Fig. 3.64 are stable; each node knows how to reach any
other node and the cost. At the beginning, however, this is not the case. Each node can
know only the distance between itself and its immediate neighbors, those directly
connected to it. So for the moment, we assume that each node can send a message to
the immediate neighbors and find the distance between itself and these neighbors.
The distance for any entry that is not a neighbor is marked as infinite (unreachable).
• Sharing: The whole idea of distance vector routing is the sharing of information
between neighbors. Although node A does not know about node E, node C does. So if
node C shares its routing table with A, node A can also know how to reach node E. On
the other hand, node C does not know how to reach node D, but node A does. If node A
shares its routing table with node C, node C also knows how to reach node D. In other
words, nodes A and C, as immediate neighbors, can improve their routing tables if
they help each other.
3.66
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
Bellman-Ford Algorithm:
• The Bellman–Ford algorithm is an algorithm that computes shortest paths from a
single source vertex to all of the other vertices in a weighted digraph.
• Bellman-Ford algorithm solves single shortest path problem in which edge weight may
be negative but no negative cycle exists.
• The Bellman–Ford algorithm works correctly when some of the edges of the directed
graph G may have negative weight. When there are no cycles of negative weight, then
we can find out the shortest path between source and destination.
• It is slower than Dijkstra's algorithm but more versatile, as it is capable of handling
some of the negative weight edges. This algorithm detects the negative cycle in a graph
and reports their existence.
• Based on the "Principle of Relaxation" in which more accurate values gradually
recovered an approximation to the proper distance by until eventually reaching the
optimum solution.
• Given a weighted directed graph G = (V, E) with source s and weight function w: E → R,
the Bellman-Ford algorithm returns a Boolean value indicating whether or not there is
a negative weight cycle that is attainable from the source.
• If there is such a cycle, the algorithm produces the shortest paths and their weights.
The algorithm returns TRUE if and only if a graph contains no negative - weight cycles
that are reachable from the source.
Recurrence Relation:
distk [u] = [min[distk-1 [u],min[ distk-1 [i]+cost [i,u]]] as i except u.
k → k is the source vertex
u → u is the destination vertex
i → no of edges to be scanned concerning a vertex.
• Bellman-Ford algorithm can be used in many applications in graph theory. Given a
graph and a source vertex src in the graph, find shortest paths from src to all vertices
in the given graph.
• The graph may contain negative weight edges. Time complexity of this algorithm is
O(VE) which is more than Dijkstra’s algorithm O(VlogV) with the use of Fibonacci
heap.
Input: Graph with source vertex src.
Output: Shortest distance to all vertices from src. If there is a negative weight cycle,
then shortest distances are not calculated, negative weight cycle is reported.
Step 1: This step initializes distances from source to all vertices as infinite and
distance to source itself is 0. Array dis[ ] of size v will keep these values.
3.68
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
Fig. 3.67
Solution: List of edges: (a, b), (a, c), (a, d), (b, e), (c, b), (c, e), (d, c), (d, f), (e, g), (f, g).
Initially:
Node A B C D E F G
Distance 0 ∞ ∞ ∞ ∞ ∞ ∞
Distance From
Fig. 3.68
3.69
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
Iteration 1:
Node A B C D E F G
Distance 0 3 3 5 5 4 7
Distance From 0 C D A B D F
Fig. 3.69
Iteration 2:
Node A B C D E F G
Distance 0 1 3 5 2 4 5
Distance From 0 C D A B D E
Fig. 3.70
Iteration 3:
Node A B C D E F G
Distance 0 1 3 5 0 4 3
Distance From 0 C D A B D E
Fig. 3.71
Example 2: Fig. 3.72 shows a map with nodes and lines and the cost of each line is
given over the line. Find the least cost between the nodes.
Fig. 3.72
Solution: Here, first we list all the edges and their weights.
3.70
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
Vertices
1 2 3 4 5
No. of edges 1 0 6 5 ∞ ∞
traversed 2 0 3 5 5 8
3 0 3 5 2 8
4 0 3 5 2 5
Example 3: Fig. 3.73 shows a map with nodes and lines and the cost of each line is
given over the line. Find the least cost between the nodes.
Fig. 3.73
Solution:
Step 1: Consider A as a source index.
No. of Nodes A B C D E
Distance 0 6 7 ∞ ∞
Distance From A A A
Fig. 3.74
Step 2: Consider Vertex B.
No. of Nodes A B C D E
Distance 0 6 7 11 2
Distance From A A A B B
Fig. 3.75
3.71
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
No. of Nodes A B C D E
Distance 0 6 7 9 2
Distance From A A A E B
Fig. 3.76
Step 4: Consider Vertex C.
No. of Nodes A B C D E
Distance 0 6 7 4 2
Distance From A A A C B
Fig. 3.77
No. of Nodes A B C D E
Distance 0 2 7 4 2
Distance From A D A C B
Fig. 3.78
No. of Nodes A B C D E
Distance 0 2 7 4 –2
Distance From A D A C B
Fig. 3.79
3.72
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
No. of Nodes A B C D E
Distance 0 2 7 4 –2
Distance From A D A C B
Fig. 3.80
Result:
Vertex Distance From A
A 0
B 2
C 7
D 4
E –2
3.73
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
• The Fig. 3.82 shows a simple domain with five nodes. Each node uses the same
topology to create a routing table, but the routing table for each node is unique
because the calculations are based on different interpretations of the topology.
• This is analogous to a city map. While each person may have the same map, each
needs to take a different route to reach her specific destination
3.74
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
} // Dijkstra
// Iteration
Repeat
{
// Finding the next node to be added
Path = Path ∪ i if Di is minimum among all remaining nodes
// Update the shortest distance for the rest
for (j = 1 to M) // M number of remaining nodes
{
Dj = minimum (Dj, Dj + cij)
}
} until (all nodes included in the path, M = 0)
Examples:
Example 1: Fig. 3.83 shows the formation of the shortest path tree for the graph of
seven nodes.
In the initialization step, node A selects itself as the root. It then assigns shortest path
distances to each node on the topology. The nodes that are not neighbors of A receive a
shortest path distance value of infinity.
3.76
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
Fig. 3.83
Solution: In each iteration, the next node with minimum distance is selected and
added to the path. Then all shortest distances are updated with respect to the last node
selected. For example, in the first iteration, node B is selected and added to the path and
the shortest distances are updated with respect to node B (The shortest distances for C and
E are changed, but for the others remain the same). After six iterations, the shortest path
tree is found for node A. Note that in iteration 4, the shortest path to G is found via C, but
in iteration 5, a new shortest route is discovered (via G); the previous path is erased and
the new one is added.
Calculation of Routing Table from Shortest Path Tree (SPT):
Each node uses the shortest path tree found in the previous discussion to construct its
routing table. The routing table shows the cost of reaching each node from the root.
Routing table for node A using the shortest path tree found in above Fig. 3.84.
A 0 –
B 2 –
C 7 B
D 3 –
E 6 B
F 8 B
G 9 B
3.77
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
Fig. 3.85
Solution:
The set sptSet is initially empty and distances assigned to
vertices are {0, INF, INF, INF, INF, INF, INF, INF} where INF
indicates infinite. Now pick the vertex with minimum distance
value. The vertex 0 is picked, including it in sptSet.
So sptSet becomes {0}. After including 0 to sptSet, update distance
values of its adjacent vertices. Adjacent vertices of 0 are 1 and 7.
Fig. 3.86
The distance values of 1 and 7 are updated as 4 and 8. The
vertices included in SPT are shown in black colour, (See Fig.
3.86).
Pick the vertex with minimum distance value and not already included in SPT (not in
sptSET). The vertex 1 is picked and added to sptSet. So sptSet now becomes {0, 1}. Update
the distance values of adjacent vertices of 1. The distance value of vertex 2 becomes 12,
(See Fig. 3.87).
Pick the vertex with minimum distance value and not already included in SPT (not in
sptSET). Vertex 7 is picked. So sptSet now becomes {0, 1, 7}. Update the distance values of
adjacent vertices of 7. The distance value of vertex 6 and 8 becomes finite (15 and 9
respectively), (See Fig. 3.88).
Fig. 3.87
Fig. 3.88
Pick the vertex with minimum distance value and not already included in SPT (not in
sptSET). Vertex 6 is picked. So sptSet now becomes {0, 1, 7, 6}. Update the distance values
of adjacent vertices of 6, (See Fig. 3.89). The distance value of vertex 5 and 8 are updated.
3.78
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
We repeat the above steps until sptSet doesn’t include all vertices of given graph.
Finally, we get the Shortest Path Tree (SPT) as shown in Fig. 3.90.
3.79
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
7. Distance vector routing updates full Link state routing updates only the link
routing table. state.
8. Example of distance vector routing Example of link state routing protocols
protocols is RIP. is OSPF.
9. The utilization of CPU and memory in Higher utilization of CPU and memory.
distance vector routing is lower than
the link state routing.
10. Distance vector routing does not have Link state routing works best for
any hierarchical design. hierarchical routing design and in
networks where fast convergence is
crucial.
3.80
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
• Initialization: At the beginning, each speaker node can know only the reach ability of
nodes inside its autonomous system.
• In Fig. 3.91, Node A1 is the speaker node for AS1, B1 for AS2, C1 for AS3, and D1 for
AS4. Node A1 creates an initial table that shows A1 to A5 are located in ASI and can be
reached through it. Node B1 advertises that B1 to B4 are located in AS2 and can be
reached through B1 and so on.
• A path vector protocol is a network routing protocol which maintains the path
information that gets updated dynamically.
• Updates which have looped through the network and returned to the same node are
easily detected and discarded. Border Gateway Protocol (BGP) is an example of a path
vector protocol.
Disadvantages of Path Vector Routing:
1. Lack of Congestion Control: In path vector routing, the routing policies may be
heterogeneous across the ASs. The network traffic or the link congestion may not
be the criterion for path selection in the policies of any AS. Moreover, the path
vector routing protocol converges very quickly and stabilizes. Thus, it may not be
suitable for handling network congestion efficiently.
2. Complex: Path vector routing can be very complex to configure in the network.
3.81
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
3. Load Balancing: Load balancing between the source and destination can be done
by disseminating packets through each of the alternative paths, multiple paths for
packet dissemination are not selected to support load balancing.
4. Inefficient Load Balancing: The basic path vector routing protocol does not
support load balancing. The path vector table may contain alternative paths to a
destination, but an alternative path is selected generally on the failure of an
existing path.
PRACTICE QUESTIONS
Q.I Multiple Choice Questions:
1. Which layer is responsible for the delivery of individual packets from the source to
the destination host?
(a) Physical layer (b) Network layer
(c) Data link layer (d) Transport layer
2. Network layer services include ______.
(a) Routing and Forwarding (b) Packetizing
(c) Flow and Error control (d) All of these
3. Which is a situation in the network layer in which too many datagrams are
present in an area of the Internet?
(a) Congestion (b) Packetizing
(c) Flow and Error control (d) All of these
4. The two congestion control mechanisms are ______.
(a) Open loop (b) Closed loop
(c) Both (a) and (b) (d) None of these
5. Which protocol is a set of rules that dictate how data should be delivered over the
Internet
(a) IP (b) UDP
(c) TCP (d) All of these
6. Which is an address used to uniquely identify a device on an IP network?
(a) UDP (b) IP
(c) TCP (d) All of these
7. The parts of an IP are ______.
(a) Network ID (b) Host ID
(c) Both (a) and (b) (d) None of these
8. Which is a 32-bits IP address?
(a) IPv4 (b) IPv6
(c) Both (a) and (b) (d) None of these
3.82
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
3.83
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
3.84
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
28. Which is a routing algorithm in which every router maintains a database with one
entry for each possible destination on the network?
(a) Path Vector (b) Link State
(c) Distance Vector (d) None of these
ANSWERS
1. (b) 2. (d) 3. (a) 4. (c) 5. (a) 6. (b) 7. (c)
8. (a) 9. (b) 10. (a) 11. (c) 12. (c) 13. (a) 14. (b)
15. (b) 16. (a) 17. (c) 18. (a) 19. (c) 20. (c) 21. (d)
22. (b) 23. (c) 24. (b) 25. (c) 26. (b) 27. (a) 28. (c)
Q. II Fill in the Blanks:
1. ______ layer is responsible for routing packets from the source host to the
destination host.
2. ______ control in the network layer is the process of detecting and correcting data
packets that have been corrupted or lost during transmission.
3. The network layer receives the data from the upper layers and creates its own
packets by encapsulating these packets. The process is known as ______.
4. ______ control refers to the techniques used to control or prevent congestion.
5. Congestion control refers to techniques and mechanisms that can either prevent
congestion, before it ______, or remove congestion, after it has ______.
6. The Internet Protocol Address (IP Address) is a unique ______ assigned to every
computing device, such as personal computers, tablets, and smartphones use to
identify itself and communicate with other devices in the IP network.
7. ______ is responsible for packetizing, forwarding and delivery of a packet at the
network layer.
8. Dividing a large block of addresses into several contiguous sub-blocks and
assigning these sub-blocks to different smaller networks is called ______.
9. In ______ addressing, the address space is divided into five classes namely, A, B, C, D
and E.
10. A ______ mask (or number) is used to determine the number of bits used for the
subnet and host portions of the address.
11. When IP is used as a connection less protocol, ______ is based on the destination
address of the IP datagram when the IP is used as a connection oriented protocol,
forwarding is based on the label attached to an IP datagram.
12. Internet Protocol is ______ and unreliable protocol.
3.85
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
3.86
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
4. Open loop congestion control policies are applied to prevent congestion after it
happens.
5. In general, we can divide congestion control mechanisms into two broad
categories namely, open-loop congestion control (prevention) and closed-loop
congestion control (removal).
6. Backpressure is a node-to-node congestion control technique that propagate in the
opposite direction of data flow.
7. Choke packet technique is applicable to both virtual networks as well as datagram
subnets. A choke packet is a packet sent by a node to the source to inform it of
congestion.
8. When too many packets are present in a subnet (or part of a subnet), performance
degrades. Packets sent are not equal to the packets received. This situation is called
flow control.
9. IPv4 is a 32-bits IP address.
32
10. The address space of IPv4 is 2 or 4,294,967,296.
11. A mask used to determine what subnet an IP address belongs to.
12. In a class C address, the first octet would always start with ‘10’. Thus, class C
addresses range from 192.0.0.0 to 223.255.255.255.
13. Network Address Translation (NAT) is a process in which one or more local IP
address is translated into one or more Global IP address and vice versa in order to
provide Internet access to the local hosts.
14. The supernets are created through the use of subnet masks.
15. The subset mask identifies which hits in the IP address are to be used to represent
the network subnet portion of an IP address.
16. Gateways work on a network layer and provide mechanism to route data to its
destination.
17. Mobile IP has two addresses for a mobile host (home address: permanent) it
associates the host with its home network and Care-of address Changes as the
mobile host moves from one network to another and it is associated with the
foreign network.
18. Internet Protocol version 6 (IPv6) is the most recent version of the Internet
Protocol (IP).
19. IPv6 is the next generation Internet Protocol (IP) standard intended to eventually
replace IPv4.
20. Subnetting is the process of dividing (partitioning) a network into several smaller
networks (subnets).
3.87
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
21. A router is a device that forwards packets between networks by processing the
routing information included in the packet.
22. RIP (Routing Information Protocol) is the best example of a protocol using distance
vector.
23. Subnetting, also called Classless Inter-Domain Routing (CIDR), is a way to aggregate
multiple Internet addresses of the same class.
24. CIDR notation specifies the number of bits set to a 1 that make up the subnet mask.
ANSWERS
13. (T) 14. (F) 15. (T) 16. (F) 17. (T) 18. (T)
19. (T) 20. (T) 21. (T) 22. (T) 23. (F) 24. (T)
Q. IV Answer the following Questions:
(A) Short Answer Questions:
1. What are the services provided by the network layer?
2. List functions of the network layer.
3. What is flow and error control?
4. Define congestion. When it occurs.
5. List types of congestion control mechanisms.
6. What is an IP address?
7. List classes for classful IP addressing.
8. Define masking.
9. What is meant by subnetting?
10. Define supernetting.
11. What is meant by classless addressing/
12. What is NAT?
13. List network layer protocols.
14. What is fragmentation?
15. What is Mobile IP?
16. List three phases of Mobile IP.
17. What is IPv6?
18. List address for IPv6.
19. What is an extension header?
20. Define routing.
3.88
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
April 2017
1. Find out class, netid and hostid of IP address 126.25.21.1. [4 M]
Ans. Refer to Section 3.3.
3.89
Computer Networks – I (S.Y.B.Sc. Comp. Science) Network Layer
October 2017
1. What is fragmentation? [1 M]
Ans. Refer to Section 3.5.3.
2. State the class of the IP address 128.89.0.26. [1 M]
Ans. Refer to Section 3.3.
3. Explain open and closed loop congestion control mechanisms. [5 M]
Ans. Refer to Section 3.2, Points (1) and (2).
April 2018
1. Identify the class of the IP addresses 192.168.60.12 and 10.11.1.1. [1 M]
Ans. Refer to Section 3.3.
2. Define subnetting. [1 M]
Ans. Refer to Section 3.3.3.
3. What is routing? Explain the desirable characteristics. [5 M]
Ans. Refer to Section 3.8.1.
October 2018
1. What is fragmentation? [1 M]
Ans. Refer to Section 3.5.3.
2. Define routing. [1 M]
Ans. Refer to Section 3.8.1.
3. What is congestion? [5 M]
Ans. Refer to Section 3.2.
4. What are the services provided by the network layer? [5 M]
Ans. Refer to Section 3.1.
5. List the congestion control policies used at the network layer. [2 M]
Ans. Refer to Section 3.2.
April 2019
1. Convert dotted decimal IP address to binary address 255.255.0.0. [1 M]
Ans. Refer to Section 3.3.
2. What is congestion? [1 M]
Ans. Refer to Section 3.2.
3. Explain Host id and Net id of IP address classes. [4 M]
Ans. Refer to Section 3.3.
3.90
CHAPTER
4
Transport Layer
Objectives…
To learn Transport Layer with its Services
To study UDP and TCP Protocols
4.0 INTRODUCTION
• The transport layer is responsible for providing services to the application layer, it
receives services from the network layer.
• Transport layer, (layer 4) in the TCP/IP model is responsible for process-to-process
communication, flow control, congestion control and so on.
• The original TCP/IP protocol suite specifies two protocols for the transport layer
namely, UDP and TCP.
• A new transport layer protocol SCTP is recently developed for signaling message
transport over IP networks.
4.1
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
• The network layer is responsible for delivery of datagram between two hosts. This is
called host-to-host communication.
• Real communication takes place between two processes (application programs) in a
network. This is called process-to process communication.
• The transport layer is responsible for process-to-process communication, the delivery
of a packet, part of a message, from one process to another.
• A network layer protocol can deliver the message only to the destination computer.
However, this is an incomplete delivery.
• The message still needs to be handed to the correct process. This is where a transport
layer protocol takes over.
• A transport layer protocol is responsible for delivery of the message to the appropriate
process.
• Fig. 4.1 shows the domains of a network layer and a transport layer.
Processes Processes
Node to node: Data link layer
Host to host: Network layer
Process to process: Transport layer
Internet
Process to process
• However, Operating Systems (OS) today support both multiuser and multi-
programming environments.
• A remote computer can run several server programs at the same time, just as several
local computers can run one or more client programs at the same time.
• For communication, we must define the local host, local process, remote host, and
remote process.
• The local host and the remote host are defined using IP addresses. To define the
processes, we need second identifiers, called port numbers.
• In the TCP/IP protocol suite, the port numbers are integers between 0 and 65,535 (16
bits).
• Port numbers are 16 bit long that help identify which process is sending or receiving
data on a host.
• The client program defines itself with a port number, called the ephemeral port
number. The word ‘ephemeral’ means ‘short lived’ and is used because the life of a
client is normally short.
• The server process must also define itself with a port number. This port number,
however, cannot be chosen randomly.
• If the computer at the server site runs a server process and assigns a random number
as the port number, the process at the client site that wants to access that server and
use its services will not know the port number.
• TCP/IP has decided to use universal port numbers for servers; these are called well-
known port numbers.
• Every client process knows the well-known port number of the corresponding server
process.
• For example, while the Daytime client process use an ephemeral (temporary) port
number 52,000 to identify itself, the Daytime server process must use the well-known
(permanent) port number 15 (See Fig. 4.2).
Daytime client Daytime server
52,000 15
Data 15 52,000
15 52,000 Data
4.3
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
Addressing:
• To deliver the data, we need an address. At the data link layer, we need a physical
(MAC) address. A frame in the data link layer needs a destination MAC address for
delivery and source MAC address for reply.
• At the network layer, we need an IP address. A datagram in the 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 port address/number
to choose among multiple processes running on the destination host.
• The destination port number is needed for delivery; the source port number is needed
for the reply.
• The IP addresses and port numbers play different roles in selecting the final
destination of data. The role of destination IP address is to define the host among the
different hosts.
• Once the host has been selected, the port number starts, the port number defines one
of the processes on this particular host. This is shown in Fig. 4.3.
15
Port number
15
selects the process
190.15.25.5
IP header IP address
190.15.25.5
selects the host
Transport layer 15
header
4.4
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
Registered
1024 49,151
• The sender socket address is passed to the process in case it needs to respond to the
message received.
• Multiplexing and demultiplexing are the two very important services that are
performed by the transport layer.
• The transport layer at the source performs multiplexing while the transport layer at
the destination performs demultiplexing as shown in Fig. 4.7.
• Whenever an entity accepts items from more than one source, it is referred to as
multiplexing (many to one); whenever an entity delivers items to more than one
source, it is referred to as demultiplexing (one to many).
• Fig. 4.7 shows communication between a client and two servers. Three client
processes are running at the client site namely, P1, P2, and P3.
• The processes P1 and P3 need to send requests to the corresponding server process
running in a server.
• The client process P2 needs to send a request to the corresponding server process
running at another server.
• The transport layer at the client site accepts three messages from the three processes
and creates three packets. It acts as a multiplexer.
• The packets 1 and 3 use the same logical channel to reach the transport layer of the
first server.
• When they arrive at the server, the transport layer does the job of a multiplexer and
distributes the messages to two different processes.
• The transport layer at the second server receives packet 2 and delivers it to the
corresponding process.
4.6
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
• It encapsulates the messages in packets and pushes them to the receiving transport
layer.
• The receiving transport layer has also a double role, it is the consumer for the packets
received from the sender. It is also a producer; it needs to decapsulate the messages
and deliver them to the application layer.
• The last delivery, however, is normally a pulling delivery; the transport layer waits
until the application-layer process asks for messages.
• Fig. 4.8 shows that we need at least two cases of flow control namely, from the sending
transport layer to the sending application layer and from the receiving transport layer
to the sending transport layer.
4.8
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
• When the producer pushes the items, the consumer may be overwhelmed and there is
a need for flow control, in the opposite direction, to prevent the discarding of the
items.
• In other words, the consumer needs to warn the producer to stop the delivery and to
inform it when it is ready again to receive the items.
• When the consumer pulls the items, it requests them when it is ready. In this case,
there is no need for flow control.
4.1.5.2 Buffers
• Although flow control in the transport layer can be implemented in several ways, one
of the solutions is normally to use two buffers. One at the sending transport layer and
the other at the receiving transport layer.
• A buffer is a set of memory locations that can hold packets at the sender and receiver.
The flow control communication can occur by sending signals from the consumer to
producer.
• When the buffer of the sending transport layer is full, it informs the application layer
to stop passing chunks of messages; when there are some vacancies, it informs the
application layer that it can pass message chunks again.
• When the buffer of the receiving transport layer is full, it informs the sending
transport layer to stop sending packets.
• When there are some vacancies, it informs the sending transport layer that it can send
messages again.
• For example: The consumers communicate with the producers on two occasions such
as, when the buffer is full and when there are vacancies. If the two parties use a buffer
of only one slot, the communication can be easier. Assume that each transport layer
uses one single memory location to hold a packet. When this single slot in the sending
transport layer is empty, the sending transport layer sends a note to the application
layer to send its next chunk; when this single slot in the receiving transport layer is
empty, it sends an acknowledgment to the sending transport layer to send its next
packet. As we will see later, this type of flow control, using a single-slot buffer at the
sender and the receiver, is inefficient.
4.10
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
4.1.6.2 Acknowledgements
• In error control, we can use both positive and negative signals as error control. The
receiver side can send an acknowledgement (ACK) for each or a collection of packets
that have arrived safe and sound.
• The receiver can simply discard the corrupted packets. The sender can detect lost
packets if it uses a timer.
• When a packet is sent, the sender starts a timer; when the timer expires, if an ACK
does not arrive before the timer expires, the sender resends the packet.
• Duplicate packets can be silently discarded by the receiver. Out-of-order packets can
be either discarded (to be treated as lost packets by the sender), or stored until the
missing ones arrive.
(a) Four Packets have been Sent (b) Five Packets have been Sent
4.11
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
(c) Seven Packets have been Sent (d) Packet 0 has been Acknowledged
Window is Full Window Slides
• Fig. 4.11 shows the sliding window at the sender. The sequence number are modulo 16
(m = 4) and the size of the window is 7.
• Note that the sliding window is just an abstraction: the actual situation uses computer
variables to hold the sequence number of the next packet to be sent and the last packet
sent.
• Number of protocols show the sliding window using linear representation. The idea is
the same, but it normally takes less space on paper.
• Fig. 4.12 shows linear representation of the sliding window.
(a) Four Packets have been Sent (b) Five Packets have been Sent
(c) Seven Packets have been Sent (d) Packet 0 have been Acknowledged
• Both representations (circular and linear) of the sliding window, tell us the same
thing. If we take both sides of each part in Fig. 4.11 and bend them up, we can make
the same part in Fig. 4.12.
4.12
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
• The chunks are handed over to the connectionless transport protocol in order.
• However, since there is no dependency between the packets at the transport layer, the
packets may arrive out of order at the destination and will be delivered out of order to
the server process.
• In Fig. 4.13, we have shown the movement of packets using a timeline, but we have
assumed that the delivery of the process to the transport layer and vice versa are
instantaneous.
• The Fig. 4.13, shows that at the client site, the three chunks of messages are delivered
to the client transport layer in order (1, 2, and 3).
• Because of the extra delay in transportation of the second packet, the delivery of
messages at the server is not in order (1, 3, 2).
• If these three chunks (1, 2, and 3) of data belong to the same message, the server
process may have received a strange message.
4.14
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
• The data exchange can only happen after the connection establishment. After data
exchange, the connection needs to be teared down as shown in Fig. 4.14.
• As we mentioned before, the connection-oriented service at the transport layer is
different from the same service at the network layer.
• In the network layer, connection-oriented service means a coordination between the
two end hosts and all the routers in between.
• At the transport layer, connection-oriented service involves only the two hosts; the
service is end to end.
• This means that we should be able to make a connection-oriented protocol over either
a connectionless or connection-oriented protocol.
• Fig. 4.14 shows the connection establishment, data transfer, and teardown phases in a
connection-oriented service at the transport layer.
• Note that most protocols combine the third and fourth packets in the connection
establishment phase into one packet.
• TCP and SCTP, these two transport layer protocols are connection oriented.
• In the Internet protocol suite, the transport layer supports three protocols TCP, SCTP
and UDP. Out of which TCP and SCTP are connection oriented and reliable and UDP is
connectionless and unreliable.
• Fig. 4.15 shows the position of UDP, TCP and SCTP in the TCP/IP protocol suite.
Fig. 4.15
4.17
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
8 to 65,535 bytes
8 bytes
Header Data
0 16 31
3. Length: This 16-bits field defines the total length of the user datagram, header plus
data. This field is actually not necessary, because UDP is encapsulated in IP. IP has
total length and header length fields.
So, UDP length = IP length – IP header’s length
4. Checksum: This 16-bits field is used to detect errors over the entire user datagram.
• In UDP there is no relationship between the different user datagrams even if they are
coming from the same source process and going to the same destination program.
• The user datagrams are not numbered. There is no connection establishment and no
connection termination as is the case for TCP.
• Each user datagram can travel on a different path. One of the ramifications of being
connectionless is that the process that uses UDP cannot send a stream of data to UDP
and expect UDP to chop them into different related user datagrams.
• Instead each request must be small enough to fit into one user datagram. Only those
processes sending short messages, messages less than 65,507 bytes (65,535 minus 8
bytes for the UDP header and minus 20 bytes for the IP header), can use UDP.
3. Flow Control:
• UDP is a very simple protocol. There is no flow control, and hence no window
mechanism. The receiver may overflow with incoming messages.
• The lack of flow control means that the process using UDP should provide for this
service, if needed.
4. Error Control:
• There is no error control mechanism in UDP except for the checksum.
• Sender does not know if a message has been lost or duplicated. When the receiver
detects an error through the checksum, the user datagram is silently discarded.
• The lack of error control means that the process using UDP should provide for this
service if needed.
Checksum:
• UDP provides checksums for data integrity, and port numbers for addressing different
functions at the source and destination of the datagram.
• The UDP checksum calculation is different from IP. UDP’s checksum includes three
sections namely, a pseudo header, the UDP header and the data coming from the
application layer.
• The pseudo header is the part of the header of the IP packet in which the user
datagram is to be encapsulated with some fields filled with 0s.
• If the checksum does not include the pseudo header, a user datagram may arrive safe
and sound. If the IP header is corrupted, it may be delivered to the wrong host.
• The protocol field is added to confirm that the packet belongs to UDP. The value of
protocol for UDP is 17. If this value is changed during transmission, the checksum
calculation at the receiver will detect it and UDP drops the packet.
4.20
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
• The calculation of checksum and its inclusion in a user datagram are optional. If
checksum is not calculated, the field is filled with 1s.
Example: Fig. 4.19 shows the checksum calculation for a very small user datagram
with only 7 bytes of data. Since the data is odd, padding is added for checksum
calculation. The pseudo header as well as the padding will be dropped when the user
datagram is delivered to IP.
4.21
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
Multiplexer Demultiplexer
IP IP
• IP adds its own header, using the value 17 in the protocol field, indicating that the data
has come from the UDP protocol.
• The IP datagram is then passed to the data link layer. The data link layer receives the
IP datagram, adds its own header (and possibly a trailer), and passes it to the physical
layer.
• The physical layer encodes the bits into electrical or optical signals and sends it to the
remote machine.
Decapsulation in UDP:
• When the message arrives at the destination host, the physical layer decodes the
signals into bits and passes it to the data link layer.
• The data link layer uses the header (and the trailer) to check the data. If there is no
error, the header and trailer are dropped and the datagram is passed to IP.
• The IP software does its own checking. If there is no error, the header is dropped and
the user datagram is passed to UDP with the sender and receiver IP addresses.
• UDP uses the checksum to check the entire user datagram. If there is no error, the
header is dropped and the application data along with the sender socket address is
passed to the process.
• The sender socket address is passed to the process in case it needs to respond to the
message received.
4.23
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
7. Queuing:
• In UDP, queues are associated with ports as shown in Fig. 4.22.
• When a process starts, at the client site, it requests a port number from the Operating
System (OS). Some implementations create both an incoming and an outgoing queue
associated with each process while other implementations create only an incoming
queue associated with each process.
• Even if a process wants to communicate with multiple processes, it obtains only one
port number and eventually one outgoing and one incoming queue.
• The queues opened by the client are, in most cases, identified by ephemeral port
numbers. The queues function as long as the process is running.
• When the process terminates, the queues are destroyed. The client process can send
messages to the outgoing queue by using the source port number specified in the
request.
• UDP removes the messages one by one, and after adding the UDP header, delivers
them to IP. An outgoing queue can overflow.
• If this happens, the operating system can ask the client process to wait before sending
any more messages.
• When a message arrives for a client, UDP checks to see if an incoming queue has been
created for the port number specified in the destination port number field of the user
datagram.
• If there is such a queue, UDP sends the received user datagram to the end of the
queue. If there is no such queue, UDP discards the user datagram and asks the ICMP
protocol to send a port unreachable message to the server.
• All of the incoming messages for one particular client program, whether coming from
the same or a different server, are sent to the same queue. An incoming queue can
overflow.
• If this happens, UDP drops the user datagram and asks for a port unreachable message
to be sent to the server.
• At the server site, the mechanism of creating queues is different. In its simplest form, a
server asks for incoming and outgoing queues using its well-known port when it starts
running. The queues remain open as long as the server is running.
• When a message arrives for a server, UDP checks to see if an incoming queue has been
created for the port number specified in the destination port number field of the user
datagram.
• If there is such a queue, UDP sends the received user datagram to the end of the
queue. If there is no such queue, UDP discards the user datagram and asks the ICMP
protocol to send a port unreachable message to the client.
4.24
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
• All of the incoming messages for one particular server, whether coming from the same
or a different client, are sent to the same queue.
• An incoming queue can overflow. If this happens, UDP drops the user datagram and
asks for a port unreachable message to be sent to the client.
• When a server wants to respond to a client, it sends messages to the outgoing queue
using the source port number specified in the request.
• UDP removes the messages one by one, and, after adding the UDP header, delivers
them to IP.
• An outgoing queue can overflow. If this happens, the operating system asks the server
to wait before sending any more messages.
8. Congestion Control:
• UDP does not provide congestion control because it is a connectionless protocol. UDP
assumes that the packets sent are small and sporadic, and cannot create congestion in
the network.
• This UDP assumption may or may not be true today when UDP is used for real-time
transfer of audio and video.
• The services offered by TCP to the process at the application layer are explained
below:
1. Process-to-Process Communication:
• Like UDP, TCP provides process-to-process communication using port numbers.
• Port numbers are 16 bit long that help identify which process is sending or receiving
data on a host.
• Table 4.1 shows some well-known port numbers used by TCP.
4.26
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
Stream of bytes
TCP TCP
4.27
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
• Fig. 4.24 shows the movement of the data in one direction. At the sending side, the
buffer is divided into three sections. The white section is empty, and can be filled by
the sending process.
• The cross-section area shows bytes are sent but not yet acknowledged. TCP keeps these
bytes in the buffer until it receives an acknowledgement. The dotted area contains
bytes to be sent by sending TCP.
• At receiver, the operation is simpler. The circular buffer is divided into two areas,
white and shaded.
• The white area contains empty buffers to be filled by bytes received from the network
layer.
• The shaded section contains received bytes that can be read by the receiving process.
When the byte is read, that part of the buffer becomes empty.
4. Segments:
• Fig. 4.25 shows segments in TCP.
• The IP layer, as a service provider for TCP, needs to send data in packets, not as a
stream of bytes. At the transport layer, TCP groups a number of bytes together into a
packet called a segment.
• TCP adds a header to each segment and delivers it to IP, for transmission. The
segments are encapsulated in IP datagram and transmitted.
5. Full Duplex Communication:
• TCP offers full duplex communication in which data can flow in both directions at the
same time.
4.28
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
5. Flow Control:
• TCP provides a flow control mechanism. The receiver of data controls the amount of
data that is to be sent by the sender. By doing this, the receiver is not swamped by data
sent by the sender.
• The numbering system allows TCP to use a byte oriented flow control.
6. Error Control:
• For providing reliable service, TCP uses error control mechanisms. Error control is
byte oriented.
7. Congestion Control:
• TCP also provides congestion control. Receiver not only controls the amount of data
sent by the sender (flow control), but it is also determined by the level of congestion in
the network.
Header Data
HLEN Reserved U A P R S F
Window size
4 bits 6 bits R C S S Y I
16 bits
G L H T N N
Checksum Urgent pointer
16 bits 16 bits
4.31
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
indicates the amount of buffer (in bytes) the receiver has allocated for a segment,
i.e. how much data is the receiver expecting.
9. Checksum: This 16-bits field contains the checksum used for error control.
10. Urgent Pointer: This 16-bits field is valid only if the urgent flag is set. It is used
when the segment contains urgent data.
11. Option: There can be up to 40 bytes of optional information in the TCP header. It
facilitates additional options which are not covered by the regular header. Option
field is always described in 32-bit words. If this field contains data less than 32-bit,
padding is used to cover the remaining bits to reach 32-bit boundary.
4.32
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
can say that the SYN segment carries no real data, but we can think of it as
containing one imaginary byte.
2. SYN+ACK Segment: It sets two flag bits set namely, SYN and ACK. A SYN + ACK
segment cannot carry data, but does consume one sequence number. SYN-ACK
segment has a dual purpose. First, it is a SYN segment for communication in the
other direction. The server uses this segment to initialize a sequence number for
numbering the bytes sent from the server to the client. The server also
acknowledges the receipt of the SYN segment from the client by setting the ACK
flag and displaying the next sequence number it expects to receive from the client.
Because it contains an acknowledgment, it also needs to define the receive window
size.
3. ACK Segment: ACK segment acknowledges the receipt of the second segment with
the ACK flag and acknowledgment number field. An ACK segment, if carrying no
data, consumes no sequence number.
• The client sends one more segment. The first three segments carry both data and
acknowledgment, but the last segment carries only an acknowledgment because there
is no more data to be sent.
• The data segments sent by the client have the PSH (push) flag set so that the server TCP
tries to deliver data to the server process as soon as they are received.
• The segment from the server, on the other hand, does not set the push flag. Most TCP
implementations have the option to set or not set this flag.
• Most implementations today allow two options for connection termination for TCP
namely, three-way handshaking and four-way handshaking with a half-close option.
Three-Way Handshaking:
• Fig. 4.30 shows three-way handshaking for connection termination for TCP.
1. FIN Segment: In a common situation, the client TCP, after receiving a close
command from the client process, sends the first segment, a FIN segment in which
the FIN flag is set. The FIN segment consumes one sequence number if it does not
carry data.
2. FIN+ACK Segment: The server TCP, after receiving the FIN segment, informs its
process of the situation and sends the second segment, a FIN+ACK segment, to
confirm the receipt of the FIN segment from the client and at the same time to
announce the closing of the connection in the other direction. This segment can
also contain the last chunk of data from the server. If it does not carry data, it
consumes only one sequence number. The FIN + ACK segment consumes one
sequence number if it does not carry data.
3. ACK Segment: The client TCP sends the last segment, an ACK segment, to confirm
the receipt of the FIN segment from the TCP server. This segment contains the
acknowledgment number, which is one plus the sequence number received in the
FIN segment from the server. This segment cannot carry data and consumes no
sequence numbers.
Fig. 4.30
4.35
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
9. TIME-WAIT Second FIN received, ACK sent; waiting for 2MSL time-
out.
4.36
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
4.37
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
• The send window in TCP is similar to one used with the Selective Repeat (SR) protocol
but with some following differences:
o The nature of entities related to the window. The window in SR numbers pockets,
but the window in the TCP numbers bytes. Although actual transmission in TCP
occurs segment by segment, the variables that control the window are expressed
in bytes.
o The second difference is that, in some implementations, TCP can store data
received from the process and send them later, but we assume that the sending
TCP is capable of sending segments of data as soon as it receives them from its
process.
o Another difference is the number of timers. The theoretical SR protocol may use
several timers for each packet sent, but the TCP protocol uses only one timer.
2. Receive Window:
• The window we have used is of size 100 bytes (normally thousands of bytes). The
figure also shows how the receive window opens and closes; in practice, the window
should never shrink.
4.38
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
• There are two differences between the receive window in TCP and the one we used for
SR. These differences are given below:
o The first difference is that TCP allows the receiving process to pull data at its own
pace. This means that part of the allocated buffer at the receiver may be occupied
by bytes that have been received and acknowledged, but are waiting to be pulled
by the receiving process. The receive window size is then always smaller or equal
to the buffer size, as shown in the Fig. 4.33. The receiver window size determines
the number of bytes that the receive window can accept from the sender before
being overwhelmed (flow control). In other words, the receive window size,
normally called rwnd. It can be determined as rwnd = buffer size − number of
waiting bytes to be pulled.
o The way acknowledgments are used in the TCP protocol. Remember that an
acknowledgement in SR is selective, defining the uncorrupted packets that have
been received. The major acknowledgment mechanism in TCP is a cumulative
acknowledgment announcing the next expected byte to receive. The new versions
of TCP, however, uses both cumulative and selective acknowledgements.
4.39
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
4.40
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
PRACTICE QUESTIONS
Q.I Multiple Choice Questions:
1. The functions of transport layer of TCP/IP model include,
(a) Flow control (b) Congestion control
(c) Addressing (d) All of these
2. Which is an application program running on the host and uses the services of the
transport layer?
(a) Datagram (b) Packet
(c) Process (d) None of these
3. Which is the most common method to achieve process to process communication?
(a) Web paradigm (b) Client/server paradigm
(c) Programming paradigm (d) None of these
4. Which numbers are 16 bit long that help identify which process is sending or
receiving data on a host?
(a) Port (b) Packet
(c) Message (d) None of these
5. The transport layer address is called ______.
(a) Port address (b) Port number
(c) Both (a) and (b) (d) None of these
6. The IANA (Internet Assigned Number Authority) has divided the port numbers into
three ranges,
(a) Well known ports (b) Registered ports
(c) Dynamic ports (d) All of these
7. Which is an address combination of IP address and a port number?
(a) Port address (b) Logical number
(c) Socket address (d) None of these
8. Which is a set of memory locations that can hold packets at the sender and
receiver?
(a) Buffer (b) Packet
(c) Message (d) All of these
9. Which is a service in the transport layer, observes that the data delivered to the
receiver is error free and reliable?
(a) Flow (b) Congestion
(c) Error (d) None of these
4.41
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
10. In which service, the packets are sent from one machine to another without
connection establishment.
(a) Connection-oriented (b) Connectionless
(c) Flow-oriented (d) All of these
11. Transport layer protocols include,
(a) TCP (b) SCTP
(c) UDP (d) All of these
12. Which is connectionless, unreliable transport layer protocol?
(a) TCP (b) SCTP
(c) UDP (d) All of these
13. UDP packets have a fixed-size header of ______ bytes.
(a) 16 (b) 8
(c) 32 (d) 64
14. Which is the most widely used protocol for data transmission in communication
networks as the Internet?
(a) IP (b) UDP
(c) TCP (d) SCTP
15. Services of TCP include,
(a) Flow control (b) Error control
(c) Congestion control (d) All of these
16. A packet in TCP is called ______.
(a) Segment (b) Datagram
(c) Header (d) None of these
17. Which is a connection oriented protocol?
(a) TCP (b) SCTP
(c) UDP (d) None of these
18. Which is a situation in which too many sources over a network attempt to send
data and the router buffers start overflowing due to which loss of packets occur?
(a) Congestion (b) Error
(c) Event (d) None of these
19. Stream Control Transmission Protocol (SCTP) combines the features of which
protocols?
(a) TCP (b) UDP
(c) Both (a) and (b) (d) None of these
4.42
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
4.43
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
17. The ______ is one of the most important protocols of the Internet Protocols suite
most widely used protocol for data transmission in communication networks such
as the internet.
18. User Datagram Protocol (UDP) is a ______ layer protocol.
19. UDP ______ and connectionless protocol.
20. TCP is a ______ layer protocol that provides for a connection-oriented, reliable
service to applications.
21. The combination of an IP address and a port number is called a ______ address.
22. A port number is a ______ address used to identify any client-server program
uniquely.
ANSWERS
1. transport 2. flow 3. port 4. process 5. sender
6. pulling 7. error 8. sequence 9. buffer 10. stateless
11. datagram 12. port 13. segment 14. three-way 15. queues
16. error, flow 17. TCP 18. transport 19. unreliable 20. transport
21. socket 22. 16-bits
4.46
Computer Networks – I (S.Y.B.Sc. Comp. Science) Transport Layer
April 2017
1. List any two features of TCP. [1 M]
Ans. Refer to Section 4.4.2.
2. Explain the concept of multiplexing and demultiplexing used in process to
process delivery. [4 M]
Ans. Refer to Section 4.1.4.
October 2017
1. State any two applications of UDP. [1 M]
Ans. Refer to Section 4.3.1.
2. Explain stream delivery service and sending and receiving buffer service
of TCP. [5 M]
Ans. Refer to Section 4.4.1, Point (2).
April 2018
1. What is the window size of the TCP segment? [1 M]
Ans. Refer to Section 4.4.3.
2. Write a short note on: UDP. [5 M]
Ans. Refer to Section 4.3.1.
3. Explain any four features supported by TCP. [4 M]
Ans. Refer to Section 4.4.2.
October 2018
1. List the protocols used at the transport layer. [1 M]
Ans. Refer to Section 4.3.
2. List the services provided by TCP. [1 M]
Ans. Refer to Section 4.4.1.
3. Give difference between TCP and UDP. [5 M]
Ans. Refer to Page No. 4.40.
April 2019
1. Draw and explain UDP datagram. [5 M]
Ans. Refer to Section 4.3.2.
2. Explain TCP features. [1 M]
Ans. Refer to Section 4.4.2.
4.48
NOTES
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
❖❖❖
1
NOTES
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
______________________________________________________________________________________________
❖❖❖
2