You are on page 1of 27

Mekelle University Faculty of Business &

Economics

Computer Science Department

ICT132: Networks and Digital Communications

Handout 6 Protocols

1. Introduction to protocols

Protocols are rules and procedures for


communicating. The term "protocol" is used in a
variety of contexts. For example, diplomats from
one country adhere to rules of protocol designed to
help them interact smoothly with diplomats
from other countries. Rules of protocol apply in the
same way in the computer environment. When
several computers are networked, the rules and
technical procedures governing their
communication and interaction are called
protocols.

1.1 Packet retransmission


Protocols are necessary to ensure effective
communication between two computers on a
network. For example, hardware problems and/or
noise can sometimes lead to corrupted or lost bits
or packets, duplicated packets, or out of order
packets. Protocols are responsible for adding extra
information to packets to make sure
communication occurs without such loss or
duplication. They may add parity bits, checksum or
CRC information to detect transmission errors, or
add sequencing information to make sure packets
are received in the correct order.

To ensure that packets are not lost entirely


protocols may require that acknowledgements be
sent whenever packets are received. Figure 1
illustrates how such a scheme would work.
Whenever the sending computer (computer A in
this case) sends a message over the network, it
starts a timer. If no acknowledgement is received
from the receiving computer before a certain
amount of time has expired it will assume that the
packet was lost and retransmit. Otherwise, when
the acknowledgement is received it will proceed to
transmit the next packet. This technique, together
with error detection and correction schemes, can
provide completely reliable delivery of packets.
Protocols that do not provide completely reliable
delivery are called best effort delivery schemes.
Figure 1 Retransmitting lost packets

1.2 Flow control

The simple acknowledgement technique described


above is known as stop and wait flow control.
Although it does provide for completely reliable
delivery, it is also inefficient the sender spends a
lot of time waiting for acknowledgements to arrive.
A more efficient technique is called sliding window
flow control, and is illustrated in Figure 2.
Figure 2 Sliding window flow control (at the
sender)

Using sliding window flow control the receiving


computer first establishes a buffer (a block of
memory to store received packets). It informs the
sending computer of the size of the buffer (for
example 4 packets), and tells it that it is ready to
receive data. The sending computer then transmits
packets for all available space in the buffer, without
waiting for acknowledgements. Only when the
buffer is full does it wait to receive an
acknowledgement. The receiver will send
acknowledgements as it receives and processes
each packet. Whenever the sender receives an
acknowledgement it knows that it can transmit
another packet. This can be visualised as a window
sliding along the data that needs to be sent. The
size of the window is the same as the size of the
buffer. If a packet is inside the window it can be
transmitted; if it is to the right is has been sent
already; if it is to the left it is still unsent.
Figure 3 shows the efficiency improvements
achieved by using sliding window flow control.
Stop and wait flow control is only really useful
when the data to be transmitted consists of a small
number of large packets, which is not normally the
case. For high-speed networks, sliding window
flow control is essential.

Figure 3 Comparison of flow control


techniques

2. The OSI reference model

Network software operates at many different levels


within the sending and receiving computers. Each
of these levels, or tasks, is governed by one or
more protocols. These protocols, or rules of
behaviour, are standard specifications for
formatting and moving the data. When the sending
and receiving computers follow the same protocols,
communication is assured. For example, a protocol
that is responsible for sending an email from one
mail server to another is very different from a
protocol that is responsible for transmitting the
binary 1s and 0s onto the network cabling. Because
of this layered structure, a number of protocols
working together at different levels is often referred
to as a protocol stack.

With the rapid growth of networking hardware and


software, a need arose for standard protocols that
could allow hardware and software from different
vendors to communicate. The Open Systems
Interconnection (OSI) reference model is a
response to this need, and represents the seven
layers of the process by which data is packaged and
transmitted from a sending application through the
physical wires to the receiving application.
2.1 OSI - a layered architecture

The OSI reference model architecture divides


network communication into seven layers. Each
layer covers different network activities,
equipment, or protocols. Figure 4 represents the
layered architecture of the OSI reference model.
(Layering specifies different functions and services
as data moves from one computer through the
network cabling to another computer.) The OSI
reference model defines how each layer
communicates and works with the layers
immediately above and below it. For example, the
session layer communicates and works with the
presentation and transport layers.

Figure 4 The 7 layers of the OSI reference


model

Each layer provides some service or action that


prepares the data for delivery over the network to
another computer. The lowest layers (1 and 2)
define the network's physical media and related
tasks, such as putting data bits onto the network
interface cards (NICs) and cable. The highest
layers define how applications access
communication services. The higher the layer, the
more complex is its task.

The layers are separated from each other by


boundaries called interfaces. All requests are
passed from one layer, through the interface, to the
next layer. Each layer builds upon the standards
and activities of the layer below it.

2.2 Relationships among OSI reference model


layers

Each layer provides services to the next-higher


layer and shields the upper layer from the details of
how the services below it are actually
implemented. At the same time, each layer appears
to be in direct communication with its associated
layer on the other computer. This provides a
logical, or virtual, communication between peer
layers, as shown in Figure 5. In reality, actual
communication between adjacent layers takes place
on one computer only, and actual communication
between computers occurs at the physical layer
only. At each layer, software implements network
functions according to a set of protocols.

Before data is passed from one layer to another, it


is broken down into packets. At each OSI layer, the
NOS adds additional formatting or addressing to
the packet, which is needed for the packet to be
successfully transmitted across the network. At the
receiving end, the packet passes through the layers
in reverse order. A software module at each layer
reads the information on the packet, strips it away,
and passes the packet up to the next layer. When
the packet is finally passed up to the application
layer, the addressing information has been stripped
away and the packet is in its original form, which is
readable by the receiver.

Figure 5 Communication between computers


using the OSI reference model

With the exception of the lowest layer in the OSI


networking model (i.e. the physical layer), no layer
can pass information directly to its counterpart on
another computer. Instead, information on the
sending computer must be passed down through
each successive layer until it reaches the physical
layer. The information then moves across the
networking cable to the receiving computer and up
that computer's networking layers until it arrives at
the corresponding layer. For example, when the
network layer sends information from computer A,
the information moves down through the data-link
and physical layers on the sending side, over the
cable, and up the physical and data-link layers on
the receiving side to its final destination at the
network layer on computer B.

The purpose of each of the 7 layers of the OSI


model is summarised below.
Application layer: This layer relates to the
services that directly support user applications,
such as software for file transfers, database
access, and e-mail.
Presentation layer: You can think of the
presentation layer as the network's translator.
When computers from dissimilar systems
(such as IBM, Apple, and Sun) need to
communicate, a certain amount of translation
and byte reordering must be done. This layer
translates information from computers
applications into a commonly recognised,
intermediary format.
Session layer: This layer allows two
applications on different computers to open,
use, and close a connection called a session. A
session is a highly structured dialog between
two workstations. The session layer is
responsible for managing this dialog and
handles such things as login requests and
password verification.
Transport layer: The transport layer provides
an additional connection level beneath the
session layer. The transport layer ensures that
packets are delivered error free, in sequence,
and without losses or duplications. It is
responsible for dividing up a large block of
data into smaller packets and reassembling
them at the receiving computer. It is not
concerned with the route the data takes to
reach its destination.
Network layer: The network layer is
responsible for addressing messages and
translating logical addresses and names into
physical addresses. This layer also determines
the route from the source to the destination
computer.
Data-link layer: This layer sends data frames
from the network layer to the physical layer. It
controls the electrical impulses that enter and
leave the network cable, and is responsible for
controlling the flow of data from sender to
receiver.
Physical layer: This layer transmits the
unstructured, raw bit stream over a physical
medium (such as the network cable). The
physical layer is totally hardware-oriented and
deals with all aspects of establishing and
maintaining a physical link between
communicating computers.
3. The TCP/IP protocol

Although there are a large number of different


protocols that operate at different layers of the OSI
model, one protocol has assumed primary
importance for communicating both within and
between networks. This protocol is known as the
Transmission Control Protocol/Internet Protocol
(TCP/IP). As its name suggests, TCP/IP is the
protocol that makes communication via the Internet
possible, hence its importance.

TCP/IP has become the standard protocol used for


interoperability among many different types of
computers. (Interoperability simply means different
types of computers being able to communicate with
each other.) This interoperability is a primary
advantage of TCP/IP. Most networks support
TCP/IP as a protocol.

3.1 TCP/IP and OSI

TCP/IP is not actually a single protocol, but a set of


protocols that operate at different levels. The levels
involved in TCP/IP do not exactly match those of
the OSI reference model. Instead of seven layers, it
uses only four. TCP/IP is broken into the following
four layers:
Network interface layer
Internet layer
Transport layer
Application layer

Each of these layers corresponds to one or more


layers of the OSI reference model. The table below
shows the correspondence between OSI layers and
TCP/IP layers.

OSI Layers TCP/IP


Layers
Application Application
Presentation Application
Session Application
Transport Transport
Network Internet
Data-link Network
interface
Physical Network
interface

TCP/IP is an industry standard and is an open


protocol. This means it is not controlled by a single
company, and is less subject to compatibility
issues.

3.2 Overview of TCP/IP

As was stated above, TCP/IP consists of a number


of different protocols that perform a variety of
functions and operate at a number of different
levels. An overview of the protocols included in
TCP/IP is shown below.

OSI Layer TCP/IP Protocols


7=Application Telnet DHCP
6=Presentation FTP SNMP
5=Session SMTP DNS
4=Transport TCP UDP
3=Network IP ARP
RARP
2=Datalink Hardware oriented
1=Physical Hardware oriented

We will now consider some of these protocols in


more detail.

3.3 The IP protocol and IP addresses

One of the protocols in the TCP/IP suite is the IP


protocol. This is used at the Internet layer of
TCP/IP (i.e. the Network layer in the OSI model)
and is used to attach network addresses to packets.
The IP protocol routes packets on the network by
using IP addresses. An IP address consists of 4
numbers between 0 and 255 separated by dots. For
example, 146.23.0.194 is a valid IP address. When
you surf the Internet and type a URL into your
browser (e.g. www.yahoo.com) you are actually
using IP addresses. Every Internet domain such as
Yahoo or Google has its own IP address on the
Internet.

3.3.1 Class A, B and C networks

Clearly there is not one single network


administrator responsible for the whole of the
Internet, so breaking it down into smaller subnets
makes sense. Using the 4 number (or 32 bit) IP
addresses makes it relatively easy to segment the
task of managing computer networks. This is done
by splitting the address into two parts: the network
ID (or prefix), and the computer ID (or suffix). As
an example, we will first consider the largest type
of subnet: class A networks.

Subnets are defined by fixing a certain number of


the 32 bits in the IP address, and allowing the
others to vary. In class A networks, the first 8 bits
of the IP address are fixed (i.e. the first number of
the 4), allowing network administrators to assign
the other 24 bits (3 numbers) as computer
addresses. As 24 bits are available for use in the
subnet, class A networks can contain up to 224
different computers. There are only a very small
number of class A networks, and all have already
been assigned to large companies. For example,
IBM have the class A network 9.*.*.* and
Apple have 17.*.*.*.

In a class B network the first 16 bits of the IP


address are fixed. They can have up to 216 different
computers on their network (65,536). All class B
networks have also already been assigned.
Microsoft is an example of a company with a class
B network.

Class C networks have the first 24 bits of the IP


address fixed, allowing only 255 different
addresses. This is the only type of subnet that it is
still possible to buy.

Using this class-based system, it is possible to tell


that an IP address is in a class A network because
the first bit of the 32 is set to a 0. This means that
only 7 bits are available for storing the network ID,
making a total of 27 (=128) different class A
networks. A class B network is indicated by setting
the first 2 bits to 10, leaving 14 bits for the network
ID (= 16384 different class B networks). Class C
networks have the first 3 bits set to 110, leaving 21
bits for the network ID. Therefore there can be total
of 221 (=2,097,157) different class C networks (see
table below).

Maximum Maximum
Network Prefix number Suffix computers
class bits of bits per
networks network
A 7 128 24 16777216
B 14 16384 16 65536
C 21 2097152 8 256

3.3.2 Exercise 1

For example, using the class-based system of IP


addressing, what can you deduce from the
following IP addresses?
i. 11011111.00000001.00000000.1000
0001
ii. 00000010.11111111.00001111.1111
1110
iii. 10000011.11000000.10100001.0000
0001
(go to the end of this handout for the answers)

3.3.3 Classless Inter-domain routing


When this class-based system was introduced, it
was thought that it would easily provide enough IP
addresses for the Internet. However, due to the
rapid increase in the number of Internet users
worldwide, IP addresses eventually came to be in
short supply. Because of this, in 1994 a new system
was introduced: classless inter-domain routing, or
CIDR.

CIDR uses subnet masks to subdivide networks.


The 32 bits in a subnet mask indicate which of the
bits in an IP address are a part of the prefix
(network ID), and which are a part of the suffix
(computer ID). If the bit in the subnet mask is a 1
that bit is in the prefix and so must be fixed in the
IP addresses of a subnet. If the bit in the subnet
mask is a 0 then it is part of the suffix and is
allowed to vary within a subnet. For example, in a
class C network only the last 8 bits can vary, so the
subnet mask is 255.255.255.0. For class A and B
networks the subnets masks are 255.0.0.0 and
255.255.0.0 respectively.

However, subnet masks allow much more


flexibility than the class-based system. For
example, suppose we wish to have a subnet with
1000 IP addresses. Under the class-based system
we would have to allocate a class B network, which
has a total of 65,534 addresses, approximately
64,000 of which would be unused. Using CIDR we
can specify the following subnet mask:

11111111 11111111 11111100 00000000


255 255 252 0

Now we are using 22 bits to specify the network


ID, and 10 bits for the computer ID. This allows a
total of 210, or 1024, different IP addresses in the
subnet, which minimises the number of unused
addresses.

Because we can now have any number of bits in


the network ID part of the IP address, the IP
address is generally written with a slash at the end
followed by the number of bits in the network ID,
e.g. 200.123.192.2/22. Because of this
notation a subnet with 22 bits for the network ID is
known as a slash 22 network.

The CIDR system has temporarily alleviated the


shortage of IP addresses on the Internet, but still we
will run out of addresses one day. Because of this a
new system is being devised that uses 128 bit
addresses.

3.3.4 Exercise 2
For example, which of the following IP addresses
would be on the same subnet as
200.123.192.2/22 ?
i. 200.123.192.1/22
ii. 200.123.193.1/22
iii. 200.123.194.1/22
iv. 200.123.195.1/22
v. 200.123.196.1/22
(go to the end of this handout for the answers)

3.3.5 Reserved IP addresses

You cannot use every IP address. There are some


addresses, or sets of addresses, that are reserved for
special uses. The table below summarises these.

Network Computer Description Use


ID ID
All 0s All 0s This Used during
computer system boot
All 0s Computer A computer
number on this
subnet
Network All 0s Network ID Used to refer
number to an entire
subnet
All 1s All 1s Limited Broadcasts
broadcast message to all
computers on
this subnet
Network All 1s Directed Broadcasts
number broadcast message to all
computers on
specified
network
127 Any Loopback Used for
address testing

3.4 ARP and RARP

Every network device (e.g. NIC, router, bridge,


etc.) has a unique hardware address. This address is
known as the MAC (media access control). MAC
addresses are different to IP addresses: they are a
48-bit binary code and they never change they are
permanently assigned to the device at
manufacturing time. IP addresses, on the other
hand, are assigned by software and so they can
change during the lifetime of a device. In low level
protocols, all addressing is performed using MAC
addresses.

ARP stands for the address resolution protocol. It


operates at the network layer of OSI, and the
Internet layer of TCP/IP. ARP is responsible for
translating from IP addresses to MAC addresses.
RARP stands for the reverse address resolution
protocol, and is responsible for translating from
MAC addresses to IP addresses. Because of the
service provided by ARP and RARP, all protocols
above them in the OSI model are able to use IP
addresses only when referring to network devices.
Summary of Key Points

Protocols in a networking environment define


the rules and procedures for transmitting data
Some protocols provide completely reliable
delivery by requiring the receiving computer to
send an acknowledgment that it has received
each packet safely.
Protocols that do not provide completely
reliable delivery are called best effort delivery
schemes
Flow control techniques, such as sliding
window flow control, can improve the
efficiency of completely reliable delivery
protocols
The OSI reference model architecture divides
network protocols into seven layers: the
application, presentation, session, transport,
network, data-link, and physical layers
TCP/IP is an industry-standard suite of
protocols providing communication in a
heterogeneous environment
The four layers of TCP/IP are the network-
interface layer, Internet layer, transport layer,
and application layer
The IP protocol uses IP addresses to send data
over a network. IP addresses consist of four
numbers between 0 and 255 separated by dots
(e.g. 146.23.0.194).
To simplify the task of managing the Internet,
it is divided up into a number of different
subnets
In class A subnets, the first 8 bits of the IP
address are fixed, allowing a total of 224
different addresses
In class B subnets, the first 16 bits of the IP
address are fixed, allowing a total of 216
different addresses
In class C subnets, the first 24 bits of the IP
address are fixed, allowing a total of 28
different addresses
Using classless inter-domain routing (CIDR),
a variable number of bits can be used to
specify the network ID. The subnet mask
specifies which bits in an IP address are
permitted to vary within a subnet
The address resolution protocol (ARP) and the
reverse address resolution protocol (RARP)
are responsible for translating between the 48-
bit hardware MAC address and IP addresses.
Exercise 1 - Answers

i. The first three bits (110) tell us that this is a


class C network. Therefore the next 21 bits
specify the network ID (32.1.0), and the final 8
bits represent the computer ID (129). So the IP
address is 32.1.0.129 and it is on a class C
network.
ii. The first bit (0) tells us that this is a class A
network. Therefore the next 7 bits specify the
network ID (2), and the next 24 bits represent
the computer ID (255.15.254). So the IP
address is 2.255.15.254 and it is on a class A
network.
iii. The first two bits (10) tell us that this is a class
B network. Therefore the next 14 bits specify
the network ID (3.192), and the final 16 bits
represent the computer ID (161.1). So the IP
address is 3.192.161.1 and it is on a class B
network.

Exercise 2 Answers

First we should write the original IP address in


binary form: 200.123.192.2/22 corresponds
to
11001000.01111011.11000000.0000001
0 (network ID is normal text, computer ID in
italics).
i. 200.123.192.1/22=11001000.01111
011.11000000.00000001, therefore if
we look at the first 22 bits of the two addresses
they are identical, so they are on the same
subnet.
ii. 200.123.193.1/22=11001000.01111
011.11000001.00000001, therefore the
first 22 bits of the two addresses are the same,
so they are on the same subnet.
iii. 200.123.194.1/22=11001000.01111
011.11000010.00000001, therefore the
first 22 bits are again identical, and the
addresses are on the same subnet.
iv. 200.123.195.1/22=11001000.01111
011.11000011.00000001, therefore the
first 22 bits are the same, and the addresses are
on the same subnet.
v. 200.123.196.1/22=11001000.01111
011.11000100.00000001, so this time
the 22nd bit is different, which means that the
two addresses are not on the same subnet.
Notes prepared by: FBE Computer Science
Department.

Sources: Networking Essentials Plus,


Microsoft Press
An Introduction to Computer
Networking, Mansfield & Antonakos

You might also like