0% found this document useful (0 votes)
133 views51 pages

Chapter 2

The document discusses various topics related to data link layer and network layer networking concepts: - At the data link layer, it describes the services of framing, link access, reliable delivery, flow control, and error detection/correction methods like parity checks and cyclic redundancy checks. - The network layer section outlines its services of logical addressing, routing, fragmentation/reassembly, and switching techniques like circuit switching, message switching, and packet switching. - It provides details on circuit switching including dedicated path establishment and data transfer in three phases, and discusses advantages like fixed bandwidth but disadvantages of underutilized resources.

Uploaded by

Vatsal Mataliya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
133 views51 pages

Chapter 2

The document discusses various topics related to data link layer and network layer networking concepts: - At the data link layer, it describes the services of framing, link access, reliable delivery, flow control, and error detection/correction methods like parity checks and cyclic redundancy checks. - The network layer section outlines its services of logical addressing, routing, fragmentation/reassembly, and switching techniques like circuit switching, message switching, and packet switching. - It provides details on circuit switching including dedicated path establishment and data transfer in three phases, and discusses advantages like fixed bandwidth but disadvantages of underutilized resources.

Uploaded by

Vatsal Mataliya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 51

Chapter 2

Network Basics
Dipa Soni
DATA LINK LAYER
Error Detection and Correction
Services provided by Data Link Layer

 Framing
 Encapsulate datagram into frame.
 Adding header and trailer.
 Link Access
 “MAC” addresses used in frame headers to identify source and destination. It is
different from IP address
 Reliable delivery
 If this layer protocol provides reliable delivery service, it guarantees to move each
network-layer datagram across the link without error.
 A link –layer reliable delivery service can be achieved with acknowledgments and
retransmission
Services provided by Data Link Layer

 Flow Control
 Flow control is a technique that allows two stations working at different speeds to
communicate with each other.
 Error Detection and Correction
 Error detection − Error detection involves checking whether any error has
occurred or not. The number of error bits and the type of error does not matter.
 Error correction − Error correction involves ascertaining the exact number of bits
that has been corrupted and the location of the corrupted bits.
Error correction and detection

 Data can be corrupted during transmission.


 Some applications require that errors be detected and corrected.
 Some applications can tolerate a small level of error. For example, random
errors in audio or video transmissions may be tolerable, but when we transfer
text, we expect a very high level of accuracy.
Types of Errors

 Single-bit error
 Burst Error
Single-bit Error

 The term single-bit error means that only 1 bit of a given data unit (such as a
byte, character, or packet) is changed from 1 to 0 or from 0 to 1.
 Below figure shows the effect of a single-bit error on a data unit.
Burst Error

 The term burst error means that 2 or more bits in the data unit have changed
from 1 to 0 or from 0 to 1.
 Below figure shows the effect of a burst error on a data unit. In this case,
0100010001000011 was sent, but 0101110101100011 was received.
Detection Versus Correction

 The correction of errors is more difficult than the detection. In error


detection, we are looking only to see if any error has occurred. The answer is
a simple yes or no. We are not even interested in the number of errors. A
single-bit error is the same for us as a burst error.
 In error correction, we need to know the exact number of bits that are
corrupted and more importantly, their location in the message. The number
of the errors and the size of the message are important factors. If we need to
correct one single error in an 8-bit data unit, we need to consider eight
possible error locations. You can imagine the receiver's difficulty in finding 10
errors in a data unit of 1000 bits.
Techniques for error detection

 Simple Parity Check


 Two-dimensional Parity Check
 Checksum Method
 Cyclic Redundancy Check
Simple Parity Check

 It is the simplest technique for detecting and correcting errors. One extra bit
is sent along with the original bits to make number of 1s either even in case
of even parity, or odd in case of odd parity.
 For example, if even parity is used and number of 1s is even then one bit with
value 0 is added. This way number of 1s remains even.
 If the number of 1s is odd, to make it even a bit with value 1 is added.
Simple Parity Check

 The receiver simply counts the number of 1s in a frame. If the count of 1s is


even and even parity is used, the frame is considered to be not-corrupted and
is accepted.
 If the count of 1s is odd and odd parity is used, the frame is still not
corrupted.
 If a single bit flips in transit, the receiver can detect it by counting the
number of 1s.
 But when more than one bits are erroneous, then it is very hard for the
receiver to detect the error.
Drawbacks Of Single Parity Checking

 It can only detect single-bit errors which are very rare.


 If two bits are interchanged, then it cannot detect the errors.
Two-dimensional Parity Check(LRC)

 When a large amount of data is to be transmitted two-dimensional parity


check can be employed.
 Here datawords are arranged one above another and is organized in a form of
2-D binary matrix.
 For each row & each column of the matrix parity-check bit is calculated
Two-dimensional Parity Check(LRC)
Checksum Method

 Data is divided into k segments each of m bits.


 Sender Side - The sender adds the segments using 1’s complement arithmetic
to get the sum.
 It then complements the sum to get the checksum and sends it along with the
data frames.
 Receiver Side - All received segments are added using 1’s complement
arithmetic to get the sum. The sum is complemented.
 If the result is zero, the received data is accepted; otherwise they are
discarded.
Checksum Method
Cyclic Redundancy Check Method
 CRC is the most powerful and easy to implement technique.
 CRC is based on binary division.
 In CRC technique, a string of n 0’s is appended to the data unit, and this n number is
less than the number of bits in a predetermined number, known as division which is n+1
bits.
 Secondly, the newly extended data is divided by a divisor using a process is known as
binary division. The remainder generated from this division is known as CRC remainder.
 Thirdly, the CRC remainder replaces the appended 0s at the end of the original data.
This newly generated unit is sent to the receiver.
 The receiver receives the data followed by the CRC remainder. The receiver will treat
this whole unit as a single unit, and it is divided by the same divisor that was used to
find the CRC remainder.
 If the resultant of this division is zero which means that it has no error, and the data is
accepted.
 If the resultant of this division is not zero which means that the data consists of an
error. Therefore, the data is discarded.
Cyclic Redundancy Check Method
NETWORK LAYER
Services Provided by Network Layer

 Logical addressing:
 The data link layer implements the physical addressing and network layer
implements the logical addressing.
 The network layer adds a header to the packet which includes the logical addresses
of both the sender and the receiver.
 Routing
 When two independent networks or links are attached to create an internetwork
that is the network of networks or a large network, the connecting devices route
the packets to its destination.
 The forwarding of the data request to servers is known as routing.
Services Provided by Network Layer

 Fragmentation and Reassembly:


 It is done by the network layer when the maximum size of datagram is greater
than maximum size of data that can be held a frame i.e., its Maximum
Transmission Unit (MTU).
 The network layer divides the datagram received from transport layer into
fragments so that data flow is not disrupted, send each packet to the data link
layer, and then have pieces reassembled once they arrive at the network layer on
the destination system.
Switching Techniques

 Switching is process to forward packets coming in from one port to a port


leading towards the destination.
 There are 3 common switching techniques:
 Circuit Switching
 Message Switching
 Packet Switching
Circuit Switching

 Circuit switching is a switching technique that establishes a dedicated path


between sender and receiver.
 In the Circuit Switching Technique, once the connection is established then the
dedicated path will remain to exist until the connection is terminated.
 Circuit switching in a network operates in a similar way as the telephone works.
 A complete end-to-end path must exist before the communication takes place.
 In case of circuit switching technique, when any user wants to send the data,
voice, video, a request signal is sent to the receiver then the receiver sends back
the acknowledgment to ensure the availability of the dedicated path. After
receiving the acknowledgment, dedicated path transfers the data.
 Circuit switching is used in public telephone network. It is used for voice
transmission.
 Fixed data can be transferred at a time in circuit switching technology.
Circuit Switching

 Communication through circuit switching has 3 phases:


 Circuit establishment
 Data transfer
 Circuit Disconnect
Advantages and Disadvantages of Circuit
Switching
Advantages:
 It uses a fixed bandwidth.
 A dedicated communication channel increases the quality of communication.
 Data is transmitted with a fixed data rate.
 No waiting time at switches.
 Suitable for long continuous communication.
Disadvantages:
 A dedicated connection makes it impossible to transmit other data even if the channel is free.
 Resources are not utilized fully.
 The time required to establish the physical link between the two stations is too long.
 As a dedicated path has to be established for each connection, circuit switching is more
expensive.
 Even if there is no transfer of data, the link is still maintained until it is terminated by users. By
this channel remains ideal for a long time thereby making circuit switching inefficient.
Message Switching

 Message Switching is a switching technique in which a message is transferred as a


complete unit and routed through intermediate nodes at which it is stored and
forwarded.
 In Message Switching technique, there is no establishment of a dedicated path
between the sender and receiver.
 The destination address is appended to the message. Message Switching provides a
dynamic routing as the message is routed through the intermediate nodes based
on the information available in the message.
 Message switches are programmed in such a way so that they can provide the most
efficient routes.
 In the switching node, the incoming message is not discarded if the required
outgoing circuit is busy. Instead, it is stored in a queue for that route and
retransmitted when the required route is available. This is called store and
forward network
 Message switching treats each message as an independent entity.
Advantages and Disadvantages of
Message Switching
Advantages:
 Sharing of communication channels ensures better bandwidth usage.
 It reduces network congestion due to store and forward method. Any switching node can
store the messages till the network is available.
 Broadcasting messages requires much less bandwidth than circuit switching.
 Messages of unlimited sizes can be sent.
 It does not have to deal with out of order packets or lost packets as in packet switching.
Disadvantages:
 In order to store many messages of unlimited sizes, each intermediate switching node
requires large storage capacity.
 Store and forward method introduces delay at each switching node. This renders it
unsuitable for real time applications.
Packet Switching

 Packet switching is a method of transferring the data to a network in form of


packets. In order to transfer the file fast and efficient manner over the network
and minimize the transmission latency, the data is broken into small pieces of
variable length, called Packet.
 Each packet in a packet switching technique has two parts: a header and a
payload. The header contains the addressing information of the packet and is used
by the intermediate routers to direct it towards its destination. The payload
carries the actual data.
 Packets will travel across the network, taking the shortest path as possible. All the
packets are reassembled at the receiving end in correct order.
 Packet Switching uses Store and Forward technique while switching the packets;
while forwarding the packet each hop first store that packet then forward.
 Packets belonging to the same file may or may not travel through the same path.
If there is congestion at some path, packets are allowed to choose different path
possible over existing network.
Advantages and Disadvantages of Packet
Switching
Advantages:
 If any node is busy, then the packets can be rerouted. This ensures that the
Packet Switching technique provides reliable communication.
 Packet Switching is an efficient technique. It does not require any established
path prior to the transmission, and many users can use the same
communication channel simultaneously, hence makes use of available
bandwidth very efficiently.
 Cost effective and comparatively cheaper to implement.
Advantages and Disadvantages of Packet
Switching
Disadvantage:
 Packet Switching technique cannot be implemented in those applications that
require low delay and high-quality services.
 Packet Switching don’t give packets in order, whereas Circuit Switching
provides ordered delivery of packets because all the packets follow the same
path.
 Since the packets are unordered, we need to provide sequence numbers to
each packet.
 Complexity is more at each node because of the facility to follow multiple
path.
Approaches Of Packet Switching

 There are two approaches to Packet Switching:


 Datagram Packet switching:
 Virtual Circuit Switching
Virtual Circuit vs Datagram Packet
Switching
Virtual Circuits Datagram Networks
Virtual circuits are connection-oriented, It is connectionless service. There is no need
which means that there is a reservation of for reservation of resources as there is no
resources like buffers, bandwidth, etc. for dedicated path for a connection session.
the time during which the newly setup VC is
going to be used by a data transfer session.

In Virtual circuits as all the resources and On other hand in case Datagram network,
bandwidth get reserved before the the path is not fixed as data packets are free
transmission, the path which is utilized or to decide the path on any intermediate
followed by first data packet would get fixed router on the go by dynamically changing
and all other data packets will use the same routing tables on routers.
path and consume same resources.

All the packets follow the same path and Every packet is free to choose any path, and
hence a global header is required only for hence all the packets must be associated
the first packet of connection and other with a header containing information about
packets will not require it. the source and the upper layer data.
Virtual Circuit vs Datagram Packet
Switching
Virtual Circuits Datagram Networks
Packets reach in order to the destination as Data packets reach the destination in
data follows the same path. random order, which means they need not
reach in the order in which they were sent
out.

Due to fixed path and assurance of fixed On other hand Datagram network due to
resources, Virtual Circuits are more reliable dynamic resource allocation and follow
for data transmission as compared to dynamic path is more prone to error and is
Datagram network. less reliable than Virtual circuits.

Virtual circuits are costlier in installation On the other hand Datagram network are
and maintenance and are widely used by ATM cheaper as compared to the Virtual Circuits
(Asynchronous Transfer Mode) Network, and are mainly used by IP network, which is
which is used for the Telephone calls.. used for Data services like Internet.
IP Addressing
 IP stands for Internet Protocol
 Every node in computer network is identified with the help of IP address
 Logical address(Can change based on the location)
IP Addressing

 The Internet addresses are 32 bits in length; this gives us a maximum of 232
addresses. These addresses are referred to as IPv4 (IP version 4) addresses or
simply IP addresses.
 The need for more addresses, in addition to other concerns about the IP layer,
motivated a new design of the IP layer called the new generation of IP or IPv6
(lP version 6).
 In this version, the Internet uses 128-bit addresses that give much greater
flexibility in address allocation. These addresses are referred to as IPv6 (IP
version 6) addresses.
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.
 IPv4 addresses are unique. 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.
IPv4 Addresses

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.
IPv4 Addresses

Notations:
 There are two prevalent notations to show an IPv4 address: binary notation and
dotted-decimal notation and it has 4 octets(x.x.x.x).
 0.0.0.0 to 255.255.255.255(32 bits)
 Binary 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 address or a
4-byte address. The following is an example of an IPv4 address in binary notation:
01110101 10010101 00011101 00000010
 Dotted-Decimal Notation
 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 dotted-decimal notation of the above address:
117.149.29.2
IPv4 Addresses

 Identify the valid and invalid IP addresses in the following set


a. 24.25.26.8
b. 10.3.156.256
c. 0.34.56.255
d. 255.255.34.356
e. 100.2.6.345.420
f. 16.2e.45.67
g. 111.56.045.78
IPv4 Addresses

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


notation.
 10000001 00001011 00001011 11101111
 Solution:
 129.11.11.239
 Change the following IPv4 addresses from binary notation to dotted-decimal
notation.
 11000001 10000011 00011011 11111111
 Solution:
 193.131.27.255
Classful Addressing

 In Classful addressing, the address space is divided into five classes:


 Class A
 Class B
 Class C
 Class D
 Class E
 An ip addresses has two parts:
 Network ID: It represents the number of networks.
 Host ID: It represents the number of hosts.
 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 next Figure
Classful Addressing
Class A
 In Class A, an IP address is assigned to those networks that contain a large number
of hosts.
 The network ID is 8 bits long.
 The host ID is 24 bits long.
 In Class A, the first bit in higher order bits of the first octet is always set to 0 and
the remaining 7 bits determine the network ID. The 24 bits determine the host ID
in any network. The default subnet mask for class A is 255.x.x.x.
 The total number of networks in Class A = 27-2 = 126 network address
 The total number of hosts in Class A = 224 - 2 = 16,777,214 host address
 IP addresses belonging to class A ranges from 0.x.x.x – 127.x.x.x
Class B
 IP address belonging to class B are assigned to the networks that ranges from
medium-sized to large-sized networks.
 The network ID is 16 bits long.
 The host ID is 16 bits long.
 The higher order bits of the first octet of IP addresses of class B are always set to
10. The remaining 14 bits are used to determine network ID. The 16 bits of host ID
is used to determine the host in any network. The default sub-net mask for class B
is 255.255.x.x. Class B has a total of:
 214 = 16384 network address
 216 – 2 = 65534 host address
 IP addresses belonging to class B ranges from 128.0.x.x – 191.255.x.x.
Class C
 IP address belonging to class C are assigned to small-sized networks.
 The network ID is 24 bits long.
 The host ID is 8 bits long.
 The higher order bits of the first octet of IP addresses of class C are always set to
110. The remaining 21 bits are used to determine network ID. The 8 bits of host
ID is used to determine the host in any network. The default sub-net mask for
class C is 255.255.255.x. Class C has a total of:
 2^21 = 2097152 network address
 2^8 – 2 = 254 host address
 IP addresses belonging to class C ranges from 192.0.0.x – 223.255.255.x.
Class D

 IP address belonging to class D are reserved for multi-casting. The higher


order bits of the first octet of IP addresses belonging to class D are always set
to 1110. The remaining bits are for the address that interested hosts
recognize.
 Class D does not posses any sub-net mask. IP addresses belonging to class D
ranges from 224.0.0.0 – 239.255.255.255
Class E

 IP addresses belonging to class E are reserved for experimental and research


purposes.
 IP addresses of class E ranges from 240.0.0.0 – 255.255.255.254.
 This class doesn’t have any sub-net mask. The higher order bits of first octet
of class E are always set to 1111.
Problems with Classful Addressing

 The problem with this classful addressing method is that millions of class A
address are wasted, many of the class B address are wasted, whereas,
number of addresses available in class C is so small that it cannot cater the
needs of organizations. Class D addresses are used for multicast routing and
are therefore available as a single block only. Class E addresses are reserved.
Subnetting

 When a bigger network is divided into smaller networks, in order to maintain


security, then that is known as Subnetting. so, maintenance is easier for
smaller networks.
 Now, let’s talk about dividing a network into two parts:
so to divide a network into two parts, you need to choose one bit for each
Subnet from the host ID part.
Subnetting

 To divide a network into four (22) parts you need to choose two bits from host
id part for each subnet i.e, (00, 01, 10, 11).
 To divide a network into eight (23) parts you need to choose three bits from
host id part for each subnet i.e, (000, 001, 010, 011, 100, 101, 110, 111) and
so on.

You might also like