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

Chapter - Network Protocols and Architecture

Uploaded by

brotadese50
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Chapter - Network Protocols and Architecture

Uploaded by

brotadese50
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 99

Data Communication and Computer Networks

Chapter one
Network Protocols and Architecture
5.1 The Physical Layer
The physical layer, the lowest layer of the OSI model, which primarily concerned with the
transmission and reception of the unstructured raw bit stream over a physical medium. This layer
have the following main function in the data communication over the network.

Data Encoding and Signaling (Representation of Bits):


This layer gets the frames sent by the Data Link layer and converts them into signals compatible
with the transmission media. If a metallic cable is used, then it will convert data into electrical
signals; if a fiber optical cable is used, then it will convert data into luminous signals; if a wireless
network is used, then it will convert data into electromagnetic signals; and so on.
Before converting stream of bits into signals this layer need have to decide how are the bits
encoded in the medium. For example, on the copper wire medium, we can use different voltage
levels for a certain time interval to represent '0' and '1'. We may use +5mV for 1nsec to represent
'1' and -5mV for 1nsec to represent '0'. All the issues of modulation is dealt with in this layer.
e.g., we may use Binary phase shift keying for the representation of '1' and '0' rather than using
different voltage levels if we have to transfer in RF waves.

What signal state represents a binary 1?


How the receiving station knows when a "bit-time" starts.
How the receiving station delimits a frame.
When receiving data, this layer will get the signal received and convert it into 0s and 1s and send
them to the Data Link layer, which will put the frame back together and check for its integrity.

Network Protocols and Architecture Page 1


Data Communication and Computer Networks
Generally this layer describes the electrical/optical, mechanical, and functional interfaces details
represented as 0 or a 1 to the physical medium, and carries the signals for all of the higher layers.
This layer is not concerned with the meaning of the bits and deals with the physical connection to
the network and with transmission and reception of signals.

Hardware Specification and characteristics of interfaces and medium:


It is responsible for the actual physical connection between the devices. Such physical connection
may be made by using twisted pair cable, fiber-optic, coaxial cable or wireless communication
media. The details of the physical cables, network interface cards, wireless radios, etc are a part of
this layer.
Will an external transceiver (MAU) be used to connect to the medium?
How many pins do the connectors have and what is each pin used for?
Coaxial Cable Hybrid Cable Wireless Card Network Card

Data Transmission and Reception:


The transfer of each bit of data is the responsibility of this layer. This layer assures the transmission
of each bit with a high probability. The transmission of the bits is not completely reliable as there
is no error correction in this layer.
Transmits bits as electrical or optical signals appropriate for the physical medium, and determines:
• What physical medium options can be used.
• How many volts/db should be used to represent a given signal state, using a given
physical medium.
• Whether the encoded bits will be transmitted by baseband (digital) or broadband
(analog) signaling.
Topology and Network Design:
The network design is the integral part of the physical layer. Physical layer specifies the way in
which the different, devices/nodes are arranged in a network i.e. bus, star or mesh. Which part of
the network is the router going to be placed, where the switches will be used, where we will put
the hubs, how many machines is each switch going to handle, what server is going to be placed
where, and many such concerns are to be taken care of by the physical layer. The various kinds of
network topologies that we decide to use may be ring, bus, star or a hybrid of these topologies
depending on our requirements.

Network Protocols and Architecture Page 2


Data Communication and Computer Networks
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.
Bit rate control and synchronization:
Physical layer defines the transmission rate i.e. the number of bits sent in one second. Therefore it
defines the duration of a bit. It also provides the synchronization of the bits by providing a clock.
This clock controls both transmitter as well as receiver thus providing synchronization at bit level.

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. To
activate, maintain and deactivate the physical connection.

Multiplexing:
Physical layer can use different techniques of multiplexing, in order to improve the channel
efficiency.
Note:
Protocols used at physical layer includes ISDN, IEEE 802 and IEEE 802.2. The X.25 protocols
works at the physical, data link, and network layers.

Network Protocols and Architecture Page 3


Data Communication and Computer Networks
5.2 The Data Link layer
The goal of the data link layer is provides error-free transfer and reliable node-to-node delivery
of data. In connection with this objective this layer need to perform some sort of function. The
functions of the data link layer are discussed in the next consecutive sub sections.

The diagram below shows the main functions of data link layer are

Network Protocols and Architecture Page 4


Data Communication and Computer Networks

5.2.1 Framing
The data link layer divides (breaking) the stream of bits received from the network layer into
manageable data units called frames (typically a few hundred bytes) and wrap it with layer two
Header that is known as frame.

Our postal system practices a type of framing. The simple act of inserting a letter into an envelope
separates one piece of information from another; the envelope serves as the delimiter. In addition,
each envelope defines sender and receiver addresses since postal system is a manyto-many carrier
facility.
Framing in the data link layer separates a message from one source to a destination, or from other
messages to other destinations, 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.
Although the whole message could be packed in one frame, that is not normally done. One reason
is that a frame can be very large, making flow and error control very inefficient. When a message
is carried in one very large frame, even a single-bit error would require the retransmission of the

Network Protocols and Architecture Page 5


Data Communication and Computer Networks
whole message. When a message is divided into smaller frames, a singlebit error affects only that
small frame.
Header Trailer
Start Frame Stop Frame
Data FCS
(Flag) (Flag)
Address Type/Length
Flag field: an 8-bit sequence that identifies both the beginning and the end of a frame and
serves as a synchronization pattern for the receiver.
Data filed: contains the user's data from the net-work layer. Its length can vary from one
network to another.
FCS field: The frame check sequence (FCS) is the error detection field. It can contain either
a 2- or 4-byte ITU-T CRC.
Address field: contains the address of the secondary station. If a primary station created the
frame, it contains a to address. If a secondary creates the frame, it contains a from address.
An address field can be 1 byte or several bytes long, depending on the needs of the network
There are type of framing techniques: Fixed-size framing and variable-size framing
Fixed-size framing(byte count)
In this technique of framing there is no need for defining the boundaries of the frames; the size
itself can be used as a delimiter. It uses a field in the header to specify the number of bytes in the
frame. When the data link layer at the destination sees the byte count, it knows how many bytes
follow and hence where the end of the frame is. This technique is shown in Fig below for four
small example frames of sizes 5, 5, 8, and 8 bytes, respectively.

The trouble with this algorithm is that the count can be garbled by a transmission error. For
example, if the byte count of 5 in the second frame of the above Fig. becomes a 7 due to a single
bit flip, the destination will get out of synchronization. It will then be unable to locate the correct
start of the next frame. Even if the checksum is incorrect so the destination knows that the frame
is bad, it still has no way of telling where the next frame starts. Sending a frame back to the source

Network Protocols and Architecture Page 6


Data Communication and Computer Networks
asking for a retransmission does not help either, since the destination does not know how many
bytes to skip over to get to the start of the retransmission. For this reason, the byte count method
is rarely used by itself.
An example of this type of framing is the ATM wide-area network, which uses frames of fixed size
called cells.

Variable-Size Framing:
Variable-size framing is prevalent in local area networks. In variable-size framing, we need a way
to define the end of the frame and the beginning of the next. Historically, two approaches were
used for this purpose: a character-oriented approach and a bit-oriented approach.
(1) Character-Oriented Protocols
In a character-oriented protocol, data to be carried are 8-bit characters from a coding system such
as ASCII. The header, which normally carries the source and destination addresses and other
control information, and the trailer, which carries error detection or error correction redundant
bits, are also multiples of 8 bits. To separate one frame from the next, an 8-bit (1-byte) flag is
added at the beginning and the end of a frame.
The flag, composed of protocol-dependent special characters, signals the start or end of a frame.
Character-oriented framing was popular when only text was exchanged by the data link layers. The
flag could be selected to be any character not used for text communication.
Now, however, we send other types of information such as graphs, audio, and video, in which any
pattern used for the flag could also be part of the information. If this happens, the receiver, when
it encounters this pattern in the middle of the data, thinks it has reached the end of frame.
To fix this problem, a byte-stuffing strategy was added to character-oriented framing. In byte
stuffing (or character stuffing), a special byte is added to the data section of the frame when there
is a character with the same pattern as the flag. The data section is stuffed with an extra byte. This
byte is usually called the escape character (ESC), which has a predefined bit pattern. Whenever
receiver encounters the ESC character, it removes it from the data section and treats next character
as data, not delimiting flag.
Byte stuffing by the escape character allows the presence of the flag in the data section of the
frame, but it creates another problem. What happens if the text contains one or more normal
escape characters followed by a flag? The receiver removes the escape character, but keeps the
flag, which is incorrectly interpreted as the end of the frame. To solve this problem, the escape
characters that are part of the text must also be marked by another escape character. In other words,
if the escape character is part of the text, an extra one is added to show that the second one is part
of the text.

Network Protocols and Architecture Page 7


Data Communication and Computer Networks

(2) Bit-Oriented Protocols


In a bit-oriented protocol, the data section of a frame is a sequence of bits to be interpreted by the
upper layer as text, graphic, audio, video, and so on. However, in addition to headers (and possible
trailers), we still need a delimiter to separate one frame from the other. Most protocols use a special
8-bit pattern flag 01111110 as the delimiter to define the beginning and the end of the frame, as
shown in the figure below.

This flag can create the same type of problem we saw in the byte-oriented protocols. That is, if the
flag pattern appears in the data, we need to somehow inform the receiver that this is not the end of
the frame. We do this by stuffing 1 single bit (instead of 1 byte) to prevent the pattern from looking
like a flag. The strategy is called bit stuffing.
In bit stuffing, if a 0 and five consecutive 1 bits are encountered, an extra 0 is added. This extra
stuffed bit is eventually removed from the data by the receiver. Note that the extra bit is added
after one 0 followed by five 1s regardless of the value of the next bit. This guarantees that the flag
field sequence does not inadvertently appear in the frame.

Network Protocols and Architecture Page 8


Data Communication and Computer Networks

The above figure shows bit stuffing at the sender and bit removal at the receiver. Note that even if
we have a 0 after five 1s, we still stuff a 0. The 0 will be removed by the receiver. This means that
if the flag like pattern 01111110 appears in the data, it will change to 011111010 (stuffed) and is
not mistaken as a flag by the receiver. The real flag 01111110 is not stuffed by the sender and is
recognized by the receiver as a flag.

5.2.2 Physical addressing


After creating frames, Data link layer adds physical addresses (MAC address) of sender and/or
receiver, control data and a checksum data, also known as CRC in the header of each frame and
pass them to physical layer.
The Data Link layer consists of two sub-layers which enables this layer to perform its function
more effectively. The sublayers are:
Logical Link Control (LLC) sublayer
Medium Access Control (MAC) sublayer
LLC sublayer provides interface between the media access methods and network layer protocols
such as Internet protocol which is a part of TCP/IP protocol suite. It determines whether
communication is going to be connectionless or connection-oriented at data link layer.

Network Protocols and Architecture Page 9


Data Communication and Computer Networks
MAC sublayer is responsible for connection to physical media. At the MAC sublayer of Data link
layer, the actual physical address of the device, called the MAC address is added to the frame that
contains all the addressing information necessary to travel from source device to destination
device.

MAC address is the 12 digit hexadecimal (48 bit) number unique to every computer in this world.
It is also known as hardware address. This address is burnt with device by manufacturing company
and located on its Network Interface Card (NIC). In these 12 digits of MAC address, the first six
hexadecimal digits of a MAC address represent the NIC manufacturer (manufacture company) and
the last six digits are unique. For example, 32-14-a6-42-71-0c is the 12 digit hexadecimal MAC
address. Thus MAC address represents the physical address of a device in the network. The MAC
addresses only need to be unique in a broadcast domain. You can have the same MAC address in
different broadcast domains.

5.2.3 Flow control (Frame Traffic Control)


One important design issue that occurs in the data link layer (and higher layers as well) is what to
do with a sender that systematically wants to transmit frames faster than the receiver can accept
them. This situation can occur when the sender is running on a fast, powerful computer and the
receiver is running on a slow, low-end machine. A common situation is when a smart phone
requests a web page from a far more powerful server, which then turns on the fire hose and blasts
the data at the poor helpless phone until it is completely swamped. Even if the transmission is error
free, the receiver may be unable to handle the frames as fast as they arrive and will lose some.
Clearly, something has to be done to prevent this situation. So that the data link layer implement
a traffic regulatory mechanism called flow control that prevents the fast sender from drowning the
slow receiver. If the rate at which data is absorbed by receiver is less that the rate produced in the
sender, the data link layer imposes this flow control mechanism.
Flow control coordinates the amount of data that can be sent before receiving an acknowledgment
and is one of the most important duties of the data link layer. In most protocols, flow control is a
set of procedures that tells the sender how much data it can transmit before it must wait for an
acknowledgment from the receiver. The flow of data must not be allowed to overwhelm the
receiver. Any receiving device has a limited speed at which it can process incoming data and a
limited amount of memory in which to store incoming data. The receiving device must be able to
inform the sending device before those limits are reached and to request that the transmitting
device send fewer frames or stop temporarily. Incoming data must be checked and processed

Network Protocols and Architecture Page 10


Data Communication and Computer Networks
before they can be used. The rate of such processing is often slower than the rate of transmission.
For this reason, each receiving device has a block of memory, called a buffer, reserved for storing
incoming data until they are processed. If the buffer begins to fill up, the receiver must be able to
tell the sender to halt transmission until it is once again able to receive.
Two approaches are commonly used. In the first one, 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. In the second one, 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.

5.2.4 Error Control


No transmission medium is perfect. Whether the data is transmitted using UTP/STP cable, coaxial
cable, fiber-optic cable or wireless networking, the transmitted data will be subject to noise, or
errors. The frames may be damaged, lost or duplicated leading to errors. The error control is on
link to link basis. Clearly these errors should be avoided if possible. In the data link layer, the term
error control refers primarily to methods of error detection and retransmission.
If the error could be detected then the receiving computer inform the sender of any frames lost or
damaged in transmission and coordinates the retransmission of those frames by the sender. Error
control in the data link layer is often implemented simply: Any time an error is detected in an
exchange, specified frames are retransmitted. A number of schemes exist for detecting errors in
data communication.
Parity checking scheme
Checksum Schema
Cyclic redundancy check (CRC)
Hamming codes

(a) Parity checking


In the parity checking scheme the stream of 1s and 0s is broken down into characters (groups of 5
to 8 bits). At the end of each character an extra bit is appended, known as the parity bit. The value
of this bit is chosen so that the total number of 1s in the character is even (even parity) or odd (odd
parity). For example, if the sender is transmitting the character 1110010 and using odd parity, the
parity bit will be set to 1. Therefore the actual transmitted data will be 11100101, making the total
number of 1s equal to 5. The receiver examines the received character, and if the total number of
1s is odd, assumes that no error has occurred. If one bit has been changed due to noise on the
transmission medium the receiver detects an error and requests the character to be resent. Note,
however, that if two bits (or any even number of bits) are changed due to errors, an undetected
error occurs.

Network Protocols and Architecture Page 11


Data Communication and Computer Networks
This simple parity-checking scheme can be extended to correct for as well as detect errors.
Consider Figure 12. As before, the data bits are divided into characters, in this case of 8 bits, each
with an associated parity bit. But this time, the characters are also grouped together into blocks of
8, making an 8x8 grid of data bits. Parity bits are added not just to the rows of bits, but also
vertically, to the columns. Figure 12(a) shows such a scheme with no transmission errors. Now
when an error occurs, as shown in Figure 12(b), two parity errors occur, indicating respectively
the row and column at which the error has occurred. This extended parity checking scheme can
detect and correct for a single transmission error. However, if two errors occur on the same row
or column, the error will be detected but cannot be corrected for.

Figure 12 – An extended parity-checking scheme:


(a) with no transmission errors; (b) with a single error

(b) Checksum
An alternative error-checking scheme is called checksum. This technique works by considering
the data stream as a sequence of integer values. After the sending computer has transmitted n
integer values, the arithmetic sum of the n integers is computed and transmitted. The receiving
computer computes the same sum and compares it against the received checksum value.
Checksum can normally detect, but not correct for, multiple bit errors. However, there are cases in
which checksum can miss transmission errors. For example, consider the following sequence of
integers: 11, 34, 3, 0, 12. The checksum generated by this sequence would be 60, so the transmitted
sequence would be 11, 34, 3, 0, 12, 60. Now assume that two bits in this sequence are corrupted
and their values flipped, so that the transmitted sequence is actually 11, 32, 3, 2, 12, 60. The
receiving computer would calculate the checksum value as 60 (=11+32+3+2+12) and assume that
there has been no error. In fact, undetected transmission errors can occur with checksum whenever
the same bit is changed in two different integers in the sequence: in the example described above
the second bit in the integers 34 and 0 was flipped, one changing from 0 to 1 and one changing
from 1 to 0.

Network Protocols and Architecture Page 12


Data Communication and Computer Networks
(c) Cyclic redundancy check
One of the most common and powerful schemes is called the cyclic redundancy check, or CRC.
This technique works as follows. Given a k-bit data sequence, then sending computer generates an
extra n-bit sequence, known as the frame check sequence (FCS). The extra n bits are generated so
that the resulting sequence, consisting of k+n bits, is exactly divisible by some predetermined
number. The receiving computer will divide the received sequence by the predetermined number
and if there is no remainder, assumes that there was no transmission error.
The CRC error-checking scheme can detect, but not correct for, almost all transmission errors.

5.2.5 Access control


The set of rules that defines how a computer puts data onto the network cable and takes data from
the cable is called an access method. Once data is moving on the network, access methods help to
regulate the flow of network traffic.
To understand traffic on a computer network, it helps to use an analogy. A network is in some
ways like a railroad track, along which several trains run. When a train is on the track, all other
trains must abide by a procedure that governs how and when they enter the flow of traffic. Without
such a procedure, entering trains would collide with the one already on the track.
Multiple computers must share access to the cable that connects them. However, if two computers
were to put data onto the cable at the same time, the data packets from one computer would collide
with the packets from the other computer, and both sets of data packets would be destroyed. The
Figure on the next page show what happens when two computers try to access the network at the
same time.

Collision occurs if two computers put data on the cable at the same time

Network Protocols and Architecture Page 13


Data Communication and Computer Networks
Collision domains
A collision domain is a part of a LAN (or an entire LAN) where two computer transmitting at the
same time will cause a collision. Because switches, bridges and routers do not forward unnecessary
packets. The different ports of these devices operate in different collision domains. Repeaters and
hubs broadcast all packets to all ports, so their ports are in the same collision domain.

Illustration of collision domains


The Figure above shows a simple network with one repeater (‘R’), two hubs, a switch and 10
computers (‘C’). Because hubs broadcast all packets to all ports, if computers 2 and 4 attempted
to send at the same time there would be a collision, hence they are in the same collision domain.
However, because a switch will only forward a packet if it is intended for the other subnet, every
port of the switch is in a separate collision domain. So if computer 2 tried to send to computer 4 at
the same time as computer 7 tried to send to computer 10, there would be no collision.
If data is to be sent over the network from one user to another, or accessed from a server, there
must be some way for the data to access the cable without running into other data. And the
receiving computer must have reasonable assurance that the data has not been destroyed in a data
collision during transmission. Access methods prevent computers from gaining simultaneous
access to the cable. By making sure that only one computer at a time can put data on the network
cable, access methods ensure that the sending and receiving of network data is an orderly process.
When a single communication channel is shared by multiple devices, MAC sub-layer of data link
layer helps to determine which device has control over the channel at a given time.
There are four major category of Access Methods designed to prevent simultaneous use of the
network media include:

Network Protocols and Architecture Page 14


Data Communication and Computer Networks

Access methods need to be consistent in the way they handle data. If different computers were to
use different access methods, the network would fail because some methods would dominate the
cable.
Random Access Protocols
In random access or contention methods, no station is superior to another station and none is
assigned the control over another. No station permits, or does not permit, another station to send.
At each instance, a station that has data to send uses a procedure defined by the protocol to make
a decision on whether or not to send. This decision depends on the state of the medium (idle or
busy). In other words, each station can transmit when it desires on the condition that it follows the
predefined procedure, including the testing of the state of the medium.
In a random access method, each station has the right to the medium without being controlled by
any other station. However, if more than one station tries to send, there is an access
conflictcollision and the frames will be either destroyed or modified. To avoid access conflict or
to resolve it when it happens, each station follows a procedure that answers the following
questions:
When can the station access the medium?
What can the station do if the medium is busy?
How can the station determine the success or failure of the transmission?
What can the station do if there is an access conflict?
The random access methods have evolved from a very interesting protocol known as ALOHA,
which used a very simple procedure called multiple access (MA). The method was improved with
the addition of a procedure that forces the station to sense the medium before transmitting. This
was called carrier sense multiple access. This method later evolved into two parallel methods:
carrier sense multiple access with collision detection (CSMA/CD) and carrier sense multiple
access with collision avoidance (CSMA/CA).

Network Protocols and Architecture Page 15


Data Communication and Computer Networks
Pure ALOHA
ALOHA is the simplest technique in multiple accesses. Basic idea of this mechanism is a user can
transmit the data whenever they want. If data is successfully transmitted then there isn’t any
problem. But if collision occurs then the station will transmit again. Sender can detect the collision
if it doesn’t receive the acknowledgement (i.e. If the frame was destroyed) from the receiver and
sends it again. Under what conditions will the frame arrive undamaged?
Let t be the time required to send one frame. If any other user has generated a frame between
time t0 and t0+ t , the end of that frame will collide with the beginning of the shaded one
Similarly, any other frame started between t0+ t and t0 + 2t will bump into the end of the
shaded frame.

Carrier-Sense Multiple Access with Collision Detection (CSMA/CD) Access method


“Carrier Sense" means that each station on the LAN continually listens to the cable for the
presence of a signal prior to transmitting.
"Multiple Access" means that there are many computers attempting to transmit and compete
for the opportunity to send data (i.e., they are in contention).

Network Protocols and Architecture Page 16


Data Communication and Computer Networks
"Collision Detection" means that when a collision is detected, the stations will stop
transmitting and wait a random length of time before re-transmitting.
Using the method known as carrier-sense multiple access with collision detection (CSMA/CD),
each computer on the network, including clients and servers, checks the cable for network traffic.
Only when a computer "senses" that the cable is free and that there is no traffic on the cable can it
send data. Once the computer has transmitted data on the cable, no other computer can transmit
data until the original data has reached its destination and the cable is free again. Remember, if
two or more computers happen to send data at exactly the same time, there will be a data collision.
When that happens, the two computers involved stop transmitting for a random period of time and
then attempt to retransmit. Each computer determines its own waiting period; this reduces the
chance that the computers will once again transmit simultaneously.
The waiting time is calculated using an algorithm known as exponential back-off: the first time a
collision occurs each computer waits a random time t1, 0 ≤ t1 ≤ d (where d is a constant). If a
second collision occurs with the same packet, the wait time will be t2, 0 ≤ t2 ≤ 2d. The third time
the wait time will be t3, 0 ≤ t3 ≤ 4d, and so on: the maximum waiting time will be doubled after
each successive collision. This will continue for a maximum of 10 times, when the maximum
waiting time will reach a peak of 210d (= 1024d). After 16 successive collisions, transmission of
the packet is aborted and an error is reported.

The Figure below illustrates when a computer can and cannot transmit data.

Network Protocols and Architecture Page 17


Data Communication and Computer Networks

Computers can transmit data only if the cable is free


CSMA/CD is known as a contention method because computers on the network contend, or
compete, for an opportunity to send data. This might seem like a cumbersome way to put data on
the cable, but current implementations of CSMA/CD are so fast that users are not even aware they
are using a contention access method.
The collision-detection capability is the parameter that imposes a distance limitation on
CSMA/CD. Due to attenuation the weakening of a transmitted signal as it travels farther from its
source, the collision detection mechanism is not effective beyond 2500 meters (1.5 miles).
Segments cannot sense signals beyond that distance and, therefore, might not be aware that a
computer at the far end of a large network is transmitting. If more than one computer transmits
data on the network at the same time, a data collision will take place that will corrupt the data.
The more computers there are on the network, the more network traffic there will be. With more
traffic, collision avoidance and collisions tend to increase, which slows the network down, so
CSMA/CD can be a slow-access method.
After each collision, both computers will have to try to retransmit their data. If the network is very
busy, there is a chance that the attempts by both computers will result in collisions with packets
from other computers on the network. If this happens, four computers (the two original computers
and the two computers whose transmitted packets collided with the original computer's
retransmitted packets) will have to attempt to retransmit. These proliferating retransmissions can
slow the network to a near standstill.
The occurrence of this problem depends on the number of users attempting to use the network and
which applications they are using. Database applications tend to put more traffic on the network
than word-processing applications do.
Depending on the hardware components, the cabling, and the networking software, using a
CSMA/CD network with many users running several database applications can be very frustrating
because of heavy network traffic.

Network Protocols and Architecture Page 18


Data Communication and Computer Networks
Summary of CSMA/CD

Computer senses that the cable is free and the data is sent.
The sending device will monitor the channel while it is transmitting its message to make
certain there are no collisions. So that If data is on the cable, no other computer can transmit
until the cable is free again
If the network is free and two devices access the line at exactly the same time, their signals
collide and sending device detects a collision, it and other transmitting device(s) will
transmit jamming signal to notify all attached stations that collision has occurred.
When collision is detected both sending device back off and will wait for a random amount
of time and then will attempt to retransmit the message. On a busy network, such an attempt
may be repeated many times before the transmission is successful.
If collisions are still detected after many attempts, the user may be informed that the network
is too busy to transmit.
Known as a contention method because computers compete for the opportunity to send data.
(Database applications cause more traffic than other applications).
More computers cause the network traffic to increase and performance to degrade.
The ability to "listen" extends to a 2,500 meter cable length => segments can't sense signals
beyond that distance.
used by Ethernet LANs

Carrier-Sense Multiple Access with Collision Avoidance (CSMA/CA) Access method


Carrier-sense multiple access with collision avoidance (CSMA/CA) is the least popular of the three
major access methods. Instead of detecting and reacting to collisions, CSMA/CA tries to avoid
them by having each computer signal its intention to transmit before actually transmitting data. In
this way, computers sense when a collision might occur; this allows them to avoid transmission
collisions. Unfortunately, broadcasting the intent to transmit data increases the amount of traffic
on the cable and slows down network performance.
CSMA/CA is not commonly used in wired networks, but it has become the standard for wireless
networking. Here is below the summary of this access method:
In CSMA/CA, the computer actually broadcasts a warning packet before it begins
transmitting the real data on the wire.
Each computer on the network does not attempt to broadcast when another computer sends
the warning packet.
All other computers wait until the data is sent.
The major drawback of trying to avoid network collisions is that the network traffic is high
due to the broadcasting of the intent to send a message.

Network Protocols and Architecture Page 19


Data Communication and Computer Networks
Used by Apple networks
Controlled Access Protocols
In controlled access, the stations consult one another to find which station has the right to send. A
station cannot send unless it has been authorized by other stations. The Three known protocols of
this category includes Reservation, Token-Passing and Demand-Priority.
Reservation Access Method
In the reservation method, a station needs to make a reservation before sending data. Time is
divided into intervals. In each interval, a reservation frame precedes the data frames sent in that
interval. If there are N stations in the system, there are exactly N reservation minis lots in the
reservation frame. Each mini slot belongs to a station. When a station needs to send a data frame,
it makes a reservation in its own minis lot. The stations that have made reservations can send their
data frames after the reservation frame.
The following figure shows a situation with five stations and a five-minis lot reservation frame. In
the first interval, only stations 1, 3, and 4 have made reservations. In the second interval, only
station 1 has made a reservation.

Token-Passing Access Method


In chapter 2 we briefly discussed a type of network known as a token ring network. Token ring
LANs use the token passing network access method. In the access method known as token passing,
a special type of packet, called a token, circulates around a cable ring from computer to computer.
When any computer on the ring needs to send data across the network, it must wait for a free token.
When a free token is detected, the computer will take control of it if the computer has data to send.
While the token is in use by one computer, other computers cannot transmit data. Because only
one computer at a time can use the token, no contention and no collision take place, and no time
is spent waiting for computers to resend tokens due to network traffic on the cable.
The process followed by Token-passing:
Special packet is passed from computer to computer.
A network device with a message to send captures the free token as it passes by on the
channel.

Network Protocols and Architecture Page 20


Data Communication and Computer Networks
Computer takes control of the token and transmits data. Only this computer is allowed to
transmit; others must wait for control of the token and other computer must wait for a free
token.
The message is attached to the token.
The message-bearing token continues to circulate on the channel.
As the token stops at a device, it is checked to see if the message is for that device. If the
message is not for that device, the message-bearing token is put back onto the transmission
channel to be sent to the next device. When the message reaches the destination device,
that device will recognize its address and will read the message.
The destination device then attaches an acknowledgment of receipt to the token which
continues to circulate.
When the sending device receives the acknowledgment of receipt, it clears the token and
sends the token on, so it may be used by another device.
The token-passing scheme is most commonly used in ring, star-wired ring topologies and
ArcNet networks.
Uses "beaconing" to detect faults => this method is fault tolerant
No contention => equal access to all computers on the network
No collisions
Allows different priorities to be assigned to different stations on the ring. Transmissions from
a stations with higher priority take precedence over stations with lower priority.

Demand Priority Access Method


Demand priority is a relatively new access method designed for the 100-Mbps Ethernet standard
known as 100VG-AnyLAN. It has been sanctioned and standardized by the Institute of Electrical
and Electronic Engineers (IEEE) in its 802.12 specification, which is discussed later chapter 6.
This access method is based on the fact that repeaters and end nodes are the two components that
make up all 100VG-AnyLAN networks. The Figure below shows a demand-priority network.

Network Protocols and Architecture Page 21


Data Communication and Computer Networks

Star-bus network access method for 100VG-AnyLAN is demand priority


In the above figure the hubs or repeaters manage network access by doing round-robin searches
for requests to send from all nodes on the network. The repeater, or hub, is responsible for noting
all addresses, links, and end nodes and verifying that they are all functioning. According to the
100VG-AnyLAN definition, an end node can be a computer, bridge, router, or switch.
As in CSMA/CD, two computers using the demand-priority access method can cause contention
by transmitting at exactly the same time. However, with demand priority, it is possible to
implement a scheme in which certain types of data will be given priority if there is contention. If
the hub or repeater receives two requests at the same time, the highest priority request is serviced
first. If the two requests are of the same priority, both requests are serviced by alternating between
the two.
In a demand-priority network, computers can receive and transmit at the same time because of the
cabling scheme defined for this access method. In this method, four pairs of wires are used, which
enables quartet signaling, transmitting 25 MHz signals on each of pairs of wire in cable.
In a demand-priority network, there is communication only between the sending computer, the
hub, and the destination computer. This is more efficient than CSMA/CD, which broadcasts
transmissions to the entire network. In demand priority, each hub knows only about the end nodes
and repeaters directly connected to it, whereas in a CSMA/CD environment, each hub knows the
address of every node in the network.

Summary of the process followed by demand priority


Requires a 'smart' hub that controls access to the network
The ‘smart hubs’ manage network access by performing cyclical searches for requests to
send from all nodes on the network. The ‘smart hub’ is responsible for noting all addresses,
links and end nodes and verifying if they are all functioning. An "end node" can be a
computer, bridge, router or switch.

Network Protocols and Architecture Page 22


Data Communication and Computer Networks
A station needing to transmit sends a request to the hub.
The station is given permission to transmit by the hub.
The hub switches the incoming transmission to the destination device. Transmissions are
between sender and receiver only, and are not broadcast.
When multiple requests for transmission arrive at the hub at the same time, the highest
priority is serviced first—two priorities are possible, high and normal.
If two requests having the same priority arrive at the same time, the hub’s port sequence
number acts as the tie breaker.

Advantages of demand priority


The ability to designate priority service to time-sensitive traffic such as real-time video. If
two have the same priority, both are serviced by alternating between the two.
Utilizes a directed transmission. The hub directs the transmission from sender to intended
recipient rather than sending it to all stations. There is only communication between the
sending computer, the hub and the destination computer
The computers do not contend on their own for access to the cable, but operate under the
centralized control of the hub.
The use of four pairs of wires. By using four pairs of wires, workstations can transmit and
receive at the same time. This is because demand priority employs 'quartet signaling' on
four pairs of wires.
Used with 100 Mbps standard called 100VG (Voice Grade) AnyLAN.

Access methods summary


The following table summarizes the major features of each access method:

Demand
Feature/function CSMA/CD CSMA/CA Token passing
priority
Type of Broadcast Broadcast
Token based Hub based
communication based based
Type of access
Contention Contention Non-contention Contention
method

Network Protocols and Architecture Page 23


Data Communication and Computer Networks
Ethernet LocalTalk Token Ring 100VG-
Type of Network ARCnet AnyLAN

5.3 The Network Layer


The objective of the network layer is delivery of a packet from the source-to-destination, possibly
across multiple networks (links). This layer is responsible to determine (find) the path/route
through which data are travel from source to destination (i.e. it concerned with getting packets
from source to destination).

To meet the objective stated above the network layer is responsible for the following functions:
(1) Logical addressing and Logical-Physical Address Mapping:
The physical addressing implemented by the data link layer handles the addressing problem
locally. If a packet passes the network boundary, we need another addressing system to help
distinguish the source and destination systems. So that this layer is in charge of packet addressing,
converting logical addresses into physical addresses.

Network Protocols and Architecture Page 24


Data Communication and Computer Networks
(2) Internetworking and Routing:
Internetworks are multiple networks that are connected in such a way that they act as one large
network, connecting multiple office or department networks. Internetworks are connected by
networking hardware such as routers, switches, and bridges. Internetworking is a solution born of
three networking problems: isolated LANs, duplication of resources, and the lack of a centralized
network management system. With connected LANs, companies no longer have to duplicate
programs or resources on each network. This in turn gives way to managing the network from one
central location instead of trying to manage each separate LAN. We should be able to transmit any
packet from one network to any other network even if they follow different protocols or use
different addressing modes.
When independent networks or links are connected to create internetworks (network of networks)
or a large network, the connecting devices (called routers or switches) route or switch the packets
to their final destination. One of the functions of the network layer is to provide this mechanism.
This layer is also in charge of setting the routing. The packets will use to arrive at their destination,
based on factors like traffic and priorities. The network layer determines that how data transmits
between the network devices. It controls the operation of subnet, deciding which physical path the
data should take based on network conditions, priority of service, and other factors.
If two systems are connected to same link, then there is no need for network layer. And if two
systems are attached to different networks with connecting devices like routers between the
networks, then there is need for the network layer.
Note: The X.25 protocols works at the physical, data link, and network layers.

Inter-Networking

Network Protocols and Architecture Page 25


Data Communication and Computer Networks

The network layer lies between data link layer and transport layer. It takes services from Data link
and provides services to the transport layer.

(3) Congestion Control and Subnet Traffic Control:


A router can be connected to 4-5 networks. If all the networks send packet at the same time with
maximum rate possible then the router may not be able to handle all the packets and may drop

Network Protocols and Architecture Page 26


Data Communication and Computer Networks
some/all packets. In this context the dropping of the packets should be minimized and the source
whose packet was dropped should be informed. The control of such congestion is also a function
of the network layer.
On the other side routers (network layer intermediate systems) can instruct a sending station to
"throttle back" its frame transmission when the router's buffer fills up. Other issues related with
this layer are transmitting time, delays, jittering.

(4) Packetizing
The network layer receive message segment from transport layer and wrap it with IP header that
is known as datagram among other things, includes the logical addresses of the sender and receiver
to creates its own packets by encapsulating these packets. The process is known as packetizing.
This packetizing in done by Internet Protocol (IP) that defines its own packet format.
Datagram is just another name of packet. Network layer use datagram to transfer information
between nodes. Two types of packets are used at the Network layer: data and route updates.
Data packets:- are used to transport the user data across the network. Protocols used by data
packets are known as routed protocol. For example IP and IPv6
Route update packets:- These packets are used to update the route information within
internetwork. Routers use these packets. Protocols that send route update packets are called
routing protocols; for example RIP, RIPv2, EIGRP, and OSPF
(5) Fragmentation
Fragmentation means dividing the larger packets into small fragments. The maximum size for a
transportable packet in 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. If it determines that
a downstream router's maximum transmission unit (MTU) size is less than the frame size, a router
can fragment a frame for transmission and re-assembly at the destination station.

Network Protocols and Architecture Page 27


Data Communication and Computer Networks
Note: The most known protocols that works on the network layer include IP, ICMP, ARP, RIP,
OSI, IPX and OSPF.

5.3.1 The IP protocol and IP Address (Logical Addressing)


One of the most important protocols which is the transmission mechanism used in the TCP/IP suite
is the Internetworking Protocol (IP). This is used at the Internet layer of TCP/IP (i.e. the Network
layer in the OSI model). The IP provides unreliable, connectionless best-effort datagram delivery
service between network stations, whereas TCP provides reliable, efficient and cost-effective end-
to-end delivery of data. The term best effort means that IP provides no error checking or tracking.
IP assumes the unreliability of the underlying layers and does its best to get a transmission through
to its destination, but with no guarantees.
IP transports data in packets called datagrams, each of which is transported separately. Datagrams
can travel along different routes and can arrive out of sequence or be duplicated. IP does not keep
track of the routes and has no facility for reordering data-grams once they arrive at their
destination. The limited functionality of IP should not be considered a weakness, however. IP
provides bare-bones transmission functions that free the user to add only those facilities necessary
for a given application and thereby allows for maximum efficiency.
Large number of different networks can be combined together to from bigger networks or
internetwork. In order to identify each device on internetwork uniquely, network layer defines an
addressing scheme. There are two possible approaches used for addressing; flat and hierarchical.
In flat addressing every possible node is assigned a unique number. When a new node is added to
the network, it must be given an address within the allowed address range. Addressing used in
Ethernet is an example of flat addressing, where addresses (48-bits long) are allocated centrally,
blocks of addresses are apportioned to manufactures, so that no two devices in the world will have
the same address. Flat addressing has the advantage that if a node is moved from one location to
another, it can retain its unique address.
In hierarchical addressing, each address consists of a number of fields; as each field is inspected,
the packet is taken nearer to the destination. This is very similar to the addressing used in postal
system. A significant advantage of hierarchical addressing is that it is possible to relate hierarchical
address structure to the topology of the network, so that routing is simplified. This scheme has
disadvantage that if a host moves from one location to another, a new address needs to be allocated
to it, in the same manner that an address change is required as we change house.
Generally four levels of addresses are used in an internet employing the TCP/IP protocols: physical
(link) addresses, logical (IP) addresses, port addresses, and specific addresses,

Network Protocols and Architecture Page 28


Data Communication and Computer Networks

IP Addressing
As discuss in previous section communication at the network layer is host-to-host (computer-
tocomputer); a computer somewhere in the world needs to communicate with another computer
somewhere else in the world. Usually, computers communicate through the Internet. The packet
transmitted by the sending computer may pass through several LANs or WANs before reaching
the destination computer. IP is the primary protocol that has the task of delivering distinguished
protocol datagrams (packets) from the source host to the destination host solely based on their
addresses. For this purpose the Internet Protocol defines addressing methods and structures for
datagram encapsulation. Such an address distinguishes each device uniquely and universally.
These logical address known as IP address. IP routes packets on the network by using IP
addresses.
The first major version of addressing structure, now referred to as Internet Protocol Version 4
(IPv4) is still the dominant protocol of the Internet, although the successor, Internet Protocol
Version 6 (IPv6), is being deployed actively worldwide (128 bits).

(1) IPv4 addresses


An IPv4 address is a 32-bit address that uniquely and universally defines the connection of a device
(for example, a computer or a router) to the Internet. They are unique in the sense that each address
defines one, and only one, connection to the Internet. Two devices on the Internet can never have
the same address at the same time. On the other hand, if a device operating at the network layer
has M connections to the Internet, it needs to have M addresses. The IPv4 addresses are universal
in the sense that the addressing system must be accepted by any host that wants to be connected
to the Internet.
When a computer is connected to a network or the Internet, it is assigned a unique, universal IP
address. If you're connecting to the Internet, chances are you're given an IP automatically by your
ISP (Internet Service Provider), if you're connecting to your LAN then you're either given the IP
automatically or you manually configure the workstation with an assigned IP.

Network Protocols and Architecture Page 29


Data Communication and Computer Networks
IPv4 addresses are displayed in dotted decimal notation, and appear as four numbers separated by
dots. Each number of an IP address is made from eight individual bits known as octet. Each octet
can create number value from 0 to 255.
An IPv4 address would be 32 bits long in binary divided into the two components, network
component and host component. Network component is used to identify the network that the
packet is intend for, and host component is used to identify the individual host on network.
Network component :- Defines network segment of device.
Host component :- Defines the specific device on a particular network segment

Address Space:- A protocol such as IPv4 that defines addresses has an address space. An address
space is the total number of addresses used by the protocol. If a protocol uses N bits to define an
address, the address space is 2N because each bit can have two different values (0 or 1) and N bits
can have 2N values. IPv4 uses 32-bit addresses, which means that the address space is 232 or
4,294,967,296 (more than 4 billion). This means that, theoretically, if there were no restrictions,
more than 4 billion devices could be connected to the Internet. We will see shortly that the actual
number is much less because of the restrictions imposed on the addresses.
Notations: There are two prevalent notations to show an IPv4 address: binary notation and dotted-
decimal notation. In binary notation, the IPv4 address is displayed as 32 bits. Each octet is often
referred to as a byte. So it is common to hear an IPv4 address referred to as a 32-bit addressor a 4-
byte address. The following is an example of an IPv4 address in binary notation:
01110101 10010101 00011101 00000010
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. The following is the dotteddecimal
notation of the above address:
117.149.29.2
The figure below shows an IPv4 address in both binary and dotted-decimal notation. Note that
because each byte (octet) is 8 bits, each number in dotted-decimal notation is a value ranging from
0 to 255.

Network Protocols and Architecture Page 30


Data Communication and Computer Networks
Change the following IPv4 addresses from binary notation to dotted-decimal notation.

Change the following IPv4 addresses from dotted-decimal notation to binary notation

Find the error, if any, in the following IPv4 addresses.

Classful Addressing
IPv4 addressing, at its inception, used the concept of classes. This architecture is called classful
addressing. Although this scheme is becoming obsolete, we briefly discuss it here to show the
rationale behind classless addressing.
In classful addressing, the address space is divided into five classes: A, B, C, D, and E. Each class
occupies some part of the address space.
We can find the class of an address when given the address in binary notation or dotted-decimal
notation. If the address is given in binary notation, the first few bits can immediately tell us the
class of the address. If the address is given in decimal-dotted notation, the first byte defines the
class. Both methods are shown in Figure below.
CLASS A 0XXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
CLASS B 10XXXXXX XXXXXXXX XXXXXXXX XXXXXXXX

CLASS C 110XXXXX XXXXXXXX XXXXXXXX XXXXXXXX


CLASS D 1110XXXX XXXXXXXX XXXXXXXX XXXXXXXX
CLASS E 11110XXX XXXXXXXX XXXXXXXX XXXXXXXX

Network Protocols and Architecture Page 31


Data Communication and Computer Networks

Note: “X” stands for don’t care values (i.e. either “o” or ” 1”)

The first 3 classes ( A, B and C) are used to identify workstations, routers, switches and other
devices whereas the last 2 Classes (D and E) are reserved for special use.
Classes and Blocks
One problem with classful addressing is that each class is divided into a fixed number of blocks
with each block having a fixed size as shown in Table below.

Let us examine the table. Previously, when an organization requested a block of addresses, it was
granted one in class A, B, or C. Class A addresses were designed for large organizations with a
large number of attached hosts or routers. Class B addresses were designed for mid size

Network Protocols and Architecture Page 32


Data Communication and Computer Networks
organizations with tens of thousands of attached hosts or routers. Class C addresses were designed
for small organizations with a small number of attached hosts or routers.
We can see the flaw(defect) in this design. A block in class A address is too large for almost any
organization. This means most of the addresses in class A were wasted and were not used. A block
in class B is also very large, probably too large for many of the organizations that received a class
B block. A block in class C is probably too small for many organizations. Class D addresses were
designed for multicasting. Each address in this class is used to define one group of hosts on the
Internet. The Internet authorities wrongly predicted a need for 268,435,456 groups. This never
happened and many addresses were wasted here too. And lastly, the class E addresses were
reserved for future use; only a few were used, resulting in another waste of addresses.

Network id and Host id Concept


An IPv4 address is not only a number but it gives us 2 pieces of valuable information (i.e. network id
and host id). As discussed above the first octet (first 8 Bits or first byte) of an IP Address is enough
for us to determine the Class to which it belongs. And, depending on the Class to which the IP
Address belongs, we can determine which portion of the IP Address is the Network ID (or prefix),
and which is the Node ID (or suffix). This means, in classful addressing, an IP address in class A,
B, or C is divided into network id and host id. These parts are of varying lengths, depending on
the class of the address.

In class A networks, the first one byte (8 bits) of the IP address are fixed (i.e. the first of the four
numbers) and defines the network id, whereas the last three bytes define the host id, allowing
network administrators to assign as computer addresses. In class A, As 24 bits are available for

Network Protocols and Architecture Page 33


Data Communication and Computer Networks
use in the network, 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 class B network the first 16 bits (two bytes) of the IP address are fixed and define the network
id whereas two bytes define the host id. 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.
In class C networks have the first 24 bits (three bytes) of the IP address fixed which define the
network id and one byte defines the host id, allowing only 255 (28) different computer 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 (so there are 16,384 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).
Max. number of Max. computers
Network class Prefix bits Suffix bits
networks per network
A 7 128 24 16777216
B 14 16384 16 65536
C 21 2097152 8 256

For example, given the IP address 128.255.10.1, we know immediately that this is on a class B
network. We can tell this because if we rewrite the address in binary form
(10000000.11111111.00001010.00000001), the first two bits are 10, which always indicate a class
B network. So the first 16 bits represent the network ID (128.255) and the last 16 bits are the
computer ID (10.1).
To tell what class of network an IP address is on, we do not need to always rewrite the address in
binary form. Any address beginning with a number between 0 and 127 is on a class A network,
between 128 and 191 is on a class B network, and between 192 and 223 is on a class C network.
Any IP address starting with any number greater than 223 is reserved for special uses.

Exercise 1
For example, using the class-based system of IP addressing, what can you deduce from the
following IP addresses? i.e. What class network are they on, and what are the network ID and
computer ID?

Network Protocols and Architecture Page 34


Data Communication and Computer Networks
i. 223.1.0.129 ii.
2.255.15.254 iii.
131.192.161.1 iv.
333.13.0.13

Network Protocols and Architecture Page 35


Data Communication and Computer Networks
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 summarizes these.
Computer ID Description Use
Network ID
All 0’s All 0’s This computer Used during system boot
All 0’s Computer ID A computer on this
subnet
Network ID All 0’s Network number Used to refer to an entire subnet

All 1’s All 1’s Limited broadcast Broadcasts message to all


computers on this subnet
Network ID All 1’s Directed broadcast Broadcasts message to all
computers on specified network
127 Any Loopback address Used for testing

Any number Any Multicast &


greater than 223 experimental address

We can see that any IP address that has a valid network ID, but all binary 0’s for the computer ID, is
the network number. The network number is a way of referring to an entire subnet. Therefore this
address cannot be assigned to a computer. Similarly if the computer ID is all binary 1’s it is a
broadcast address. The broadcast address is used if you want to send a packet to every computer on
a subnet. Therefore this address can also not be assigned to a computer on the network. For example,
a class C network provides 256 different values for the computer ID, but only 254 of these can be
assigned to computers.
Most subnets have at least one router. If it didn’t have a router it would be isolated and could not
communicate with any other networks. A router must also have an IP address on the subnet, and by
convention the first IP address after the network number is assigned to the default router. Note that
this is not a rule, just a convention (it is usually done but you do not have to do it).
Therefore the valid IPv4 addresses range for classful address are give below:
Class A addresses range from 1-126.
Class B addresses range from 128-191.
Class C addresses range from 192-223.
Class D addresses range from 224-239.
Data Communication and Computer Networks
Class E addresses range from 240-254.

Mask
Although the length of the network id and host id (in bits) is predetermined in classful addressing, we
can also use a mask(also called the default mask), a 32-bit number made of contiguous 1s followed
by contiguous 0s. The masks for classes A, B, and C are shown in Table below. The concept does not
apply to classes D and E.

The mask can help us to find the network id and the host id. For example, the mask for a class A
address has eight 1s, which means the first 8 bits of any address in class A define the network id; the
next 24 bits define the host id.
The last column of the above Table shows the mask in the form /n where n can be 8, 16, or 24 in
classful addressing. This notation is also called slash notation or Classless Inter domain Routing
(CIDR) notation. The notation is used in classless addressing, which we will discuss later. We
introduce it here because it can also be applied to classful addressing. We will show later that classful
addressing is a special case of classless addressing.

Host Addresses, Network address and Broadcast ID

Block Size:- Block size is size of subnet including network address, hosts addresses and broadcast
address.

Network address:- First address of subnet is called network ID. This address is used to identify
one segment or broadcast domain from all the other segments in the network.

Broadcast ID:- There are two types of broadcast, direct broadcast and full broadcast.
Direct broadcast or local broadcast is the last address of subnet and can be hear by all
hosts in subnet.
Full broadcast is the last address of IP classes and can be hear by all IP hosts in network.
Full broadcast address is 255.255.255.255
The main difference between direct broadcast and full broadcast is that routers will not
propagate local broadcasts between segments, but they will propagate directed
broadcasts.
Data Communication and Computer Networks
Host Addresses:- All address between the network address and the directed broadcast address
is called host address for the subnet. You can assign host addresses to any IP devices such as
PCs, servers, routers, and switches.
(2) Subnetting and Classless Addressing
Subnetting
During the era of classful addressing, sub netting was introduced. If an organization was granted a
large block in class A or B, it could divide the addresses into several contiguous groups and assign
each group to smaller networks (called subnets) or, in rare cases, share part of the addresses with
neighbors. These smaller network known as subnets and this process known as subnetting. Let's take
an example of a company that have three story building, divided by floors, with each floor divided
into offices. Think building as network, floors as subnets, and office as host.
Subnetting is a process of breaking large network in smaller network known as subnet (a group of
computers divided by layer 3 IP address). Subnet are easier to manage. Subnetting reduces network
traffic, which improve network performance. Subnetting increases the number of 1s in the mask.
Subnet have hierarchical structure and In subnetting some bits from host portion are taken to create
subnet address.

Supernetting
The time came when most of the class A and class B addresses were depleted; however, there was
still a huge demand for midsize blocks. The size of a class C block with a maximum number of 256
addresses did not satisfy the needs of most organizations.
Even a midsize organization needed more addresses, one solution was 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 super-network or a supemet. 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 contiguous class C blocks. The organization can then use these
addresses to create one super-network. Supernetting decreases the number of 1s in the mask. For
example, if an organization is given four class C addresses, the mask changes from /24 to /22. We
will see that classless addressing eliminated the need for supernetting.
Supernetting(the reverse process of subnetting) is done at router, for route broadcast. Supernetting
allows router to keep its routing table as small as possible. Router relies on routing to determine route
for packet. Router broadcast its routing table so other router can learn about the network it have. As
network grow routers require huge memory tables to store all routing information. Supernetting helps
reduce the size of router memory tables by combining and summarizing multiple routing information
entries into one single entry.
Data Communication and Computer Networks
Differences between Subnetting and Supernetting
Subnetting breaks large network in smaller networks which are smaller networks are easier to
manage, while supernetting combine smaller networks in single possible large network.
Subnetting is done to reduce network traffic by removing collision and broadcast traffic, that
overall improve performance, while supernetting is done to reduce size of routing table
Subnetting reduce collision and broadcast traffic between subnets. Supernetting reduce
broadcast traffic between routers.
Subnetting reduces network traffic Subnetting allows you to apply network security polices at
the interconnection between subnets.
Subnetting allows you to save money by reducing requirement for IP range

Classless Addressing
When the class-based system was introduced, it was thought that it would easily provide enough IP
addresses for the Internet. However, the flaws in classful addressing scheme combined with the fast
growth of the Internet users worldwide led to the near depletion of available addresses (i.e. due to
rapid increase in the number of Internet users, IP addresses eventually came to be in short supply).
Yet the number of devices on the Internet is much less than the 232 address space, we have run out of
class A and B addresses, and a class C block is too small for most midsize organizations. To overcome
address depletion and give more organizations access to the Internet, classless addressing was
designed and implemented. In 1994 a new system was introduced: classless inter-domain routing
(CIDR).

Address Block:- In classless addressing (CIDR scheme), there are no classes, but when an entity,
small or large, needs to be connected to the Internet, it is granted a block (range) of addresses. The
size of the block (the number of addresses) varies based on the nature and size of the entity. For
example, a household may be given only two addresses; a large organization may be given thousands
of addresses. An ISP, as the Internet service provider, may be given thousands or hundreds of
thousands based on the number of customers it may serve.

Restriction:- To simplify the handling of addresses, the Internet authorities impose three restrictions
on classless address blocks:

• The addresses in a block must be contiguous, one after another.


• The number of addresses in a block must be a power of 2 (1, 2, 4, 8 .... ).
• The first address must be evenly divisible by the number of addresses.
Data Communication and Computer Networks
The Figure below shows a block of addresses, in both binary and dotted-decimal notation, granted to
a small business that needs 16 addresses.

We can see that the restrictions are applied to this block. The addresses are contiguous. The number
of addresses is a power of 2 (16 = 24), and the first address is divisible by16. The first address, when
converted to a decimal number, is 3,440,387,360, which when divided by 16 results in 215,024,210.
Classless addressing Mask (Subnet Mask)
A better way to define a block of addresses is to select any address in the block and the mask. CIDR
uses subnet masks to subdivide networks. As we discussed before, a mask (a subnet mask in case of
classes addressing) is a 32-bit number in which the n leftmost bits are 1s and the 32 - n rightmost bits
are 0s. However, in classless addressing the mask for a block can take any value from 0 to 32 and
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). It is very convenient to give just the value of n preceded by a slash (CIDR
– Classless Inter Domain Routing notation). The address and the /n notation completely define the
whole block (the first address, the last address, and the number of addresses).
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 minimizes 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”.
Data Communication and Computer Networks
In decimal notation
IP address 192.168.1.10
Subnet mask 255.255.252.0
Network address is 192.168.1 and host address is 10. In binary
notation
IP address 11000000.10101000.00000001.00001010 Subnet mask
11111111.11111111.11111100.00000000
Network address is 11000000.10101000.00000001 and host address is 00001010

CIDR system has temporarily alleviated shortage of IP addresses on 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.
Method of subnetting
The classless addressing schema is achieved by using the subnetting process. In subnetting we find
the answer of following questions.
What is subnet mask for given address?
How many subnets does given subnet mask provide ?
What is block size for given subnet mask?
What are the valid subnets?
What are the total hosts?
How many valid hosts are available per subnet?
What is broadcast address of each subnet (i.e. last address of the subnet)?
What is network address of each subnet ((i.e. first address of the subnet)?)?

What is subnet mask for given address?


Subnetting take places when we extend the default subnet mask. We cannot perform subnetting with
default subnet mask of classful address and every classes have default subnet mask. To figure out
subnetted subnet mask, we first need to write down the default subnet mask. Then find the host bits
borrowed to create subnets and convert them in to decimal.
Data Communication and Computer Networks

For example find the subnet mask of address 188.25.45.48/20? This address belong to class B and
class B has default subnet mask 255.255.0.0[ /16 in CIDR ]. We borrowed 4 bits from hosts portion.
As you know subnetting move from left to right and it cannot skip any network bit. So this subnet
mask in binary would be 11111111.11111111.11110000.00000000. First two octet have default value
so its decimal value would be 255.255. We will convert third octet in decimal value. To convert a
binary number in decimal we add its decimal equivalent value. In our example it would be
128+64+32+16+0+0+0+0 = 240. Our fourth octet has all bits off so its decimal value would be
0+0+0+0+0+0+0+0 =0. Our answer subnet mask would be 255.255.240.0
How many subnets does given subnet mask provide ?
To calculate the number of subnets provided by given subnet mask we use 2K , where K = number of
bits borrowed from host bits to create subnets. For example in 192.168.1.0/27, K is 3. By looking at
address we can determined that this address is belong to class C and class C has default subnet mask
255.255.255.0 [/24 in CIDR]. In given address we borrowed 27 - 24 = 3 host bits to create subnets.
Now 23 = 8, so our answer is 8.

What is block size (number of address) for subnet mask?


Block size or increment number is used to calculate the valid subnets. Once you figure out the block
size, calculation of valid subnets become pieces of cake. To figure out the block size, use this formula
256 - Subnet mask = block size.
For example block size for subnet mask 255.255.255.240 is 256 - 240 = 16.
In other way the number of addresses can be found by complementing the mask, interpreting it as a
decimal number, and adding 1 to it.
Data Communication and Computer Networks
The number of addresses in the block is the difference between the last and first address. It can easily
be found using the formula 232-N, where N is the number of network ID bits (/N in CIDR).
For Example, in 192.168.1.0/28, N is 28 which means that number of addresses is 2 32−28 = 16.

What are the valid subnets?


Calculating valid subnet is two steps process. First calculate total subnet by using formula 2K , where
K = number of bits borrowed from host bits to create subnets. In second step find the block size and
count from zero in block until you reach the subnet mask value.
For example calculate the valid subnets for 192.168.1.0/26.
Borrowed host bits are 2 [26-24], because the address belong to class C .
Total subnets are 22 = 4.
Subnet mask would be 255.255.255.192.
Block size would be 256-192 = 64 = 232-26.
Start counting from zero at blocks of 64, so our valid subnets would be 0,64,128,192.

What are the total hosts?


Total hosts are the hosts available per subnet. To calculate total hosts use formula 2H = Total hosts.
H is the number of host bits. For example in address 192.168.1.0/26 we have 32 - 26 [Total bits in
IP address - Bits consumed by network address] = 6. Total hosts per subnet would be 26 = 64.
How many valid hosts are available per subnet?
Valid hosts are the number of hosts those can be assigned to devices. It is imperative that every
network, regardless of Class and size, has a Network Address and a Broadcast Address which cannot
be used. So that we need to reduce two address per subnet, one for network ID and another for
broadcast ID. So our formula, to calculate valid hosts would be Total hosts -2 = Valid hosts. In above
example we have 64 hosts per subnet, so valid hosts in each subnet would be 64 - 2 = 62.

What is the network address of each subnet?


Network address is the first address of subnet. This address is used to locate the network, and cannot
be assigned to any host. In above example address 0,64,128,192 are the network address.
Data Communication and Computer Networks

Another way to find the first address is ANDing the given addresses with the mask. ANDing here is
done bit by bit. The result of ANDing 2 bits is 1 if both bits are 1s; the result is 0 otherwise.
For example, a block of addresses is granted to a small organization. We know that one of the
addresses is 205.16.37.39/28. What is the first address in the block?

What is broadcast address of each subnet?


Broadcast address is the last address of subnet. This address is reserve for network broadcast, and
cannot be assigned to any host. In above example
0 Subnet has broadcast address 63 64 Subnet has broadcast address 127
128 Subnet has broadcast address 191 192 Subnet has broadcast address 255
Data Communication and Computer Networks

Another way to find the first address is ORing the given addresses with the complement of subnet
mask. ORing here is done bit by bit. The result of ORing 2 bits is 0 if both bits are 0s; the result is 1
otherwise. The complement of a number is found by changing each 1to 0 and each 0 to 1. For example,
a block of addresses is granted to a small organization. We know that one of the addresses is
205.16.37.39/28. What is the first address in the block?

Note:
Network address is always the first IP address of subnet.
Broadcast address is always the last IP address of subnet (IP address before the next subnet).
Valid hosts are the IP addresses between network address and broadcast address.

Example 1: Class C - Subnetting


Default subnet mask of class C is 255.255.255.0. CIDR notation of class C is /24, which means 24
bits from IP address are already consumed by network portion and we have 8 host bits to work with.
Data Communication and Computer Networks
We cannot skip network bit, when we turned them on. Subnetting moves from left to right. So Class
C subnet masks can only be the following:
CIDR Decimal Binary
/25 128 10000000
/26 192 11000000
/27 224 11100000
/28 240 11110000
/29 248 11111000
/30 252 11111100

As we have already discussed earlier in this article that we have to have at least 2 host bits for
assigning IP addresses to hosts, that means we can't use /31 and /32 for subnetting.
/25
CIDR /25 has subnet mask 255.255.255.128 and 128 is 10000000 in binary. We used one host bit in
network address.
Default subnet mask of class C======= 11111111. 11111111. 11111111.10000000
N = 1 [Number of host bit used in network]
H = 7 [Remaining host bits]
Total subnets ( 2N):- 21 = 2.

Block size (256 - subnet mask):- 256 - 128 = 128.


Valid subnets ( Count blocks from 0) :- 0,128
Total hosts (2H) :- 27 = 128

Valid hosts per subnet ( Total host - 2 ) :- 128 - 2 = 126

Subnets Subnet 1 Subnet 2

Network ID 0 128

First host 1 129

Last host 126 254


Data Communication and Computer Networks

Broadcast ID 127 255

/26
CIDR /26 has subnet mask 255.255.255.192 and 192 is 11000000 in binary. We used two host bits in
network address.
Default subnet mask of class C====== 11111111. 11111111. 11111111.11000000
N=2 H=6
Total subnets ( 2N) :- 22 = 4.

Block size (256 - subnet mask) :- 256 - 192 = 64.


Valid subnets ( Count blocks from 0) :- 0,64,128,192
Total hosts (2H):- 26 = 64

Valid hosts per subnet ( Total host - 2 ):- 64 - 2 = 62


Subnets Subnet 1 Subnet 2 Subnet 3 Subnet 4
Network ID 0 64 128 192
First host 1 65 129 193
Last host 62 126 190 254
Broadcast ID 63 127 191 255

Example 2: Assume that we have a subnet with the network number 21.100.19.0, and a subnet mask
of 255.255.255.192 (i.e. a slash 26 network) which of the following IP addresses would be on the
subnet?
a) 21.100.19.1 b) 21.101.19.1 c) 21.100.19.128 d) 21.100.19.62
Answers
First we should note that the subnet mask indicates that the first 26 bits represent the network ID, and
the last 6 bits the host ID. Now we write the network ID in binary form: 21.100.19.0 corresponds to
00010101.01100100.00010011.00000000 (network ID is normal text, computer ID in italics).
Therefore, so long as the first 26 bits of an IP address are the same as indicated above, it will be on
the subnet. If any are different it will not be. Therefore the range of IP addresses for this subnet are
Data Communication and Computer Networks
21.100.19.0 to 21.100.19.63.
a) This is on the same subnet as it is in the range specified above.
b) This is not on the same subnet as it is not in the range specified. You can check this by writing
the address in binary form – you will find that one of the first 26 bits is different.
c) Again, this is not on the same subnet because it is not in the range specified. In this case the
25th bit is different to the network number of the subnet.
d) This is on the same subnet as it is in the range specified.
Example 3: Look at the network diagram in Figure 2 and answer the following questions:
(a) What class network are the computers A, B, D and E on? What about computer C?
(b) If computer E wanted to send a packet to computer C, what IP address would it send that
packet to?
(c) Can you identify any problems with the assignment of IP addresses and default gateways in
this network?

Figure: Network diagram


Answers
(a) Computers A, B, D and E are on a class A network, as the first number in the IP address is
between 0 and 127. Computer C is on a class B network as the first number is between 128
and 191.
Data Communication and Computer Networks
(b) Computer E would recognize that the target IP address (147.103.73.73) is on a different subnet
to itself, so it would send the packet to the default gateway (109.128.0.1).
(c) Computer B has an incorrect default gateway address, so it would not be able to communicate
with any computer outside its own subnet.
(d) Computer D has no default gateway defined, so again communications would be limited to its
own subnet
(e) The router ports F and I have the same IP address. This will cause problems if any network
station tries to access the address 147.103.0.1.

Example 4: Given the Class C network of 204.15.5.0/24, subnet the network in order to create the
following network with the host requirements shown.
Net A: must support 14 hosts Net D: must support 7 hosts
Net B: must support 28 hosts Net E: must support 28 host
Net C: must support 2 hosts
You are required to create five subnets. The largest subnet must support 28 host addresses. Is this
possible with a Class C network? and if so, then how?
You can start by looking at the subnet requirement. In order to create the five needed subnets you
would need to use three bits from the Class C host bits. Since you need three subnet bits, that leaves
you with five bits for the host portion of the address. How many hosts will this support? 25 = 32 (30
usable). This meets the requirement.
Therefore you have determined that it is possible to create the above network with a Class C network.
An example of how you might assign the sub-networks is as follows:
Net A: 204.15.5.0/27 Host Address Range 1 To 30
Net B: 204.15.5.32/27 Host Address Range 33 To 62
Net C: 204.15.5.64/27 Host Address Range 65 To 94
Net D: 204.15.5.96/27 Host Address Range 97 To 126
Net E: 204.15.5.128/27 Host Address Range 129 To 158

Key terms to remembers


A subnet is a smaller portion of large network treated as its own separate network. To create
subnet we borrow bits from host portion and assign them as network bits. This mean more
networks, fewer hosts.
Data Communication and Computer Networks
If the network bits on two addresses do not match, then the two packets are intended for two
separate networks.
On a 32 bits IP address at least eight bits must belong to the network portion and at least 2
bits must belong to the host portion.
Each IP address has a predefined IP class and that cannot be changed.
Each class has a predefined default subnet mask that tell us the octets, which are already part
of the network portion, as well as how many bits we have available to work with.
Whatever network class is it, we cannot change those bits that are already assigned.
We cannot assign the network ID and the broadcast address to a host.
Regardless how many bits are left in the host field, network ID and the broadcast address
must be reserved.
Subnet bits start at the left and go to the right, without skipping bits.

Exercise
1) What is the address space in each of the following systems?
a) A system with 8-bit addresses c) A system with 16-bit addresses
b) A system with 64-bit addresses
2) An address space has a total of 1024 addresses. How many bits are needed to represent an address?
3) An address space uses the three symbols 0, 1, and 2 to represent addresses. If each address is made
of 10 symbols, how many addresses are available in this system?
4) Find the class of the following IP addresses.
a. 11110111 11110011 10000111 11011101 b. 10101111 11000000 11110000 00011101
c. 11011111 10110000 00011111 01011101 d. 11101111 11110111 11000111 00011101
5) Find the net id and the host id of the following IP addresses .
a. 114.34.2.8 b. 132.56.8.6 c. 208.34.54.12
6) In a block of addresses, we know the IP address of one host is 25.34.12.56/16. What are the first
address(network address) and the last address(limited broadcast address) in this block?
8) In a block of addresses, we know the IP address of one host is 182.44.82.16/26. What are the first
address(network address) and the last address in this block?
7) An organization is granted the block 16.0.0.0/8. The administrator wants to create 500 fixedlength
subnets.
Data Communication and Computer Networks
a. Find the subnet mask.
b. Find the number of addresses in each subnet.
c. Find the first and last addresses in subnet 1 and subnet 500.
8) An organization is granted the block 130.56.0.0/16. The administrator wants to create 1024
subnets.
a. Find the subnet mask. b. Find the number of addresses in each subnet.
c. Find first and last addresses in subnet 1 and subnet 1024.
9) Write the following masks in slash notation (/n).
a. 255.255.255.0 b. 255.0.0.0 c. 255.255.224.0 d. 255.255.240.0
10) Find the range of addresses in the following blocks.
a. 123.56.77.32/29 b. 200.17.21.128/27
c. 17.34.16.0/23 d. 180.34.64.64/30
(3) Address Allocation
The next issue in classless addressing is address allocation. How are the blocks allocated? The
ultimate responsibility of address allocation is given to a global authority called the Internet
Corporation for Assigned Names and Addresses(ICANN). However, ICANN does not normally
allocate addresses to individual organizations. It assigns a large block of addresses to an ISP. Each
ISP, in turn, divides its assigned block into smaller sub blocks and grants the sub blocks to its
customers. In other words, an ISP receives one large block to be distributed to its Internet users. This
is called address aggregation: many blocks of addresses are aggregated in one block and granted to
one ISP.
Example: An ISP is granted a block of addresses starting with 190.100.0.0/16(65,536 addresses). The
ISP needs to distribute these addresses to three groups of customers as follows:
a) The first group has 64customers; each needs 256 addresses.
b) The second group has 128 customers; each needs 128 addresses.
c) The third group has 128 customers; each needs 64addresses.
Design the sub blocks and find out how many addresses are still available after these allocations.

Solution
Group 1:- For this group, each customer needs 256 addresses. This means that 8 bits are needed to
define each host. The prefix length is then 32 - 8 = 24. The addresses are 1st Customer:
Data Communication and Computer Networks

Group2:- For this group, each customer needs 128 addresses. This means that 7 bits are needed to
define each host. The prefix length is then 32- 7 = 25. The addresses are

Group3:- For this group, each customer needs 64 addresses. This means that 6 bits are needed to each
host. The prefix length is then 32- 6 = 26. The addresses are

Number of granted addresses to the ISP: 65,536


Number of allocated addresses by the ISP: 40,960
Number of available addresses: 24,576
Data Communication and Computer Networks

Exercise
1) An ISP is granted a block of addresses starting with 150.80.0.0/16. The ISP wants to distribute
these blocks to 2600customersas follows.
a) The first group has 200 medium-size businesses; each needs 128 addresses.
b) The second group has 400 small businesses; each needs 16 addresses.
c) The third group has 2000households; each needs 4 addresses.
Design the sub blocks and give the slash notation for each sub block. Find out how many addresses
are still available after these allocations.
2) An ISP is granted a block of addresses starting with 120.60.4.0/22. The ISP wants to distribute
these blocks to 100 organizations with each organization receiving just eight addresses. Design the
sub blocks and give the slash notation for each sub block. Find out how many addresses are still
available after these allocations.
3) An ISP has a block of 1024addresses. It needs to divide the addresses among 1024 customers.
Does it need subnetting? Explain your answer.
Variable Length Subnet Mask (VLSM)
In subnetting, you will notice that the same subnet mask was applied for all the subnets. This means
that all subnets have the same number of hosts as they use same subnet mask. You may need this in
some cases, but, in most cases, having the same subnet mask for all subnets ends up wasting address
space or it leads to inefficiencies.
For example, if you borrow 4 bits on a Class C network, the network was split into sixty equal-size
subnets of 14 valid hosts. however, each subnet did not utilize all the available host addresses,
Data Communication and Computer Networks
resulting in wasted address space. For instance, a serial link to another router only needs 2 hosts, but
with classical subnetting, you end up wasting 12 of those hosts. This can be visualized as follows:

Looking at the above graphic, you can see that of the subnets that are being used, NetA, NetC, and
NetD have a lot of unused host address space. This may have been a deliberate design accounting for
future growth, but in many cases this is just wasted address space due to the fact that the same subnet
mask is being used for all the subnets. Variable Length Subnet Masks (VLSM) allows you to use
different masks for each subnet, thereby using address space efficiently.
With VLSM, you can summarize subnets back to the Class A, B, or C network boundary. For example,
if you have a Class C network 192.168.1.0/24 and subnet it with a 26-bit mask, you have created four
subnets. Using VLSM and summarization, you can summarize these four subnets back to
192.168.1.0/24.
Example of VLSM: Given the following requirements, develop Subnetting scheme using VLSM:
Net A: must support 14 hosts Net B: must support 28 hosts
Net C: must support 2 hosts Net D: must support 7 hosts
Net E: must support 28 host
Determine what mask will allow the required number of hosts.
Net A: requires a /28 (255.255.255.240) mask to support 14 hosts
Net B: requires a /27 (255.255.255.224) mask to support 28 hosts
Net C: requires a /30 (255.255.255.250) mask to support 2 hosts
Data Communication and Computer Networks
Net D: requires a /28 (255.255.255.240) mask to support 7 hosts
Net E: requires a /27 (255.255.255.224 mask to support 28 hosts
The easiest way to assign the Subnets is to start assigning the largest first. Thus, you can assign in the
following manner.
Net B: 204.15.5.0/27 Host Address Range 1 To 30
Net E: 204.15.5.32/27 Host Address Range 33 To 62
Net A: 204.15.5.64/28 Host Address Range 65 To 78
Net D: 204.15.5.80/28 Host Address Range 81 To 94
Net C: 204.15.5.96/30 Host Address Range 97 To 98
This can be graphically represented as follows.

From the above graphic you can see how using VLSM helped save more than half of address space.

5.3.2 Network Address Translation(NAT)


The number of home users and small businesses that want to use the Internet is ever increasing. In the
beginning, a user was connected to the Internet with a dial-up line, which means that she was
connected for a specific period of time. An ISP with a block of addresses could dynamically assign
Data Communication and Computer Networks
an address to this user. An address was given to a user when it was needed. But the situation is
different today. Home users and small businesses can be connected by an ADSL line or cable modem.
In addition, many are not happy with one address; many have created small networks with several
hosts and need an IP address for each host. With the shortage of addresses, this is a serious problem.
A quick solution to this problem is called network address translation (NAT). NAT enables a user to
have a large set of addresses internally and one address, or a small set of addresses, externally. The
traffic inside can use the large set; the traffic outside, the small set.
To separate the addresses used inside the home or business and the ones used for the Internet, the
Internet authorities have reserved three sets of addresses as private addresses which specified by RFC
1918. (RFC stands for Request for Comments. RFCs are electronic documents that are used for
publishing Internet standards. Anybody can submit or comment on an RFC). The addresses are shown
in Table below.
Addresses for private networks

The third range (192.168.*.*) is the range used on the FBE network.
Any organization can use an address out of this set without permission from the Internet authorities.
Everyone knows that these reserved addresses are for private net-works. They are unique inside the
organization, but they are not unique globally.
These IP addresses also called ‘non-routable’ addresses. This means that routers on the Internet will
never forward them. This is because they are reserved for local network use. If every computer in the
world that was on a network connected to the Internet had to have a unique IP address we would have
run out of IP addresses many years ago. But many of these computers are on networks that only
connect to the Internet through a single router, gateway computer or dial-up connection. Therefore,
on networks like this we only need a single routable IP address; the rest of the computers can be given
non-routable addresses. A number of computers on networks in different parts of the world can share
the same non-routable IP address provided they are not directly connected on the same network.
Internet routers are programmed to ignore these addresses so there can be no address conflict.
See the Figure below for an illustration. Here we have two LANs, called A and B. Both contain 3
PCs with the same IP addresses (192.168.0.2 to 192.168.0.4). Similarly the routers that connect the
LANs to the Internet have the same IP address on the LAN (192.168.0.1). However, the Internet IP
addresses of each of these routers are different (200.111.23.12 and 197.210.33.12). Since all routers
are programmed to ignore addresses in the range 192.168.0.0 – 192.168.255.255 there is no address
Data Communication and Computer Networks
conflict. Note also that these computers can never receive packets from the Internet, because their
router would ignore them. All packets for these subnets must be addressed to the routable IP address
of the router. Therefore every network connected to the Internet must have at least 1 routable IP
address.

Exercise:- Which of the following IP addresses are invalid addresses for computers on the Internet?
If they are invalid, explain why.
a) 130.22.256.22 f) 255.255.255.255
b) 222.222.255.222 g) 127.0.0.1
c) 240.12.3.24 h) 13.13.0.13
d) 128.128.0.128 i) 10.240.12.11
e) 200.128.0.255
Answers
b, d, h are valid IP addresses
a) invalid address because the third number is 256 – the highest possible value is 255.
c) invalid address because the first number is above 223, which belong to reserved address
e) invalid address because the last number is 255, which represents directed broadcast address,
f) invalid address because it represents the full broadcast address, which is reserved
g) invalid address because it represents loopback address and cannot be assigned to computers.
This is used for troubleshooting purposes, and will send a message to the local computer.
i) invalid address because this is a non-routable address – it will be ignored by Internet routers so
the computer will never receive any packets.
Data Communication and Computer Networks
5.3.3 IPv6 Address
Despite all short-term solutions, such as classless addressing, Dynamic Host Configuration Protocol
(DHCP), that will explained later under an application layer protocols and NAT, address depletion is
still a long-term problem for the Internet. This and other problems in the IP protocol itself, such as
lack of accommodation for real-time audio and video transmission, and encryption and authentication
of data for some applications, have been the motivation for IPv6.

Structure and Notation


An IPv6 address consists of 16 bytes(octets); it is 128 bits long address. To make addresses more
readable, IPv6 specifies hexadecimal colon notation. In this notation, 128 bits is divided into eight
sections, each 2 bytes in length. Two bytes in hexadecimal notation requires four hexadecimal digits.
Therefore, the address consists of 32 hexadecimal digits, with every four digits separated by a colon,
as shown below figure.

Abbreviation of IPv6 notation


Although the IPv6 address, even in hexadecimal format, is very long, many of the digits are zeros. In
this case, we can abbreviate the address. The leading zeros of a section (four digits between two
colons) can be omitted. Only the leading zeros can be dropped, not the trailing zeros.

Using this form of abbreviation, 0074 can be written as 74, OOOF as F, and 0000as O. Note that 3210
cannot be abbreviated. Further abbreviations are possible if there are consecutive sections consisting
of zeros only. We can remove the zeros altogether and replace them with a double semicolon.
Data Communication and Computer Networks
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. Re-expansion of the abbreviated address is very simple:
Align the unabbreviated portions and insert zeros to get the original expanded address.
Example: Expand the address 0:15::1:12:1213 to its original.
Solution:- We first need to align the left side of the double colon to the left of the original pattern and
the right side of the double colon to the right of the original pattern to find now many Os we need to
replace the double colon.
xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx
0: 15: l: 12:1213
This means that the original address is 0000:0015:0000:0000:0000:0001 :0012: 1213

Address Space and Type Prefix


IPv6 has a much larger address space; 2128 addresses are available. The designers of IPv6 divided the
address into several categories. A few left most bits, called the type prefix, in each address define its
category. The type prefix is variable in length, but it is designed such that no code is identical to the
first part of any other code. In this way, there is no ambiguity; when an address is given, the type
prefix can easily be determined. Table below shows the prefix for each type of address. The third
column shows the fraction of each type of address relative to the whole address space.
Data Communication and Computer Networks

Reading Assignment
Ipv6 Unicast Addresses
Ipv6 Multicast Addresses
Ipv6 Allycast Addresses
Ipv6 Reserved Addresses
Ipv6 Local Addresses
Data Communication and Computer Networks
Exercise
(1) Show the shortest form of the following addresses.
a) 2340:lABC: 119A:A000:0000:0000:0000:0000
b) 0000: 00AA: 0000: 0000: 0000: 0000: 119A:A231
c) 2340:0000:0000:0000:0000: 119 A:AOO1 :0000
d) 0000:0000:0000:2340:0000:0000:0000:0000
(2) Show the original(unabbreviated) form of the following addresses.
a) 0::0 b) 0:AA::0 c) 0: 1234::3 d) 123::1:2
(3) What is the type of each of the following addresses?
a) FE80::12 b) FECO: :24A2 c) FF02::0 d) 0::01
(4) A host has the address 581E: 1456:2314:ABCD::1211. If the node identification is 48 bits, find
the address of the subnet to which the host is attached.
(5) A site with 200 subnets has the class B address of 132.45.0.0. The site recently migrated to IPv6
with the subscriber prefix 581E:1456:2314::ABCD/80.Design the subnets and define the subnet
addresses, using a subnet identifier of 32bits.
(6) Show in hexadecimal colon notation the IPv6 address
a) Compatible to the IPv4 address129.6.12.34
b) Mapped to the IPv4 address129.6.12.34
5.3.4 Addressing Mapping (ARP and RARP)
An internet is made of a combination of physical networks connected by internetworking devices such
as routers. A packet starting from a source host may pass through several different physical networks
before finally reaching the destination host. The hosts and routers are recognized at the network level
by their logical (IP) addresses.
However, packets pass through physical networks to reach these hosts and routers. At the physical
level, the hosts and routers are recognized by their physical addresses. The physical address and the
logical address are two different identifiers. We need both because a physical network such as
Ethernet can have two different protocols at the network layer such as IP and IPX (Novell) at the same
time. Likewise, a packet at a network layer such as IP may pass through different physical networks
such as Ethernet and LocalTalk(Apple).
This means that delivery of a packet to a host or a router requires two levels of addressing: logical
and physical. We need to be able to map a logical address to its corresponding physical address and
vice versa. These can be done by using either static or dynamic mapping.
Data Communication and Computer Networks
Static mapping involves in the creation of a table that associates a logical address with a physical
address. This table is stored in each machine on the network. Each machine that knows, for example,
the IP address of another machine but not its physical address can look it up in the table. This has
some limitations because physical addresses may change in the following ways:
a) A machine could change its NIC, resulting in a new physical address.
b) In some LANs, such as LocalTalk, the physical address changes every time the computer
is turned on.
c) A mobile computer can move from one physical network to another, resulting in a change
in its physical address.
To implement these changes, a static mapping table must be updated periodically. This overhead could
affect network performance.
In dynamic mapping each time a machine knows one of the two addresses (logical or physical), it can
use a protocol to find the other one.
ARP stands for the address resolution protocol. It operates at the Network layer of OSI, and the
Internet layer of TCP/IP. It is responsible for mapping from IP addresses to MAC addresses.
Anytime a host or a router has an IP datagram to send to another host or router, it has the logical (IP)
address of the receiver. The logical (IP) address is obtained from the DNS if the sender is the host or
it is found in a routing table if the sender is a router. But the IP datagram must be encapsulated in a
frame to be able to pass through the physical network. This means that the sender needs the physical
address of the receiver. The host or the router sends an ARP query packet. The packet includes the
physical and IP addresses of the sender and the IP address of the receiver. Because the sender does
not know the physical address of the receiver, the query is broadcast over the network
For example, suppose that a computer COM1 with IP address 10.0.0.2 wanted to send a message to a
computer COMSERVER with IP address 10.0.0.1. Before any communication is possible COM1 must
know the MAC address of COMSERVER. Stored in the RAM of COM1 will be an ARP cache. This
cache will contain a list of all IP-MAC translations that COM1 knows about. If there is no entry for
COMSERVER in the ARP cache on COM1, COM1 will broadcast an ARP Request packet to the
network. COMSERVER will receive this broadcast and notice that the target IP address in the message
is the same as its own. Therefore it will send a unicast ARP Reply back to COM1 with the required
MAC address. Notice that the ARP Request must be broadcast to the whole network, as COM1 does
not yet know the MAC address to send it to. But the ARP reply from COMSERVER can be unicast
because COMSERVER knows the MAC address of COM1 from the ARP Request packet. After COM1
receives the ARP Reply it can communicate directly with COMSERVER. It will also add the IP-MAC
translation for COMSERVER to its ARP cache.
Data Communication and Computer Networks

RARP stands for the reverse address resolution protocol, and is responsible for mapping from MAC
addresses to IP addresses. There are occasions in which a host knows its physical address, but needs
to know its logical address. This may happen in two cases:
(a) A diskless station is just booted. The station can find its physical address by checking its
interface, but it does not know its IP address.
(b) An organization does not have enough IP addresses to assign to each station; it needs to assign
IP addresses on demand. The station can send its physical address and ask for a short time
lease.
To create an IP datagram, a host or a router needs to know its own IP address or addresses. The IP
address of a machine is usually read from its configuration file stored on a disk file. The machine can
get its physical address (by reading its NIC, for example), which is unique locally. It can then use the
physical address to get the logical address by using the RARP protocol. A RARP request is created
and broadcast on the local network. Another machine on the local network that knows all the IP
addresses will respond with a RARP reply.
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.
Data Communication and Computer Networks
5.3.5 ICMP
As discussed earlier, the IP protocol provides unreliable and connectionless datagram delivery. It has
no error-reporting or error-correcting mechanism. What happens if something goes wrong? What
happens if a router must discard a datagram because it cannot find a router to the final destination, or
because the time-to-live field has a zero value? What happens if the final destination host must discard
all fragments of a datagram because it has not received all fragments within a predetermined time
limit? These are examples of situations where an error has occurred and the IP protocol has no built-
in mechanism to notify the original host. The IP protocol also lacks a mechanism for host and
managementq ueries. A host sometimes needs to determine if a router or another host is alive. And
sometimes a net-work administrator needs information from another host or router.
ICMP stands for Internet Message Control Protocol and has been designed to compensate for the
above two deficiencies. It is a companion to the IP protoco1. ICMP is used to transmit status and error
messages between network stations. For example, whenever you type a URL into Internet Explorer
and you get the message “Page cannot be displayed”, it is an ICMP packet that is responsible.
Types of Messages:- ICMP messages are divided into two broad categories: error-reporting messages
and query messages. The error-reporting messages report problems that a router or a host
(destination) may encounter when it processes an IP packet. The query messages, which occur in
pairs, help a host or a network manager get specific information from a router or another host. For
example, nodes can discover their neighbors. Also, hosts can discover and learn about routers on their
network, and routers can help a node redirect its messages.
Message Format:- An ICMP message has an 8-byte header and a variable-size data section. Although
the general format of the header is different for each message type, the first 4 bytes are common to
all. As shown on below Figure, the first field, ICMP type, defines the type of the message. The code
field specifies the reason for the particular message type. The last common field is the checksum field.
The rest of the header is specific for each message type. The data section in error messages carries
information for finding the original packet that had the error. In query messages, the data section
carries extra information based on the type of the query.
Data Communication and Computer Networks
One of the main responsibilities of ICMP is to report errors. Although technology has produced
increasingly reliable transmission media, errors still exist and must be handled. Error checking and
error control are not a concern of IP and ICMP was designed, in part, to compensate for this
shortcoming. However, ICMP does not correct errors, it simply reports them. Error correction is left
to the higher-level protocols. Error messages are always sent to the original source because the only
information available in the datagram about the route is the source and destination IP addresses. ICMP
uses the source IP address to send the error message to the source (originator) of the datagram. ICMP
handle five types of error (such as destination unreachable, source quench, time exceeded, parameter
problems, and redirection) and always reports error messages to the original source.

5.3.6 IGMP
The Internet Group Management Protocol (IGMP) is one of the necessary, but not sufficient, protocols
that is involved in multicasting. IGMP is a companion to the IP protocol. IGMP is not a multicasting
routing protocol; it is a protocol that manages group membership.
In any network, there are one or more multicast routers that distribute multicast packets to hosts or
other routers. The IGMP protocol gives the multicast routers information about the membership status
of hosts (routers) connected to the network. A multicast router may receive thousands of multicast
packets every day for different groups. If a router has no knowledge about the membership status of
the hosts, it must broad cast all these packets. This creates a lot of traffic and consumes bandwidth.

5.3.7 Delivery, Forwarding, and Routing


When independent networks or links are combined together to create internet works, multiple routes
are possible from source machine to destination machine. IP routing is the process of moving data
packets between different networks. The network layer protocols determine which route or path is
best from source to destination. This function of network layer is known as routing. Generally it deals
with determining how packets will be routed (transferred) from source to destination (i.e. it is the
process of taking packet from one device and sending it to another device on a different network).
Data Communication and Computer Networks

By default two different IP networks cannot communicate with each other. They need a mediator
device that can switch packet between them. Router takes this responsibility and used for routing.
Routers interfaces are associated with different networks. This association is kept in routing table.
Routers use it to take switching decision.
Every packet has two address; source and destination. Router uses destination address to deliver the
packet. The delivery of a packet to its final destination is accomplished by using two different methods
of delivery, direct and indirect.
Direct Delivery:- In a direct delivery, the final destination of the packet is a host connected to the
same physical network as the deliverer. Direct delivery occurs when the source and destination of the
packet are located on the same physical network or when the delivery is between the last router and
the destination host. The sender can easily determine if the delivery is direct. It can extract the network
address of the destination (using the mask) and compare this address with the addresses of the
networks to which it is connected. If a match is found, the delivery is direct.
Indirect Delivery:- If the destination host is not on the same network as the deliverer, the packet is
delivered indirectly. In an indirect delivery, the packet goes from router to router until it reaches the
one connected to the same physical network as its final destination. Note that a delivery always
involves one direct delivery but zero or more indirect deliveries. Note also that the last delivery is
always a direct delivery.
Data Communication and Computer Networks

Forwarding means to place the packet in its route to its destination. It requires a host or a router to
have a routing 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 route to the final destination. Several techniques can make
the size of the routing table manageable and also handle issues such as security
Next-Hop Method Vs. Route Method
In the next-hop technique, the routing table holds only the address of the next hop instead of
information about the complete route (route method). The entries of a routing table must be consistent
with one another.

Network-Specific Method Vs. Host-Specific Method


Instead of having an entry for every destination host connected to the same physical
network(hostspecific method), we have only one entry that defines the address of the destination
network itself. In other words, we treat all hosts connected to the same network as one single entity.
Data Communication and Computer Networks

Routing Table
A host/router has routing table with an entry for each destination, or combination of destinations, to
route IP packets. The routing table can be either static or dynamic.
Static routing table:- Contains information entered manually (i.e. routers learn from an
administrator). In static routing the Administrator enters the route for each destination and all network
locations manually into table. If any change occurs in network, administrator is responsible to update
it by hand in all routers i.e. When a table is created, it cannot update automatically when there is a
change in the Internet and the table must be manually altered by the administrator.
Can be used in small internet that doesn’t change very often, or in an experimental internet for
troubleshooting. It is poor strategy to use a static routing table in a big internet such as the Internet.
Advantage of static routing
It is easy to implement.
It is most secure way of routing, since no information is shared with other routers.
It puts no overhead on resources such as CPU or memory.
Disadvantage of static routing
It is suitable only for small network.
If a link fails static route cannot reroute the traffic.
Dynamic routing:- When routers learn from neighboring router through the routing protocols, it is
called dynamic routing. In dynamic routing routers add network locations automatically form the
routing information and updated periodically by using one of the dynamic routing protocols such as
RIP, OSPF, or BGP.
Data Communication and Computer Networks
Whenever there is a change in the Internet, such as a shutdown of a router or breaking of a link, the
dynamic routing protocols update all the tables in the routers (and eventually in the host)
automatically. The routers in a big internet such as the Internet need to be updated dynamically for
efficient delivery of the IP packets.
Advantage of dynamic routing
It is suitable for all type of networks.
Automatically build routing tables.
Reroute the traffic from possible network, in link failure condition.
Disadvantage of dynamic routing
It is hard to implement.
It is less secure, since it shares routing updates with other routers.
It puts additional overhead on resources such as CPU, memory and link bandwidth.
Depending on network requirement we can use either static routing or dynamic routing. Even more we
can use a combination of both dynamic and static routing.
Routing Table Format
A routing table for classless addressing has a minimum of four columns.

However, some of today's routers have even more columns.


We should be aware that the number of columns is vendor-dependent, and not all columns can
be found in all routers.

Mask:- defines the mask applied for the entry.


Network address:- defines network address to which packet is finally delivered.
Data Communication and Computer Networks
Next-hop address:- defines address of next-hop to which packet is delivered Interface:-
shows the name of the interface.
Flags:- on/off switches that signify either presence/absence. There 5 flags U
(up):- indicates the router is up and running
G (gateway):- means that the destination is in another network
H (host-specific):- indicates that the entry in the network address field is a host-specific
address.
D (added by redirection):- indicates that routing information for this destination has been
added to the host routing table by a redirection message from ICMP.
M (modified by redirection):- indicates that the routing information for this destination
has been modified by a redirection message from ICMP.
Reference count:- gives the number of users of this route at the moment.
Use:- shows the number of packets transmitted through this router

Routing Protocols
Routing protocols have been created in response to the demand for dynamic routing tables. A routing
protocol is a combination of rules and procedures that lets routers in the internet inform each other of
changes. It allows routers to share whatever they know about the internet or their neighborhood.
Routing protocols insure that packet takes the best path from these paths. To accomplish this task, a
router will need to perform following:
– Learn about the directly connected routers on its interface
– Find the networks that they have
– Build routing table from this information
– Choose best network from routing table to send the packet
Routing protocol uses routing Updates (mechanism of sharing information) to shares routing update
that contains network information with neighboring routers. Routers keep this information in routing
tables. In a particular time duration router advertise its routing information through broadcast or
multicast (Some protocols use broadcast for routing updates while some uses multicast). Different
protocols have different time intervals.
Routing updates contain all necessary information for routing protocol such as learned network,
timers, AS, AD, matrix values, interface details etc. The router keep the update in routing table.
Routing tables are used to determine the best path for packet. Routing protocols uses several concepts
to determine the best path.
Data Communication and Computer Networks
Types of Routing Protocols

Intra-domain and Inter-domain Routing


Today, an internet can be so large that one routing protocol cannot handle task of updating the routing
tables of all routers. For this reason, an internet is divided into autonomous systems.
An autonomous system (AS) is a group of networks and routers under the authority of a single
administration and that share same routing table information. AS is a boundary line for routing
protocol. It could be your company, or group of companies. It is defined by a numeric value. To
distinguish between different AS, Internet Assigned Numbers Authority (IANA) provides a range from
1 to 65535. There are two types of AS, private and public. Private AS numbers are used for internal
network. Public AS numbers are used for internet backbone.
Routing inside an autonomous system is referred to as intra-domain routing (Interior gateway
protocols (IGPs)) while routing between autonomous systems is referred to as inter-domain routing
(Exterior gateway protocols (EGPs) ). Some examples of IGPs are RIPv1, RIPv2, EIGRP, IGRP, and
OSPF and Example of EGPs is Border Gateway Protocol (BGP).
Each autonomous system can choose one or more intra-domain routing protocols to handle routing
inside the autonomous system. However, only one inter-domain routing protocol handles routing
between autonomous systems
Distance Vector
Distance vector routing protocol uses distance (metric value) and direction (vector) to find the best
path to destination network. In this type of routing protocol, the least-cost route between any two
nodes is the route with minimum distance. 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). We can think of nodes
as the cities in an area and the lines as the roads connecting them. A table can show a tourist the
minimum distance between cities.
Router receives routing update from neighboring router and these neighboring routers receive updates
from their neighboring routers until the destination network. Every router in the way of destination
Data Communication and Computer Networks
network called hop. Each time a packet goes through a router, it add one in hop count value. Route
with the least hop count value will be chosen as best path and will be placed in routing table. RIP is
the example of distance vector routing protocol. These protocol shares entire routing table to the
directly connected neighbors.

Link State
Link state routing protocols use more composite metric to locate the best path for destination network.
It maintains three separate tables. First table keeps track of directly connected neighbors. Second table
determines the entire network topology. Third is the routing table that keeps actual path. The node
can use Dijkstra's algorithm to build a routing table. OSPF is the example of link state protocol. Link
state protocols share their own links to all other routers in network.

Hybrid
Hybrid routing protocols are the mix of distance vector and link state protocol. To locate more
accurate path, it uses aspect from both distance vector and link state. EIGRP is the example of hybrid
routing protocols.
Data Communication and Computer Networks
All three types of protocol have their own advantage and disadvantage. They take different approach
in sharing routing updates and in choosing the best path. Administrative distance and metric value are
the mostly used approaches.
Administrative Distance
Administrative distance (AD) is the trustworthiness of routing update received from a neighbor router.
If a router receives two routing updates for same path from two different routing protocols then router
will check the AD value to choose the best path. AD is a numeric value from 0 to 255. If one update
has lower AD value than other, then the route with the lowest AD will be placed in the routing table
Route source Default AD value
Direct connected interface 0
Static route 1
EIGRP 90
IGRP 100
OSPF 110
RIP 120
External EIGRP 170
Unknown 255
Lower AD value is more believable by router. 0 is considered as the most trustworthiness network
while 255 is considered as invalid route and it will be never used.
Metric value
If two routing updates for same network have same AD value then metric will use to choose the best
path. Metric is a measurement to calculate best path. Route with the lowest metric will be chosen.
Different routing protocols use different metrics. It may use single metric or multiple metrics. For
example EIGRP uses bandwidth, delay, load, MTU and reliability while RIP only uses hop count as
metric.
Routing Metric Description
Protocol

EIGRP Bandwidth Capacity of link in Kbps

EIGRP Delay Time to reach in destination

EIGRP Load Path that is least utilize

EIGRP MTU Path that support largest frame size


Data Communication and Computer Networks

EIGRP Reliability Path that have least down time

OSPF Cost Inverse of bandwidth links

RIP Hop count Hops ( Routers) in the way of destination

Routing Example: In following figure we have two PCs. Both are located in different network.
Assume that PC0 sends a packet to PC1. It will go through the following steps.

10.0.0.0/8 Network is connected on router’s F0/1 interface.


20.0.0.0/8 Network is connected with router’s F0/2 interface.
PC0 sends a packet to PC1.
Router receives this packet in F0/1 interface.
Router checks destination address field in packet.
Packet has 20.0.0.2/8 address in destination address field.
IP address 20.0.0.2/8 belongs to 20.0.0.0/8 network.
Router checks routing table for matching network.
Routing table has an entry for 20.0.0.0/8 network.
20.0.0.0/8 Network is associated with F0/2 interface of router.
Based on this information router moves this packet from F0/1 to F0/2.
F0/2 interface sends this packet to its destination.
No additional configuration is required for directly connected networks. Router already knows how
to get it. Such as in above example both networks 10.0.0.0/8 and 20.0.0.0/8 were directly connected
to the router’s interfaces.
It is the easiest example of IP routing. In above example we used only one router to explain the
process. In real life there could be several routers in the way of destination address. These routers
may create certain path to the destination.
Data Communication and Computer Networks
More detail elaboration of the above example:
The Upper layers (application, presentation, session) and transport layer of PC0 prepare the data
segments and handed down to network layer. The network layer determines the route/path for the data
segment it received from transport layer by using appropriate routed protocol which used to transmit
user data packet across the network.
Network layer attaches IP header to the segment before it handed down to data-link layer. With IP
header segment becomes packet. IP header includes several fields such as the destination address
filed. This address filed plays leading role in routing. Based on its network layer decides whether
packet will remain in local network or goes to the remote network. All remote requests are sent to the
default gateway. Default gateway is the router that switches packets between different networks. Since
our destination address is located in remote network, the packet need to be sent to the default gateway.
Network layer handed down this packet to Data link layer. Data link layer appends header. It adds
source and destination MAC address in header and FCS in tail. After this modification packet
becomes frame. Data link layer uses ARP cache to resolve MAC address. If destination IP address is
located in local network, hosts MAC address will be used. If destination IP address is located in
remote network then default gateways MAC address will be used. In our example, destination address
is located in remote network so default gateways MAC address will be used.
Frames are converted into signals and the physical layer puts these signals into valuable transmission
media. Media carries these signals across the network. Every device in collision domain receives these
signals.
Signals are converted back into frame by receivers. The frame has destination MAC address. So that
the receiver device matches destination MAC address of frame with its own MAC address. If both
addresses do not match, the frame is discarded. Since in this example the router receives these signals
in FastEthernet port 0/0, when it compares MAC address, both MAC addresses are the same, so that
frame will be processed.
Packet will be pulled from frame. Packet contains destination IP address. Router checks its routing
table for destination IP address network. Routing table must have an entry for destination address
network otherwise packet will be discarded immediately. If router finds an entry for destination
address network in routing table, the packet will be switched to the exit interface. In our example it
will be FastEthernet 0/1. Exit interface uses ARP protocol to find the MAC address of destination
host. It converts packet in frame by attaching header and tail. In header it adds its MAC address in
source MAC address field and destination hosts MAC address in destination MAC address field.
Again frame is converted into signals. These signals are put into physical media. All devices in
collision domain receive these signals. PC1 also receives these signals. It converts signals into frame.
Frame has its MAC address in destination MAC address field. So it will pull packet from frame and
hand over the packet to network layer.
Data Communication and Computer Networks
Network layer checks IP address in destination IP address fields and compare it with its own IP
address. If both addresses match, packet will be processed. Segments will be pulled from packet.
Segments will be handed over to the transport layer. Transport layer reassemble segments in data and
gives it to upper layer. Upper layers (session, presentation, application) process data and present it to
user.
Same process is repeated every time when two hosts communicate with each other via router. Routing
is a complex process. Every step given above has several additional steps and has added complexity.
In this article we explained this complex process in easy steps.

5.4 Transport Layer


The Transport layer is responsible for connection management between two hosts and process to
process message delivery in a network by ensuring that the whole message arrives intact and in order
(in sequence), overseeing both error control (guarantees that no duplication or errors are occurring
in the data transfers) and flow control at the source-to-destination level. Transport layer also provides
the acknowledgement of the successful data transmission and retransmits the data if error is found.
Transport layer is at the core of OSI model and provides services to application layer and takes
services from network layer. So that the size and complexity of a transport protocol depends on the
type of service it can get from the network layer.

What does mean by Process-to-Process message delivery?


As a revision, the data link layer is responsible for delivery of frames between two neighboring nodes
over a link. This is called node-to-node delivery. On the other hand the network layer is responsible
for delivery of datagrams between two hosts which is called host-to-host delivery.
Communication on the Internet is not defined as the exchange of data between two nodes or between
two hosts. Real communication takes place between two processes (application programs). However,
at any moment, several processes may be running on the source host and several on the destination
host. To complete the delivery, we need a mechanism to deliver data from one of these processes
running on the source host to the corresponding process running on the destination host. This known
as process-to-process delivery and the transport layer is responsible for this task.
Data Communication and Computer Networks

There are five main functions of transport layer you want to remember always. These are:
Connection management
Segmentation
Service-point addressing
Error Control (Reliable and unreliable data delivery)
Flow control
Connection multiplexing

5.4.1 Connection management (Connection Establishment/Release):


Transport layer setup (establishes), maintain and tear down(release) connections for session layer
across the network (sets up and maintains the connection between two devices). Actual mechanic of
connection is controlled by transport layer.
According to requirement data transmission method can be connection oriented or connection less.
For unreliable data delivery connection less method is used. For reliable data delivery connection
oriented method is used.
Connection Oriented Transmission
Here, first a connection is established and then all packets of the application follow the same route.
To understand the above concept, we can also draw an analogy from the real life. Connection oriented
Data Communication and Computer Networks
service is modeled after the telephone system. All voice packets go on the same path after the
connection is established till the connection is hung up. It acts like a tube ; the sender pushes the
objects in at one end and the receiver takes them out in the same order at the other end.
In this type of transmission the receiving device sends an acknowledgment, back to the source after a
packet or group of packet is received. It is also known as reliable transport method. Because
connection oriented transmission requires more packets be sent across network, it is considered a
slower transmission method.
If the data that is sent has problems, the destination requests the source for retransmission by
acknowledging only packets that have been received and are recognizable. Once the destination
computer receives all of the data necessary to reassemble the packet, the transport layer assembles the
data in the correct sequence and then passes it up, to the session layer.

Connectionless Transmission
In a connectionless service, the packets are sent from one party to another with no need for connection
establishment or connection release.
Connection less service is modeled after the postal system. Each letter carries the destination address
and is routed independent of all the others. Here, it is possible that the letter sent first is delayed so
that the second letter reaches the destination before the first letter.
Similarly, in connectionless transmission each packet of an application is treated as an independent
entity. On each packet of the application the destination address is provided and packet is routed.
In this type of transmission the receiver does not acknowledge receipt of a packet. Sending device
assumes that packet arrive just fine. This approach allows for much faster communication between
devices. The trade-off is that connectionless transmission is less reliable than connection oriented.

Reliable Versus Unreliable service


The transport layer service can be reliable or unreliable. If the application layer program needs
reliability, we use a reliable transport layer protocol by implementing flow and error control at the
transport layer. This means a slower and more complex service. On the other hand, if the application
program does not need reliability because it uses its own flow and error control mechanism or it
needs fast service or the nature of the service does not demand flow and error control (real-time
applications), then an unreliable protocol can be used. In the Internet, there are two common different
transport layer protocols, UDP is connectionless and unreliable; TCP and SCTP are connection-
oriented and reliable protocols. These three can respond to the demands of the application layer
programs.
(a) Transmission Control Protocol (TCP):
Data Communication and Computer Networks
TCP is a connection oriented protocol. it creates a virtual connection between two TCPs to send data.
Connection-oriented transmission is said to be reliable. Think TCP as registry AD facility available
in Ethiopian post office. For this level of service, you have to buy extra ticket and put a bunch of extra
labels on it to track where it is going and where it has been. You get a receipt when it is delivered. In
this method you have a guaranteed delivery.
TCP uses flow and error control mechanisms at the transport level. Applications using TCP will
acknowledge received packets, and if a sent packet is not acknowledged it will be resent. Therefore
TCP provides completely reliable delivery. All of this costs you more, but it is reliable! The Telnet
and FTP applications both use TCP.

TCP Services

Process-to-Process Communication

Stream Delivery Service

Full-Duplex Communication

Connection-Oriented Service

Reliable Service

(b) User Datagram Protocol (UDP):


UDP is a connection less protocol. There is no acknowledgement of received packets so UDP uses
best effort delivery. Connection-less transmission is said to be unreliable. Now, don't get worried
about the term "unreliable" this doesn't mean that the data isn't going to get its destination; its only
means that it isn't guaranteed to get its destination. Think of your options when you are sending a
postcard, put it in the mailbox, and chances are good that it will get where it's supposed to go but there
is no guarantee. There is always a chance of missing in the way.
UDP is a very simple protocol using a minimum of overhead compared to TCP. This is because of
the lack of acknowledging packets, so communication is more efficient, but less reliable. On the other
hand, it's cheap.
UDP does not perform Flow control, Error control, Connection control and all these functions are
done by the processes (application layer programs). Also it does not capable of segmenting and
reassembling frames and does not implement sequence numbers. As a result, it can transmit only
small portions of data at a time. But UDP, like TCP, performs Service point addressing.
Data Communication and Computer Networks
Use of UDP
UDP is suitable for a process that requires simple request-response communication with little
concern for flow and error control. It is not usually used for a process such as FTP that needs
to send bulk data
UDP is suitable for a process with internal flow and error control mechanisms. For example, the
Trivial File Transfer Protocol (TFTP) process includes flow and error control. It can easily
use UDP.
UDP is a suitable transport protocol for multicasting. Multicasting capability is embedded in the
UDP software but not in the TCP software.
UDP is used for management processes such as SNMP.
UDP is used for some route updating protocols such as Routing Information Protocol (RIP).

5.4.2 Segmentation and reassembly


Data usually exists as rather large files. However, networks cannot operate if computers put large
amounts of data on the cable at the same time. If a computer sends large amounts of data it can cause
other computers to wait (increasing the frustration of the other users) while the data is being moved.
There are two reasons why putting large chunks of data on the cable at one time slows down the
network:

• Large amounts of data sent as one large unit tie up the network and make timely interaction
and communications impossible because one computer is flooding the cable with data.

• The impact of retransmitting large units of data further multiplies network traffic.
These effects are minimized when the large data units are reformatted into smaller packages. This
way, only a small section of data is affected, and, therefore, only a small amount of data must be
retransmitted, making it relatively easy to recover from the error. These packages are commonly
called packets or frames, and are the basic building blocks of network data communications.
The process of breaking large data file into smaller files that can be accommodated by network is
called Segmentation. To understand this process thinks about a 700 MB movie that you want to
download from internet. You have 2MBPS internet connection. How will you download a 700MB
movie on 2MBPS internet connection?
In this case segmentation process is used. On server transport layer breaks 700MB movie in smaller
size of segments (less than your internet connection speed). Assume that 700Mb movie is divided in
700 segments. Each segment has file size of 1Mbthat your PC can easily download at current
connection speed. Now your PC will download 700 small files instead of one large file. So next time
when you see download progress bar in browser, think it about segment receiver progress bar. Once
Data Communication and Computer Networks
your browser receives all segments from server, it will pop up a message indicating download is
completed. Transport layer at your PC will merge all segments back in a single 700Mb movie file.
End user will never know how 700Mb movie makes its way through 2Mbps connection line.
The transport layer accepts a message from the (session) layer above it, splits the message into smaller
units (if not already small enough), and passes the smaller units down to the network layer.
The transport layer at the destination station reassembles the message.

TCP Segment Numbering System


TCP, unlike UDP, is a stream-oriented protocol. In UDP, a process (an application program) sends
messages, with predefined boundaries, to UDP for delivery. UDP adds its own header to each of these
messages and delivers them to IP for transmission. Each message from the process is called a user
datagram and becomes, eventually, one IP datagram. Neither IP nor UDP recognizes any relationship
between the datagrams. Each application using UDP must send small data to fit into one user datagram
as it is. (UDP does not segment/reassemble).
TCP, on the other hand, allows the sending process to deliver data as a stream of bytes and allows the
receiving process to obtain data as a stream of bytes. TCP creates an environment in which the two
processes seem to be connected by an imaginary "tube” that carries their data across the Internet. The
sending process produces (writes to) the stream of bytes, and the receiving process consumes (reads
from) them.
The TCP uses segment numbering system to manage the sequence of segments (stream of bytes) and
to provide reliable data delivery. There are three type of numbering used by TCP:
Byte Number
Sequence Number
Acknowledgment Number
Byte Number:
TCP numbers all data bytes that are transmitted in a connection. Numbering of byte is independent in
each direction. When TCP receives bytes of data from a process, it stores them in the sending buffer
and numbers them.
The numbering does not necessarily start from 0. Instead, TCP generates a random number between
0 and 232 - 1 for the number of the first byte. For example, if the random number happens to be 1057
and the total data to be sent are 6000 bytes, the bytes are numbered from 1057 to 7056. Byte
numbering is used for flow and error control too.
Sequence Number:
Data Communication and Computer Networks
After the bytes have been numbered, TCP assigns a sequence number to each segment that is being
sent. The sequence number for each segment is the number of the first byte carried in that segment.
Acknowledgment Number:
Each party also uses an acknowledgment number to confirm the bytes it has received. However, the
acknowledgment number defines the number of the next byte that the party expects to receive. In
addition, the acknowledgment number is cumulative, which means that the party takes the number of
the last byte that it has received, safe and sound, adds 1 to it, and announces this sum as the
acknowledgment number.
The term cumulative here means that if a party uses 5643 as an acknowledgment number, it has
received all bytes from the beginning up to 5642. Note that this does not mean that the party has
received 5642 bytes because the first byte number might not have to start from 0

5.4.3 Service-point addressing:


Whenever we need to deliver something to one specific destination among many, we need an address.
As explained in section 2 of this module, at the data link layer we need a MAC address to choose one
node among several nodes if the connection is not point-to-point. A frame in the data link layer needs
a destination MAC address for delivery and a source address for the next node's reply. Similarly, at
the network layer, we need an IP address to choose one host among millions. A datagram in the
network layer needs a destination IP address for delivery and a source IP address for the destination's
reply.
The network layer gets each packet to the correct computer; the transport layer gets the entire message
to the correct process on that computer. As computers often run several programs at the same time,
for a process-to-process delivery of message we need a means to differentiating process and deliver
a message from specific process (running program) on one computer to a specific process on the other.
The transport layer header must therefore include a type of address called a service-point address (or
port address). The destination port number is needed for delivery while the source port number is
needed for the reply.
In the Internet model, the port numbers are 16-bit integers between 0 and 65,535. The port numbers
are divided into following ranges by the IANA(Internet Assigned Number Authority).
Port number Descriptions

0–1023 Well-Known
Assigned and controlled by IANA
For common TCP/IP functions and applications
Data Communication and Computer Networks

1024–49151 Registered not assigned or controlled by


IANA
Registered with IANA to prevent duplication
For applications built by companies

49152–65535 Dynamic/Private
Neither controlled nor registered
For dynamic connections
Ephemeral ports (temporary ports).

The client program defines itself with a port number, chosen randomly by the transport layer software
running on the client host. This is the ephemeral (temporal) port number.
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. Of course, one solution would be to send a special packet and request
the port number of a specific server, but this requires more overhead. The Internet has decided to use
universal port numbers for servers which is called well-known port numbers. Example of well known
port numbers: 21 for FTP, 23 telnet, 25 SMTP, 80 HTTP, etc
There are some exceptions to this rule; for example, there are clients that are assigned well-known
port numbers. Every client process knows the well-known port number of the corresponding server
process.
Data Communication and Computer Networks

Socket Addresses
Process-to-process delivery needs two identifiers, IP address and the port number, at each end to make
a connection. The combination of an IP address and a port number is called a socket address. The
client socket address defines the client process uniquely just as the server socket address defines the
server process uniquely. A transport layer protocol needs a pair of socket addresses: the client socket
address and the server socket address. These four pieces of information are part of the IP header and
the transport layer protocol header. The IP header contains the IP addresses; the UDP or TCP header
contains the port numbers.
Data Communication and Computer Networks

5.4.4 Error control (Message acknowledgment):

Reliability means guaranteed data delivery. To insure delivery of each single segment, connection
oriented method is used. In this approach before sending any segments three way handshake process
is done.

Three-Way Handshaking in connection establishment


The connection establishment in TCP is called three-way handshaking. An application program,
called the client, wants to make a connection with another application program, called the server,
using TCP as the transport layer protocol. The process starts with the server. The server program tells
its TCP that it is ready to accept a connection. This is called a request for a passive open. Although
the server TCP is ready to accept any connection from any machine in the world, it cannot make the
connection itself. The client program issues a request for an active open. A client that wishes to
connect to an open server tells its TCP that it needs to be connected to that particular server. TCP can
now start the three-way handshaking process as shown in the figure in next page.
To show the process, we use two time lines: one at each site. Each segment has values for all its header
fields and perhaps for some of its option fields, too. However, we show only the few fields necessary
to understand each phase. We show the sequence number, the acknowledgment number, the control
flags (only those that are set), and the window size, if not empty.

The three steps in this phase are as follows:


Data Communication and Computer Networks
1. The client sends the first segment, a SYN segment, in which only the SYN flag is set. This
segment is for synchronization of sequence numbers. It consumes one sequence number. When
the data transfer starts, the sequence number is incremented by 1. We can say that the SYN
segment carries no real data, but we can think of it as containing 1 imaginary byte.
2. The server sends the second segment, a SYN +ACK segment, with 2 flag bits set: SYN and ACK.
This segment has a dual purpose. It is a SYN segment for communication in the other direction
and serves as the acknowledgment for the SYN segment. It consumes one sequence number.
3. The client sends the third segment. This is just an ACK segment. It acknowledges the receipt of
the second segment with the ACK flag and acknowledgment number field. Note that the sequence
number in this segment is the same as the one in the SYN segment; the ACK segment does not
consume any sequence numbers.
Data Transfer: Once connection is established bidirectional data transmission will be initiated. The
client and server can both send data and acknowledgments. Data and acknowledgment traveling in
the same direction are carried on the same segment. The acknowledgment is piggybacked with the
data. To provide maximum reliability it includes following functions:-

Detect lost packets and resend them


Detect packets that arrived out of order and reorder them
Recognize duplicate packets and drop extra packets
Avoid congestion by implementing flow control
Example: As shown on figure below, after connection is established, the client sends 2000 bytes of
data in two segments. The server then sends 2000 bytes in one segment. 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 are no more data to be sent.
Data Communication and Computer Networks

Three-Way Handshaking in connection termination


1. In a normal 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. Note that a FIN segment
can include the last chunk of data sent by the client, or it can be just a control segment. If it is
only a control segment, it consumes only one sequence number.
2. 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.
3. 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
1 plus the sequence number received in the FIN segment from the server. This segment cannot
carry data and consumes no sequence numbers.
Data Communication and Computer Networks

Like Data link layer, Transport layer also performs error control. Here error control is performed end-
to-end rather than across a single link. The sending transport layer ensures that the entire message
arrives at the receiving transport layer without error (damage, loss or duplication). Error correction is
achieved through retransmission. In general the transport layer provides reliable endto-end message
delivery with acknowledgments.

5.4.5 Flow control:


Like Data link layer, transport layer also performs flow control. Transport layer makes sure that the
sender and receiver communicate at a rate they both can handle. Therefore flow control prevents the
source from sending data packets faster than the destination can handle. Here, flow control is
performed end-to-end rather than across a link.
The transport layer implements two flow control methods:

• Ready/not ready signals


• Windowing

Ready / not ready signals (Stop and wait) method


Because the sending and the receiving processes may not write or read data at the same speed, TCP
needs buffers for storage. There are two buffers, the sending buffer and the receiving buffer, one
Data Communication and Computer Networks
for each direction. One way to implement a buffer is to use a circular array of 1-byte locations. For
simplicity, we have shown two buffers of 20 bytes each in figure below; normally the buffers are
hundreds or thousands of bytes, depending on the implementation. We also show the buffers as the
same size, which is not always the case

In Ready / not ready signals method, sender sends data according to its buffer size. Receiver receives
data in its buffer. When receivers buffer get filled, it send a not ready signal to sender, so sender can
stop transmitting more segments. Receivers send ready signal when it becomes ready to receive next
segments. This method has two problems. First, the receiver may respond to the sender with a not
ready signal only when its buffer fills up. While this message is on its way to the sender, the sender
is still sending segments to the receiver, which the receiver will have to drop because its buffer space
is full. The second problem with the uses of this method is that once the receiver is ready to receive
more segments, it must first send a ready signal to the sender, which must be received before sender
can send more segments.
Windowing
In windowing a window size is defined between sender and receiver. Sender host will wait for an
acknowledgement signal after sending the segments equal to the window size. If any packet lost in
the way, receiver will respond with acknowledgement for lost packet. Sender will send lost packet
again. Window size is automatically set during the three step handshake process. It can be adjust
anytime throughout the lifetime of connection.
Data Communication and Computer Networks

Sliding window flow control (at the sender)


The Figure below 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.

Reading Assignment
o Congestion Control and Quality services

o Multiplexing and demultiplexing


5.5 The Session Layer
Session layer has the primary responsibility of beginning, maintaining and ending the communication
between two devices, which is called Session. It also provides for orderly communication between
Data Communication and Computer Networks
devices by regulating the flow of data. This layer provides its services to the presentation layer.
Specifically this layer perform the following functions

Session establishment, maintenance and termination:


The session layer allows two application processes on different machines to establish, use and
terminate a connection, called a session. The session layer allows session establishment between
processes running on different stations. The examples of session layers and the interactive logins
and file transfer sessions. Session layer reconnect the session if it disconnects. It also reports and logs
and upper layer errors. It also performs the functions that allow these processes to communicate over
the network, performing security, name recognition, logging and so on.

Dialog control and Synchronization:


Dialog control is the function of session layer that determines which device will communicate first
and the amount of data that will be sent. When a device is contacted first, the session layer is
responsible for determining which device participating in the communication will transmit at a given
time as well as controlling the amount of data that can be sent in a transmission. This is called dialog
control. The types of dialog control that can take place include simplex, half duplex and full duplex
Session layer also synchronizes dialogue between the presentation layers of the two hosts and
manages their data exchange. For example, web servers may have many users communicating with
server at a given time. Therefore, keeping track of which user communicates on which path, who can
transfer the data in a certain amount of time and for how long, is important and session layer handle
this responsibility accurately.

Note: The known protocols that work on the session layer includes NetBIOS, Mail Slots, Names Pipes,
and RPC.
Data Communication and Computer Networks
5.6 The Presentation Layer
Presentation Layer is also called Translation layer. The objective of this layer is to presents the data
into a uniform format and masks the difference of data format between two dissimilar systems. The
presentation has the following main functions
Translation
Before being transmitted, information in the form of characters and numbers should be changed to bit
streams. The presentation layer is responsible for interoperability between encoding methods as
different computers use different encoding methods, for example, ASCII to EBCDIC.
It can be viewed as the translator for the network. This layer may translate data from a format used
by the application layer into a common format at the sending station, and then translate the common
format to a format known to the application layer at the receiving station. It takes data from application
layer and marks it with formatting code such as .doc, .jpg, .txt, .avi etc. These file extensions make it
easy to realize that particular file is formatted with particular type of application.
Compression and encryption
With formatting presentation layer also deals with compression and encapsulation. It carries out data
compression (on sending computer) to reduce the bandwidth of the data to be transmitted and
decompresses (on receiving computer) the data file. The primary role of Data compression is to reduce
the number of bits to be transmitted. It is important in transmitting multimedia such as audio, video,
text etc.
This layer can also encapsulate the data (carries out encryption at the transmitter and decryption at the
receiver), but it’s uncommon as this can be done by lower layers more effectively.
Data conversion: bit order, CR-CR/LF, integer-floating point, and so on.
Data Communication and Computer Networks
5.7 The Application Layer
Application layer provides platform to send and receive data over the network. This layer serves as
the window for users and application processes to access network services. The application layer
makes the interface between the program that is sending or is receiving data and the protocol stack.
When you download or send emails, your e-mail program contacts this layer.
This layer provides network services to the end-users like Mail, ftp, telnet, DNS. All applications and
utilities that communicate with network fall in this layer. For examples, Browsers (like Mozilla
Firefox, Internet Explorer, Google Chrome etc), Email clients (such as Outlook Express, Mozilla
Thunderbird etc.), FTP clients (like Filezilla, sFTP, vsFTP).
Protocols used at application layer are FTP, DHCP, DNS, NFS, HTTP, POP3, SNMP, SMTP, FINGER,
TFTP, NTP and TELNET.

5.7.1 DHCP (Dynamic Host Configuration Protocol)


Every computer on a network must have a unique address. This address is attached to any packets of
data that are intended for transmission to the computer. If the network is using the TCP/IP protocol,
these addresses will be IP addresses (i.e. they will consist of 4 numbers between 0 and 255 separated
by dots as discussed in section 3 of this module). If two computers have the same address it causes an
address conflict, and network problems will result. There are two ways of ensuring that all computers
have unique addresses: static IP addressing and dynamic IP addressing.
In static IP addressing each computer is assigned a unique address by the network administrator. It
will keep this address until the network administrator assigns a different one. It is the administrator’s
responsibility to ensure that the same address is not assigned twice. In dynamic IP addressing the
assignment of addresses is handled automatically by a program running on the server. This program
is responsible for ensuring that every computer has a unique address. Addresses are leased to clients
for a limited period of time, after which the client must request a new lease.
DHCP is the protocol used for requesting and assigning dynamic IP addresses. A DHCP application
will typically run on the network server. Clients then use the DHCP protocol to obtain their IP address
lease from this application. The Figure on the next page illustrates the communication that occurs
during dynamic IP address leasing. If a computer COM1 wanted to obtain a dynamic IP address, it
would first broadcast a DHCP Discover packet to the network to find out if there was a DHCP server
available. The DHCP service running on COMSERVER will receive this message and broadcast a
DHCP Offer packet offering a particular address. It cannot use a unicast transmission, as COM1 does
not yet have an IP address. COM1 receives the DHCP Offer and decides to accept, so it sends a DHCP
Request packet back to COMSERVER. Finally COMSERVER sends an acknowledgement back to
COM1 to confirm that the IP address has been assigned (a DHCP ACK packet).
Data Communication and Computer Networks

Figure: Obtaining an IP address lease using the DHCP protocol

5.7.2 DNS (Domain Name Service)


Although high-level protocols in TCP/IP use IP addresses to communicate, it is easier for people using
the computers to identify them by names, such as COM1 and COMSERVER. These names are known
as host names. DNS is the protocol used to obtain host name to IP address translation information
between computers on the network. Typically every network will have at least one DNS server.
Clients needing to know translations will contact the DNS server using the DNS protocol to obtain
the required information. On a local network, the host name can just be a single word, for example
COM1 or COMSERVER. On the Internet the name will consist of a sequence of words separated by
dots and known as URL, for example www.yahoo.com or www.bbc.co.uk. There is a one-to-one
mapping between these computer names and IP addresses: every IP address corresponds to a single
computer name and vice versa.
The DNS server will maintain a list of which IP address maps to which computer name, so that it can
translate between the two. For instance, if a user requests a directory listing from the computer COM1
then the NOS must first find out the IP address that corresponds to the name COM1, and then send a
request for the directory listing to that IP address. The process of translating a computer name into an
IP address is known as name resolution.
Naming hierarchies
Although there is a one-to-one correspondence between URLs and IP addresses on the Internet, it is
important to remember that the positions of the dots in each of them are not significant. For example,
Data Communication and Computer Networks
if www.bbc.co.uk corresponds to the IP address 27.21.225.129, then it does not follow that 129
represents ‘.uk’, and 225 represents ‘.co’, and so on.
The naming hierarchy is decided on by the local network administrator, based normally upon the
structure of the organization it represents. For example, the Figure below shows a sample naming
hierarchy for the ‘.et’ domain. If there were a computer called fbe-server in the fbe subdivision of the
domain, it would have the name fbe-server.fbe.adama.edu.et. The number of different segments to a
computer name (in this example it is 5) is determined by the naming hierarchy. There is no global
standard. Each organization can choose how to structure names in its hierarchy.

Figure: A sample naming hierarchy for the ‘.et’ domain


Distributed lookup
Problems that arise when we try to centralize DNS includes:
Single point of failure Distant centralized database
Increase in traffic volume Maintenance
As centralized DNS does not scale because of the reasons mentioned above, a need arose to implement
DNS in a distributed manner. The DNS is a distributed system, implemented in a hierarchy of many
name servers. The decentralized administration is achieved through delegation.
The Internet contains a number of DNS servers. None of these servers knows the names and addresses
of every computer on the Internet. DNS uses a system known as distributed lookup to enable every
DNS server to be able to translate any address. This means that each DNS server is responsible for
providing a translation service for a certain subset of computers only. If it receives a request that it
cannot answer, it will forward the request to another DNS server that will know the answer. For
Data Communication and Computer Networks
example, in Figure above the DNS server at adama.edu.et provides a translation service for the
‘.edu.et’ subdivision. If it receives a request for an address that it does not end in ‘edu.et’ it will
forward it to the root DNS server for the ‘et’ domain.

5.7.3 SNMP (Simple Network Management Protocol)


It was developed as a network management tool for networks running TCP/IP. Using SNMP, network
administrators can administer servers and other network devices from remote workstations.

5.7.4 Email Service Protocol (SMTP, POP3 and IMAP4)


Each mail server receives and stores mail for users who have mailboxes configured on the mail server.
Each user with a mailbox must then use an email client to access the mail server and read these
messages. Mailboxes are identified by the format: [email protected]
Three application protocols used in processing email include
Simple Mail Transfer Protocol (SMTP):- was defined by RFC 821 and is the standard protocol
for transferring emails between hosts (i.e.to send mail from client to server or server to server).
Post Office Protocol (POP3):- to download email from server to client, and the server deletes the
mail.
Internet Message Access Protocol (IMAP4):- to download email from server to client, and the
server does not delete (keeps) the mail

5.7.5 FTP (File Transport Protocol)


File Transfer Protocol (FTP) is the standard mechanism provided by TCP/IP for copying a file from
one host to another. Although transferring files from one system to another seems simple and
straightforward, some problems must be dealt with first. For example, two systems may use different
file name conventions. Two systems may have different ways to represent text and data. Two systems
Data Communication and Computer Networks
may have different directory structures. All these problems have been solved by FTP in a very simple
and elegant approach.
FTP differs from other client/server applications in that it establishes two connections between the
hosts. One connection is used for data transfer, the other for control information (commands
and responses). Separation of commands and data transfer makes FTP more efficient. The
control connection uses very simple rules of communication.
We need to transfer only a line of command or a line of response at a time. The data
connection, on the other hand, needs more complex rules due to the variety of data types
transferred. However, the difference in complexity is at the FTP level, not TCP. For TCP, both
connections are treated the same.FTP uses two well-known TCP ports: Port 21 is used for the control
connection, and port 20 is used for the data connection.
Requests to begin an FTP session are sent to the server using destination port 21. Once the
session is opened, the server will change to port 20 to transfer the data files

5.7.6 HTTP (Hypertext Transfer Protocol)


It is a protocol used mainly to access data on the World Wide Web. HTTP functions as a combination
of FTP and SMTP. It is similar to FTP because it transfers files and uses the services of TCP.
However, it is much simpler than FTP because it uses only one TCP connection. There is no separate
control connection; only data are transferred between the client and the server.
HTTP is like SMTP because the data transferred between the client and the server look like
SMTP messages. In addition, the format of the messages is controlled by MIME-like headers.
Unlike SMTP, the HTTP messages are not destined to be read by humans; they are read and
interpreted by the HTTP server and HTTP client (browser). SMTP messages are stored and
forwarded, but HTTP messages are delivered immediately. The commands from the client to the
server are embedded in a request message. The contents of the requested file or other
information are embedded in a response message. HTTP uses the services of TCP on well-known port
80.

5.7.7 Telnet
The TELNET is an abbreviation for TErminaL NETwork. It is the standard TCP/IP protocol for
virtual terminal service as proposed by the International Organization for Standards(ISO).
TELNET protocol is used for providing remote terminal access over a network by enabling the
establishment of a connection to a remote system in such a way that the local terminal appears to be
a terminal at the remote system. For example, using TELNET a user can log in to another computer
somewhere else on the network and take part in an interactive session on that computer. TELNET
also uses TCP as its underlying basis for communications.
Data Communication and Computer Networks
TELNET was designed at a time when most operating systems, such as UNIX, were operating in a
timesharing environment. In such an environment, a large computer supports multiple users. The
interaction between a user and the computer occurs through a terminal, which is usually a combination
of keyboard, monitor, and mouse. Even a micro computer can simulate a terminal with a terminal
emulator

5.8 Summary of OSI Reference Model Layer and Protocols


Layer Description Device Protocol

Application Provides network access for applications, Gateway NCP, DHCP, DNS,
flow control and error recovery SMTP, FTP, SNMP,
Telnet, Appletalk

Presentation Performs protocol conversion, encryption Gateway and NCP, AFP, TDI
and data compression redirectors

Session Allows 2 applications to communicate Gateway NetBios, Mail Slots,


over a network by opening a session and Names Pipes, and RPC
synchronizing the involved computers

Transport Repackages messages into smaller Gateway NetBEUI, TCP, SPX,


formats, provides error free delivery and and NWLink
error handling functions

Network Handles addressing, translates logical Router and IP, IPX, NWLink,
addresses and names to physical brouter NetBEUI, NAT, ARP,
addresses, routing and traffic RARP, ICMP, IGMP.
management.

**Data Packages raw bits into frames and Switch, bridge Ethernet, Token Ring,
Link includes a Cyclical Redundancy Check and brouter FDDI, X.25, Token bus,
(CRC) AppleTalk

Physical Transmits data over physical medium Multiplexer


and repeater
Data Communication and Computer Networks
**The Data Link layer is divided into 2 sublayers called Media Access Control(MAC) and Logical
Link Control(LLC). The MAC Sub-layer communicates with network card and delivers error-free
delivery between 2 computers.

5.9 Device driver


A device driver is software that tells the computer how to drive or work with the device so that the
device performs the job it's supposed to.
Network drivers are also called MAC drivers or NIC drivers. It provide communication between a
network adapter card and the redirector in the computer. This deriver resides in the Media Access
Control sub-layer of the Data Link layer. Therefore, the NIC driver ensures direct communication
between the computer and the NIC.
Network driver interfaces allow multiple protocol stacks to use one network interface card. There are
basically 2 types of Network Card Drivers and they are not compatible with each other.

• NDIS (Network Driver Interface Specification):- used by Microsoft based Network Operating
Systems, such as Microsoft LAN Manager, Windows NT, Windows for Work Groups and IBM's
OS/2.

• ODI (Open Datalink Interface):- ODI drivers are used by Novell's NetWare Network Operating
System and Apple.
Note: The binding Process allows more than one protocol to function on a single network adapter
card. Binding order dictates which protocol the operating systems uses first.

You might also like