0% found this document useful (0 votes)
42 views30 pages

Unit 3

The document discusses the network layer of the OSI model. It describes the main functions of the network layer including routing, logical addressing, internetworking and fragmentation. It also discusses network addressing, classful addressing and the different classes of IP addresses (A, B and C).

Uploaded by

21csme011anay
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)
42 views30 pages

Unit 3

The document discusses the network layer of the OSI model. It describes the main functions of the network layer including routing, logical addressing, internetworking and fragmentation. It also discusses network addressing, classful addressing and the different classes of IP addresses (A, B and C).

Uploaded by

21csme011anay
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/ 30

Network Layer

o The Network Layer is the third layer of the OSI model.


o It handles the service requests from the transport layer and further forwards
the service request to the data link layer.
o The network layer translates the logical addresses into physical addresses
o It determines the route from the source to the destination and also manages
the traffic problems such as switching, routing and controls the congestion of
data packets.
o The main role of the network layer is to move the packets from sending host
to the receiving host.
The main functions performed by the network layer are:
o Routing: When a packet reaches the router's input link, the router will move
the packets to the router's output link. For example, a packet from S1 to R1
must be forwarded to the next router on the path to S2.
o Logical Addressing: The data link layer implements the physical addressing
and network layer implements the logical addressing. Logical addressing is
also used to distinguish between source and destination system.
o Internetworking: This is the main role of the network layer that it provides
the logical connection between different types of networks.
o Fragmentation: The fragmentation is a process of breaking the packets into
the smallest individual data units that travel through different networks.
Point-to-Point Communication
Forwarding & Routing
In Network layer, a router is used to forward the packets. Every router has a
forwarding table. A router forwards a packet by examining a packet's header field and
then using the header field value to index into the forwarding table. The value stored
in the forwarding table corresponding to the header field value indicates the router's
outgoing interface link to which the packet is to be forwarded.
Services Provided by the Network Layer
o Guaranteed delivery: This layer provides the service which guarantees that
the packet will arrive at its destination. A point-to-point communication is also known as P2P. In the
o Guaranteed delivery with bounded delay: This service guarantees that the
context of telecommunication, it is an established connection
packet will be delivered within a specified host-to-host delay bound.
o In-Order packets: This service ensures that the packet arrives at the between two nodes that may be used to communicate back and
destination in the order in which they are sent. forth. A basic telephone call, in which one phone is connected to
o Guaranteed max jitter: This service ensures that the amount of time taken another, and both nodes can send and receive audio, is the most
between two successive transmissions at the sender is equal to the time
between their receipt at the destination. common example of point-to-point communication.
o Security services: The network layer provides security by using a session
key between the source and destination host. The network layer in the source These P2P connections were first established utilizing circuit-
host encrypts the payloads of datagrams being sent to the destination host.
The network layer in the destination host would then decrypt the payload. In
switched landlines in the early days of telephony. However, point-
such a way, the network layer maintains the data integrity and source to-point communication in modern networks nowadays is made
authentication services. possible by complex fibre-optic networks. P2P connections of

[Unit 3 Notes] By Prof. Narendra Kumar Page 1


various forms can transmit many types of data, including digital and
analog signals.

Network Addressing
o Network Addressing is one of the major responsibilities of the network layer.
o Network addresses are always logical, i.e., software-based addresses.
o A host is also known as end system that has one link to the network. The
boundary between the host and link is known as an interface. Therefore, the
host can have only one interface.
o A router is different from the host in that it has two or more links that
connect to it.

In the above diagram, we observe that each class have a specific range of IP
addresses. The class of IP address is used to determine the number of bits used in a
class and number of networks and hosts available in the class.
Class A
In Class A, an IP address is assigned to those networks that contain a large number of
hosts.
o The network ID is 8 bits long.
o 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.
o In the above figure, a router has three interfaces labeled as 1, 2 & 3 and each The total number of networks in Class A = 27 = 128 network address
router interface contains its own IP address. The total number of hosts in Class A = 224 - 2 = 16,777,214 host address
o Each host contains its own interface and IP address.
o All the interfaces attached to the LAN 1 is having an IP address in the form
of 223.1.1.xxx, and the interfaces attached to the LAN 2 and LAN 3 have an
IP address in the form of 223.1.2.xxx and 223.1.3.xxx respectively.
o Each IP address consists of two parts. The first part (first three bytes in IP
address) specifies the network and second part (last byte of an IP address) Class B
specifies the host in the network. In Class B, an IP address is assigned to those networks that range from small-sized to
large-sized networks.
Classful Addressing o The Network ID is 16 bits long.
An IP address is 32-bit long. An IP address is divided into sub-classes: o The Host ID is 16 bits long.
o Class A In Class B, the higher order bits of the first octet is always set to 10, and the
o Class B remaining14 bits determine the network ID. The other 16 bits determine the Host ID.
o Class C The total number of networks in Class B = 214 = 16384 network address
o Class D The total number of hosts in Class B = 216 - 2 = 65534 host address
o Class E
An ip address is divided into two parts:
o Network ID: It represents the number of networks.
o Host ID: It represents the number of hosts.

[Unit 3 Notes] By Prof. Narendra Kumar Page 2


o The Host ID in which all the bits are set to 0 cannot be assigned as it is used
to represent the network ID of the IP address.
o The Host ID in which all the bits are set to 1 cannot be assigned as it is
reserved for the multicast address.

Class C Rules for assigning Network ID:


In Class C, an IP address is assigned to only small-sized networks. If the hosts are located within the same local network, then they are assigned with the
o The Network ID is 24 bits long. same network ID. The following are the rules for assigning Network ID:
o The host ID is 8 bits long. o The network ID cannot start with 127 as 127 is used by Class A.
In Class C, the higher order bits of the first octet is always set to 110, and the o The Network ID in which all the bits are set to 0 cannot be assigned as it is
remaining 21 bits determine the network ID. The 8 bits of the host ID determine the used to specify a particular host on the local network.
host in a network. o The Network ID in which all the bits are set to 1 cannot be assigned as it is
The total number of networks = 221 = 2097152 network address reserved for the multicast address.
The total number of hosts = 28 - 2 = 254 host address

Classful Network Architecture


What is Subnetting?
Sub-netting is the practice of dividing a network into two or smaller
Class D networks. It increases routing efficiency, which helps to enhance the
In Class D, an IP address is reserved for multicast addresses. It does not possess
subnetting. The higher order bits of the first octet is always set to 1110, and the
security of the network and reduces the size of the broadcast domain.
remaining bits determines the host ID in any network. IP Subnetting designates high-order bits from the host as part of the
network prefix. This method divides a network into smaller subnets.
It also helps you to reduce the size of the routing tables, which is stored in
routers. This method also helps you to extend the existing IP address base
& restructures the IP address.
Class E
In Class E, an IP address is used for the future use or for the research and
development purposes. It does not possess any subnetting. The higher order bits of
the first octet is always set to 1111, and the remaining bits determines the host ID in
any network.

Rules for assigning Host ID:


The Host ID is used to determine the host within any network. The Host ID is
assigned based on the following rules:
o The Host ID must be unique within any network. Why Use Subnetting?

[Unit 3 Notes] By Prof. Narendra Kumar Page 3


Here are important reasons for using Subnetting: How to Use a Subnet Mask?
The subnet mask is used by the router to cover up the network address. It
 It helps you to maximize IP addressing efficiency. shows which bits are used to identify the subnet.
 Extend the life of IPV4. Every network has its own unique address, Like here, class B network has
 Public IPV4 Addresses are scarce. network address 172.20.0.0, which has all zeroes in the host portion of the
 IPV4 Subnetting reduces network traffic by eliminating collision address.
and broadcast traffic and thus improves overall performance. Example IP address: 11000001. Here 1st and 2nd bits are 1, and the 3rd bit is
 This method allows you to apply network security policies at the 0; hence, it is class C.
interconnection between subnets.
 Optimized IP network performance.
 Facilitates spanning of large geographical distances.

What is Subnet Mask?


A subnet mask is a 32 bits address used to distinguish between a network
address and a host address in IP address. A subnet mask identifies which
part of an IP address is the network address and the host address. They are
not shown inside the data packets traversing the Internet. They carry the
destination IP address, which a router will match with a subnet.
Methods of Subnet Masking
Two types of subnet masks are:
We can subnet the masking process in two ways: Straight or Short-cut.
1) Straight
 The default Subnet Mask is the number of bits which is reserved by You should use the binary notation method for both the address and the
the address class. Using this default mask will accommodate a mask and then apply the AND operation to get the block address.
single network subnet in the relative class.
2) Short-Cut Method
 A Custom Subnet Mask can be defined by an administrator
to accommodate many Network
 In case the byte in the mask is 255, you need to copy the byte in the
destination address.
 When the byte in the mask is 0, then you need to replace the byte in
the address with 0.
 When the byte in the mask is neither 255 nor 0, then you should
write the mask and the address in binary and use the AND
operation.

[Unit 3 Notes] By Prof. Narendra Kumar Page 4


Class Higher bits NET ID bits HOST ID bits No.of No.of hosts Range
network per network
s

A 0 8 24 27 224 0.0.0.0 to 127.255.255.255

B 10 16 16 214 216 128.0.0.0 to 191.255.255.255

C 110 24 8 221 28 192.0.0.0 to 223.255.255.255

D 1110 Not Defined Not Defined Not Not Defined 224.0.0.0 to 239.255.255.255
Defined

E 1111 Not Defined Not Defined Not Not Defined 240.0.0.0 to 255.255.255.255
Defined

[Unit 3 Notes] By Prof. Narendra Kumar Page 5


No. of No. of host
Class Default subnet mask
networks per network
A 255.0.0.0 256 16,777,214
B 255.255.0.0 65,536 65,534
C 255.255.255.0 16,77,216 126

Subnetting in Networking-
1. Fixed Length Subnetting
In networking,
2. Variable Length Subnetting
 The process of dividing a single network into multiple sub
1. Fixed Length Subnetting-
networks is called as subnetting.
 The sub networks so created are called as subnets. Fixed length subnetting also called as classful subnetting divides the
Example- network into subnets where-
Following diagram shows the subnetting of a big single • All the subnets are of same size.
network into 4 smaller subnets- • All the subnets have equal number of hosts.
• All the subnets have same subnet mask.
2. Variable Length Subnetting-
Variable length subnetting also called as classless subnetting divides the
network into subnets where-
• All the subnets are not of same size.
• All the subnets do not have equal number of hosts.
• All the subnets do not have same subnet mask.
Advantages- Subnetting Examples-
The two main advantages of subnetting a network are- Now, we shall discuss some examples of subnetting a network-
 It improves the security. Example-01:
 The maintenance and administration of subnets is easy. Consider-
 Subnet ID- • We have a big single network having IP Address 200.1.2.0.
 Each subnet has its unique network address known as • We want to do subnetting and divide this network into 2 subnets.
its Subnet ID. Clearly, the given network belongs to class C.
 The subnet ID is created by borrowing some bits from the Host
ID part of the IP Address.
 The number of bits borrowed depends on the number of
subnets created.
Types of Subnetting-
Subnetting of a network may be carried out in the following two ways-

[Unit 3 Notes] By Prof. Narendra Kumar Page 6


For creating two subnets and to represent their subnet IDs, we require 1 • Total number of IP Addresses = 27 = 128
bit. So, • Total number of hosts that can be configured = 128 – 2 = 126
 We borrow one bit from the Host ID part. • Range of IP Addresses = [200.1.2.10000000, 200.1.2.11111111] =
 After borrowing one bit, Host ID part remains with only 7 bits.
[200.1.2.128, 200.1.2.255]
• Direct Broadcast Address = 200.1.2.11111111 = 200.1.2.255
• Limited Broadcast Address = 255.255.255.255
Example-02:
Consider-
 We have a big single network having IP Address 200.1.2.0.
 We want to do subnetting and divide this network into 4
subnets.
 Clearly, the given network belongs to class C.

 If borrowed bit = 0, then it represents the first subnet.


 If borrowed bit = 1, then it represents the second subnet.
IP Address of the two subnets are-
 200.1.2.00000000 = 200.1.2.0
 200.1.2.10000000 = 200.1.2.128

For creating four subnets and to represent their subnet IDs, we require 2
bits. So,
 We borrow two bits from the Host ID part.
 After borrowing two bits, Host ID part remains with only 6 bits.

For 1st Subnet-


• IP Address of the subnet = 200.1.2.0
• Total number of IP Addresses = 27 = 128
• Total number of hosts that can be configured = 128 – 2 = 126
• Range of IP Addresses = [200.1.2.00000000, 200.1.2.01111111] =
[200.1.2.0, 200.1.2.127]
• Direct Broadcast Address = 200.1.2.01111111 = 200.1.2.127
• Limited Broadcast Address = 255.255.255.255
For 2nd Subnet-  If borrowed bits = 00, then it represents the 1st subnet.
• IP Address of the subnet = 200.1.2.128  If borrowed bits = 01, then it represents the 2nd subnet.
 If borrowed bits = 10, then it represents the 3rd subnet.
[Unit 3 Notes] By Prof. Narendra Kumar Page 7
 If borrowed bits = 11, then it represents the 4th subnet.  IP Address of the subnet = 200.1.2.128
 IP Address of the four subnets are-  Total number of IP Addresses = 26 = 64
 Total number of hosts that can be configured = 64 – 2 = 62
 200.1.2.00000000 = 200.1.2.0
 Range of IP Addresses = [200.1.2.10000000, 200.1.2.10111111] =
 200.1.2.01000000 = 200.1.2.64
[200.1.2.128, 200.1.2.191]
 200.1.2.10000000 = 200.1.2.128
 Direct Broadcast Address = 200.1.2.10111111 = 200.1.2.191
 200.1.2.11000000 = 200.1.2.192
 Limited Broadcast Address = 255.255.255.255
For 4th Subnet-

 IP Address of the subnet = 200.1.2.192


 Total number of IP Addresses = 26 = 64
 Total number of hosts that can be configured = 64 – 2 = 62
 Range of IP Addresses = [200.1.2.11000000, 200.1.2.11111111] =
[200.1.2.192, 200.1.2.255]
 Direct Broadcast Address = 200.1.2.11111111 = 200.1.2.255
 Limited Broadcast Address = 255.255.255.255
For 1st Subnet-
Example-03:
 IP Address of the subnet = 200.1.2.0 Consider-
 Total number of IP Addresses = 26 = 64  We have a big single network having IP Address 200.1.2.0.
 Total number of hosts that can be configured = 64 – 2 = 62  We want to do subnetting and divide this network into 3 subnets.
 Range of IP Addresses = [200.1.2.00000000, 200.1.2.00111111] = Here, the subnetting will be performed in two steps-
[200.1.2.0, 200.1.2.63] 1. Dividing the given network into 2 subnets
 Direct Broadcast Address = 200.1.2.00111111 = 200.1.2.63
2. Dividing one of the subnets further into 2 subnets
 Limited Broadcast Address = 255.255.255.255
For 2nd Subnet-
Step-01: Dividing Given Network into 2 Subnets-
The subnetting will be performed exactly in the same way as performed in
 IP Address of the subnet = 200.1.2.64 Example-01.
 Total number of IP Addresses = 26 = 64
After subnetting, we have-
 Total number of hosts that can be configured = 64 – 2 = 62
 Range of IP Addresses = [200.1.2.01000000, 200.1.2.01111111] =
[200.1.2.64, 200.1.2.127]
 Direct Broadcast Address = 200.1.2.01111111 = 200.1.2.127
 Limited Broadcast Address = 255.255.255.255
For 3rd Subnet-

[Unit 3 Notes] By Prof. Narendra Kumar Page 8


 IP Address of the subnet = 200.1.2.0
Step-02: Dividing One Subnet into 2 Subnets-  Total number of IP Addresses = 27 = 128
 We perform the subnetting of one of the subnets further into 2  Total number of hosts that can be configured = 128 – 2 = 126
subnets.  Range of IP Addresses = [200.1.2.00000000, 200.1.2.01111111] =
 Consider we want to do subnetting of the 2nd subnet having IP [200.1.2.0, 200.1.2.127]
Address 200.1.2.128.  Direct Broadcast Address = 200.1.2.01111111 = 200.1.2.127
 For creating two subnets and to represent their subnet IDs, we  Limited Broadcast Address = 255.255.255.255
require 1 bit. So,
 We borrow one more bit from the Host ID part. For 2nd Subnet-
 After borrowing one bit, Host ID part remains with only 6 bits.
 IP Address of the subnet = 200.1.2.128
 Total number of IP Addresses = 26 = 64
 Total number of hosts that can be configured = 64 – 2 = 62
 Range of IP Addresses = [200.1.2.10000000, 200.1.2.10111111] =
[200.1.2.128, 200.1.2.191]
 Direct Broadcast Address = 200.1.2.10111111 = 200.1.2.191
 Limited Broadcast Address = 255.255.255.255
 If 2nd borrowed bit = 0, then it represents one subnet. For 3rd Subnet-
 If 2nd borrowed bit = 1, then it represents the other subnet.
 IP Address of the subnet = 200.1.2.192
IP Address of the two subnets are-  Total number of IP Addresses = 26 = 64
 200.1.2.10000000 = 200.1.2.128  Total number of hosts that can be configured = 64 – 2 = 62
 200.1.2.11000000 = 200.1.2.192  Range of IP Addresses = [200.1.2.11000000, 200.1.2.11111111] =
[200.1.2.192, 200.1.2.255]
 Direct Broadcast Address = 200.1.2.11111111 = 200.1.2.255
 Limited Broadcast Address = 255.255.255.255

Point-01:

Finally, the given single network is divided into 3 subnets having IP Subnetting leads to loss of IP Addresses.
Address- During subnetting,
 200.1.2.0  We have to face a loss of IP Addresses.
 200.1.2.128  This is because two IP Addresses are wasted for each subnet.
 200.1.2.192  One IP address is wasted for its network address.
 Other IP Address is wasted for its direct broadcasting address.
For 1st Subnet-
Point-02: Subnetting leads to complicated communication process.
[Unit 3 Notes] By Prof. Narendra Kumar Page 9
After subnetting, the communication process becomes complex involving 2. 4094
the following 4 steps- 3. 4092
1. Identifying the network 4. 4090
2. Identifying the sub network Solution-
3. Identifying the host
 Number of bits reserved for network ID in the given subnet mask =
4. Identifying the process
20.
PRACTICE PROBLEMS BASED ON SUBNETTING IN
 So, Number of bits reserved for Host ID = 32 – 20 = 12 bits.
NETWORKING-
 Thus, Number of hosts per subnet = 212 – 2 = 4094.
Problem-01:  In class B, 16 bits are reserved for the network.
 So, Number of bits reserved for subnet ID = 20 – 16 = 4 bits.
Suppose a network with IP Address 192.16.0.0. is divided into 2 subnets,
find number of hosts per subnet.  Number of subnets possible = 24 = 16.
 Thus, Option (B) is correct.
Also for the first subnet, find-
1. Subnet Address
To gain better understanding about IPv4 Subnetting,
2. First Host ID
3. Last Host ID
4. Broadcast Address IP Subnetting
As we talked about before, there are two parts in an IP Address. One for
Solution- them is Network part and the another is Host part. With IP Subnetting,
 Given IP Address belongs to class C. we are adding one more part. This is “Subnet Part”. From the Host part,
 So, 24 bits are reserved for the Net ID. we borrow some bits and we will use this part for Subnet. In this lesson,
 The given network is divided into 2 subnets. we will learn Subnetting with Subnetting Examples.
 So, 1 bit is borrowed from the host ID part for the subnet IDs.
 Then, Number of bits remaining for the Host ID = 7.
 Thus, Number of hosts per subnet = 27 = 128.

For 1st Subnet-


 Subnet Address = First IP Address = 192.16.0.00000000 =
172.16.0.0
 First Host ID = 192.16.0.00000001 = 192.16.0.1
 Last Host ID = 192.16.0.01111110 = 192.16.0.126
 Broadcast Address = Last IP Address = 192.16.0.01111111 = As a basic definion, Subnetting is dividing the network into smaller
172.16.0.127 network groups and by doing this, using the IP Address Block more
Problem-03: efficient.
In a class B, network on the internet has a subnet mask of 255.255.240.0.
What is the maximum number of hosts per subnet?
1. 4096
[Unit 3 Notes] By Prof. Narendra Kumar Page 10
For Subnetting, Subnet Masks are used. Subnets masks are 32 bit
addresses like IP Addresses. Subnet Masks are used with IP Addresses.
The 1s represents the network parts, and 0s represents the host parts.

We can show Subnet Masks with four octets like IP


addresses (255.255.255.0) or we can show it like /X . Here, for the
255.255.255.0 Subnet Mask, we can use /24. This means that the first 24
bit is full of 1s and it is network part.

CIDR versus VLSM

In Subnetting, there are two important terms. These are :

• CIDR (Classless Inter Domain Routing)


• VLSM (Variable Length Subnet Mask)

CIDR (Classless Inter Domain Routing) is a method of assigning IP CIDR is used on the addresses that will advertise to the internet. So, it is
addresses that improves the efficiency of address distribution and replaces used in the Internet Service Provider part. VLSM is used in a company or
the previous system based on Class A, Class B and Class C networks. in smaller networks to use IP address spaces ideally.

The CIDR number is typically preceded by a slash “/” and follows the IP VLSM (Variable Length Subnet Mask) is the term that is used for using
address. For example, an IP address of 131.10. 55.70 with a subnet mask different Subnet Mask for different sun networks. In other words, it is the
of 255.0. 0.0 (which has 8 network bits) would be represented as 131.10. mechanism that allows different Subnet Masks and provide division of a
network into sub networks. It is like Subnet of subnets.
What is a CIDR of 24?
Special Subnets
0.15 and the /24 CIDR, for example. 192.168. 0.15 defines the address
prefix, and /24 defines the number of bits reserved for the netmask. This In Subnetting some Subnet Masks are used specifically sometimes. These
means that the first 24 bits of the IP address are reserved for network are /24, /30, /31/ and /32.
routing.
What is 255.255 255.0 CIDR? • /24 is the Subnet Mask that is usually used in the local networks by
default.
The subnet mask 255.255. 255.0 translates to /24 in CIDR-speak, as 24 • /32 is the Subnet Mask used generally on Loopback and System
bits are used for the network. That leaves 8 bits / 256 IPs for nodes. interfaces.
In CIDR notation, IP addresses are written as a prefix, and a suffix is • /31 is the Subnet Mask used on point-to-point links.
attached to indicate how many bits are in the entire address. The suffix is • /30 is also widely used in Service Provider Networks for point-to-
set apart from the prefix with a slash mark. For instance, in the CIDR point connections.
notation 192.0. 1.0/24, the prefix or IP address is 192.0.
Loopback Interface is the “virtual” interfaces. There can be many
Loopback interfaces in a Router. Loopback Interfaces are used for its

[Unit 3 Notes] By Prof. Narendra Kumar Page 11


“always up and never physically down” characteristics generally. We give
these Loopback Interfaces a /32 Loopback IP address.
IP Subnetting Examples: Example 2
IP Subnetting Examples: Example 1
In the second one of Subnetting Examples, we will do a little more
In the first one of the Subnetting Examples, we will use, 192.168.5.85 complex example. This time our IP address will be 10.128.240.50/30.
/24 Address.Let’s determine the network and host part of this address.
This is the first example, so we are starting with an easy example. IP Address : 10.128.240.50
Sunet Mask : 255.255.255.252
IP Address : 192.168.5.85
Subnet Mask : 255.255.255.0 Here, there is a challenge in front of us. As you can see, we have seen the
/30 and write 255.255.255.252. How can we do this? Let’s see bit by bit.
For this example, firstly we will convert this decimal numbers to the
binary equals. As you can see below, the 1s in the Subnet Mask will show /30 means that the subnet mask has 30 bits 1s and 2 bits 0s. Remember
the number of bits that network part has. And the 0s will show the host the total Subnet Mask is 32 bits. So in binary mode our Subnet Mask is:
part bits.
11111111.11111111.11111111.11111100 (First 30 bits are 1s and 2 bits
IP Address : 11000000. 10101000.00000101.01010101 are 0s)
Subnet Mask : 11111111. 11111111. 11111111.00000000
And the decimal equal of this Subnet Mask is : 255.255.255.252
So, here, the first 24 bits (First 3 octets) are network bits and the last 8
bits (Last octet) are the host bits. Now, let’s determine the network, broadcast and host addresses of this
prefix. An IP address with Subnet Mask called Prefix.So, we will write
For this IP and Subnet Mask, to determine the Network Address of this IP the binary equals of IP address and Subnet and use AND again.
address, we will use “AND” operation between IP Address and Subnet
Mask in binary mode. IP Add : 00001010.10000000.11110000.00110010
SubM : 11111111.11111111.11111111.11111100
IP Add: 11000000. 10101000.00000101.01010101 AND : 00001010.10000000.11110000.00110000
SubM : 11111111. 11111111. 11111111.00000000
AND : 11000000. 10101000.00000101.00000000 The result of AND operation is the Network Address. This
is 00001010.10000000.11110000.00110000 in binary. The decimal value
When we use AND operation with this binary numbers, as you can see, of this is 10.128.240.48.
the last octet will be multiple with zero (AND is Multiplication). So the
result of this multiplication will be 192.168.5.0. Here, the first three octets Here, the last two bits are host bits and the other bits are network bits.
will be same as IP address and the last octet will be full of 0s. When we set all the host bits with 1s, we will find the Broadcast Address.
This is 00001010.10000000.11110000.00110011 in binary. The decimal
For this example our broadcast address will be 192.168.5.255. AS you can value is 10.128.240.51.
see, all the host bits are full of 1s for broadcast address. The other
addresses in the middle through 192.168.5.1 to 192.168.5.254 are host The middle addresses can be used for hosts. These addresses
addresses. are 10.128.240.49 and 10.128.240.50.

[Unit 3 Notes] By Prof. Narendra Kumar Page 12


Network Address : 10.128.240.48 172.16.100.0 = 10101100.00010000.01100100.00000000
Host Addresses : 10.128.240.49 and 10.128.240.50 255.255.255.240 =11111111.11111111.11111111.11110000
Broadcast Address : 10.128.240.51
When we use AND operation here, our network address will be the same,
/30 addresses are generally used in Service Provider Networks. So, you in binary 10101100.00010000.01100100.00000000 or in decimal
can work with /30 too much in the future. 172.16.100.0. But our Broadcast address will change, because our host
bits are only the last 4 bits anymore.

10101100.00010000.01100100.00000000 network address (172.16.100.0)


10101100.00010000.01100100.00001111 broadcast address
Subnetting Example 3 (172.16.100.15)

Think about 172.16.100.0/24 prefix and 172.16.100.0/28 prefix. As you This is for the first network. We divide the network by using higher
can see, the only difference is Subnet Mask. In the first prefix, first 24 bits Subnet Mask. So, let’s look at the other networks:
is network bits and the last 8 bits (32-24) are the host bits. In the second
prefix, first 28 bits are network bits and the last 4 bits (32-28) are host 10101100.00010000.01100100.00010000
bits. 10101100.00010000.01100100.00100000
10101100.00010000.01100100.00110000
Let’s firstly talk about the first Prefix. We will write the IP Address and 10101100.00010000.01100100.01000000
the Subnet Mask of this Prefix in binary format: ….
10101100.00010000.01100100.11110000
172.16.100.0 = 10101100.00010000.01100100.00000000
255.255.255.0 =11111111.11111111.11111111.00000000 As you can see, we have 16 networks. We have divided a Prefix, into
smaller 16 different Prefixes. Each of these Prefix has 14 host
address, 1 broadcast address and 1 network address.

When we use AND operation, our network address


is 10101100.00010000.01100100.00000000 (the same as the IP showed in
prefix by change). This is 172.16.100.0 . So, if we use a given address with a higher Subnet Mask value like given
in the second example, we will have more networks. In other words, we
And the Broadcast address is 172.16.100.255. The other 254 IP addresses can divide the network into smaller pieces. So, we will not waste the IP
are host IP addresses. Addresses. Smaller networks that has few hosts do not need more
addresses.
172.16.100.1
172.16.100.2 Internet Protocol address(IP)
….
172.16.100.254 IP address stands for “Internet Protocol address.” The Internet Protocol is
a set of rules for communication over the internet, such as sending mail,
For the first prefix, we have only one network that has 254 hosts. streaming video, or connecting to a website. An IP address identifies a
network or device on the internet.
Now, let’s check the second prefix. 172.16.100.0 /28.

[Unit 3 Notes] By Prof. Narendra Kumar Page 13


Address Resolution Protocol (ARP) and Proxy ARP - Proxy ARP is a method through which a Layer 3 devices
may respond to ARP requests for a target that is in a different network
its types from the sender. The Proxy ARP configured router responds to the ARP
and map the MAC address of the router with the target IP address and
fool the sender that it is reached at its destination.
Address Resolution Protocol (ARP) is a communication protocol used to
find the MAC (Media Access Control) address of a device from its IP Example - If Host A wants to transmit data to Host B, which is on the
address. This protocol is used when a device wants to communicate with different network, then Host A sends an ARP request message to receive a
another device on a Local Area Network or Ethernet. MAC address for Host B. The router responds to Host A with its own
MAC address pretend itself as a destination. When the data is transmitted
Types of ARP to the destination by Host A, it will send to the gateway so that it sends to
Host B. This is known as proxy ARP.
There are four types of Address Resolution Protocol, which is given
below: Gratuitous ARP - Gratuitous ARP is an ARP request of the host that
helps to identify the duplicate IP address. It is a broadcast request for the
IP address of the router.
o Proxy ARP
o Gratuitous ARP Reverse ARP (RARP) - It is a networking protocol used by the client
system in a local area network (LAN) to request its IPv4 address from the
o Reverse ARP (RARP) ARP gateway router table. A table is created by the network administrator
o Inverse ARP in the gateway-router that is used to find out the MAC address to the
corresponding IP address.

Inverse ARP (InARP) - Inverse ARP is inverse of the ARP, and it is


used to find the IP addresses of the nodes from the data link layer
addresses. These are mainly used for the frame relays, and ATM
networks, where Layer 2 virtual circuit addressing are often acquired from
Layer 2 signaling. When using these virtual circuits, the relevant Layer 3
addresses are available.

How ARP works


If the host wants to know the physical address of another host on its network, then it
sends an ARP query packet that includes the IP address and broadcast it over the
network. Every host on the network receives and processes the ARP packet, but only
the intended recipient recognizes the IP address and sends back the physical address.
The host holding the datagram adds the physical address to the cache memory and to
the datagram header, then sends back to the sender.

[Unit 3 Notes] By Prof. Narendra Kumar Page 14


Note: ARP cache is used to make a network more efficient.
In the above screenshot, we observe the association of IP address to the MAC
address.
There are two types of ARP entries:
o Dynamic entry: It is an entry which is created automatically when the
sender broadcast its message to the entire network. Dynamic entries are not
permanent, and they are removed periodically.
o Static entry: It is an entry where someone manually enters the IP to MAC
Steps taken by ARP protocol address association by using the ARP command utility.
If a device wants to communicate with another device, the following steps are taken
by the device:
o The device will first look at its internet list, called the ARP cache to check
RARP
o RARP stands for Reverse Address Resolution Protocol.
whether an IP address contains a matching MAC address or not. It will
check the ARP cache in command prompt by using a command arp-a. o If the host wants to know its IP address, then it broadcast the RARP query
packet that contains its physical address to the entire network. A RARP
server on the network recognizes the RARP packet and responds back with
the host IP address.
o The protocol which is used to obtain the IP address from a server is known
as Reverse Address Resolution Protocol.
o The message format of the RARP protocol is similar to the ARP protocol.
o Like ARP frame, RARP frame is sent from one machine to another
o If ARP cache is empty, then device broadcast the message to the entire encapsulated in the data portion of a frame.
network asking each device for a matching MAC address.
o The device that has the matching IP address will then respond back to the
sender with its MAC address
o Once the MAC address is received by the device, then the communication
can take place between two devices.
o If the device receives the MAC address, then the MAC address gets stored
in the ARP cache. We can check the ARP cache in command prompt by
using a command arp -a.

[Unit 3 Notes] By Prof. Narendra Kumar Page 15


The Format of an ICMP message

o The first field specifies the type of the message.


o The second field specifies the reason for a particular message type.
o The checksum field covers the entire ICMP message.
Error Reporting
ICMP protocol reports the error messages to the sender.
Five types of errors are handled by the ICMP protocol:

ICMP
o ICMP stands for Internet Control Message Protocol.
o The ICMP is a network layer protocol used by hosts and routers to send the
notifications of IP datagram problems back to the sender.
o ICMP uses echo test/reply to check whether the destination is reachable and
responding.
o ICMP handles both control and error messages, but its main function is to o Destination unreachable: The message of "Destination Unreachable" is
report the error but not to correct them. sent from receiver to the sender when destination cannot be reached, or
o An IP datagram contains the addresses of both source and destination, but it packet is discarded when the destination is not reachable.
does not know the address of the previous router through which it has been o Source Quench: The purpose of the source quench message is congestion
passed. Due to this reason, ICMP can only send the messages to the source, control. The message sent from the congested router to the source host to
but not to the immediate routers. reduce the transmission rate. ICMP will take the IP of the discarded packet
o ICMP protocol communicates the error messages to the sender. ICMP and then add the source quench message to the IP datagram to inform the
messages cause the errors to be returned back to the user processes. source host to reduce its transmission rate. The source host will reduce the
o ICMP messages are transmitted within IP datagram. transmission rate so that the router will be free from congestion.
o Time Exceeded: Time Exceeded is also known as "Time-To-Live". It is a
parameter that defines how long a packet should live before it would be
discarded.
There are two ways when Time Exceeded message can be generated:

[Unit 3 Notes] By Prof. Narendra Kumar Page 16


Sometimes packet discarded due to some bad routing implementation, and this o The IGMP message is encapsulated within an IP datagram.
causes the looping issue and network congestion. Due to the looping issue, the value
of TTL keeps on decrementing, and when it reaches zero, the router discards the
datagram. However, when the datagram is discarded by the router, the time exceeded
message will be sent by the router to the source host.
When destination host does not receive all the fragments in a certain time limit, then
the received fragments are also discarded, and the destination host sends time
Exceeded message to the source host.
o Parameter problems: When a router or host discovers any missing value in
the IP datagram, the router discards the datagram, and the "parameter
The Format of IGMP message
problem" message is sent back to the source host.
o Redirection: Redirection message is generated when host consists of a
small routing table. When the host consists of a limited number of entries
due to which it sends the datagram to a wrong router. The router that
receives a datagram will forward a datagram to a correct router and also Where,
sends the "Redirection message" to the host to update its routing table. Type: It determines the type of IGMP message. There are three types of IGMP
message: Membership Query, Membership Report and Leave Report.
Maximum Response Time: This field is used only by the Membership Query
IGMP message. It determines the maximum time the host can send the Membership Report
o IGMP stands for Internet Group Message Protocol. message in response to the Membership Query message.
o The IP protocol supports two types of communication: Checksum: It determines the entire payload of the IP datagram in which IGMP
o Unicasting: It is a communication between one sender and one message is encapsulated.
receiver. Therefore, we can say that it is one-to-one Group Address: The behavior of this field depends on the type of the message sent.
communication. o For Membership Query, the group address is set to zero for General Query
o Multicasting: Sometimes the sender wants to send the same and set to multicast group address for a specific query.
message to a large number of receivers simultaneously. This o For Membership Report, the group address is set to the multicast group
process is known as multicasting which has one-to-many address.
communication. o For Leave Group, it is set to the multicast group address.
o
o
The IGMP protocol is used by the hosts and router to support multicasting.
The IGMP protocol is used by the hosts and router to identify the hosts in a
IGMP Messages
LAN that are the members of a group.

o Membership Query message


o IGMP is a part of the IP layer, and IGMP has a fixed-size message.

[Unit 3 Notes] By Prof. Narendra Kumar Page 17


o This message is sent by a router to all hosts on a local area network o A router is a networking device that forwards the packet based on the
to determine the set of all the multicast groups that have been information available in the packet header and forwarding table.
joined by the host. o The routing algorithm initializes and maintains the routing table for the
o It also determines whether a specific multicast group has been process of path determination.
joined by the hosts on a attached interface.
o The group address in the query is zero since the router expects one
response from a host for every group that contains one or more Routing Metrics and Costs
members on that host. Routing metrics and costs are used for determining the best route to the destination.
o Membership Report message The factors used by the protocols to determine the shortest path, these factors are
o The host responds to the membership query message with a known as a metric.
membership report message.
o Membership report messages can also be generated by the host The most common metric values are given below:
when a host wants to join the multicast group without waiting for a o Hop count: Hop count is defined as a metric that specifies the number of
membership query message from the router. passes through internetworking devices such as a router, a packet must
o Membership report messages are received by a router as well as all travel in a route to move from source to the destination.
the hosts on an attached interface. o Delay: It is a time taken by the router to process, queue and transmit a
o Each membership report message includes the multicast address of datagram to an interface. The protocols use this metric to determine the
a single group that the host wants to join. delay values for all the links along the path end-to-end. The path having the
o IGMP protocol does not care which host has joined the group or lowest delay value will be considered as the best path.
how many hosts are present in a single group. It only cares whether o Bandwidth: The capacity of the link is known as a bandwidth of the link.
one or more attached hosts belong to a single multicast group. The bandwidth is measured in terms of bits per second.
o The membership Query message sent by a router also includes a o Load: Load refers to the degree to which the network resource such as a
"Maximum Response time". After receiving a membership query router or network link is busy. A Load can be calculated in a variety of
message and before sending the membership report message, the ways such as CPU utilization, packets processed per second.
host waits for the random amount of time from 0 to the maximum o Reliability: Reliability is a metric factor may be composed of a fixed value.
response time. If a host observes that some other attached host has It depends on the network links, and its value is measured dynamically.
sent the "Maximum Report message", then it discards its Some networks go down more often than others. After network failure,
"Maximum Report message" as it knows that the attached router some network links repaired more easily than other network links.
already knows that one or more hosts have joined a single multicast
group. This process is known as feedback suppression. It provides
the performance optimization, thus avoiding the unnecessary Types of Routing
transmission of a "Membership Report message". Routing can be classified into three categories:
o Leave Report
When the host does not send the "Membership Report message", it means
that the host has left the group. The host knows that there are no members in
the group, so even when it receives the next query, it would not report the
group.

Routing
o A Router is a process of selecting path along which the data can be
transferred from source to the destination. Routing is performed by a special
device known as a router.
o A Router works at the network layer in the OSI model and internet layer in
TCP/IP model

[Unit 3 Notes] By Prof. Narendra Kumar Page 18


Static Routing Advantages of Dynamic Routing:
o Static Routing is also known as Non adaptive Routing. o It is easier to configure.
o It is a technique in which the administrator manually adds the routes in a o It is more effective in selecting the best route in response to the changes in
routing table. the condition or topology.
o A Router can send the packets for the destination along the route defined by

Routing algorithm
the administrator.
o In this technique, routing decisions are not made based on the condition or
topology of the networks o In order to transfer the packets from source to the destination, the network
Advantages Of Static Routing layer must determine the best route through which packets can be
Following are the advantages of Static Routing: transmitted.
o No Overhead: It has ho overhead on the CPU usage of the router. o Whether the network layer provides datagram service or virtual circuit
Therefore, the cheaper router can be used to obtain static routing. service, the main job of the network layer is to provide the best route. The
o Bandwidth: It has not bandwidth usage between the routers. routing protocol provides this job.
o Security: It provides security as the system administrator is allowed only to o The routing protocol is a routing algorithm that provides the best path from
have control over the routing to a particular network. the source to the destination. The best path is the path that has the "least-
cost path" from source to the destination.
o Routing is the process of forwarding the packets from source to the
Default Routing destination but the best route to send the packets is determined by the
o Default Routing is a technique in which a router is configured to send all the routing algorithm.
packets to the same hop device, and it doesn't matter whether it belongs to a
particular network or not. A Packet is transmitted to the device for which it
is configured in default routing. Classification of a Routing algorithm
o Default Routing is used when networks deal with the single exit point. The Routing algorithm is divided into two categories:
o It is also useful when the bulk of transmission networks have to transmit the o Adaptive Routing algorithm
data to the same hp device. o Non-adaptive Routing algorithm
o When a specific route is mentioned in the routing table, the router will
choose the specific route rather than the default route. The default route is
chosen only when a specific route is not mentioned in the routing table.
Dynamic Routing
o It is also known as Adaptive Routing.
o It is a technique in which a router adds a new route in the routing table for
each packet in response to the changes in the condition or topology of the
network.
o Dynamic protocols are used to discover the new routes to reach the
destination.
o In Dynamic Routing, RIP and OSPF are the protocols used to discover the
new routes.
o If any route goes down, then the automatic adjustment will be made to reach
the destination. Adaptive Routing algorithm
The Dynamic protocol should have the following features: o An adaptive routing algorithm is also known as dynamic routing algorithm.
o All the routers must have the same dynamic routing protocol in order to o This algorithm makes the routing decisions based on the topology and
exchange the routes. network traffic.
o If the router discovers any change in the condition or topology, then router o The main parameters related to this algorithm are hop count, distance and
broadcast this information to all other routers. estimated transit time.

[Unit 3 Notes] By Prof. Narendra Kumar Page 19


An adaptive routing algorithm can be classified into three parts:
Usage Adaptive routing The Non-Adaptive Routing
algorithm is used by algorithm is used by static
o Centralized algorithm: It is also known as global routing algorithm as it
dynamic routing. routing.
computes the least-cost path between source and destination by using
complete and global knowledge about the network. This algorithm takes the
connectivity between the nodes and link cost as input, and this information Routing Routing decisions are Routing decisions are the
is obtained before actually performing any calculation. decision made based on static tables.
o Link state algorithm is referred to as a centralized algorithm since it is topology and network
aware of the cost of each link in the network. traffic.
o Isolation algorithm: It is an algorithm that obtains the routing information
by using local information rather than gathering information from other Categorization The types of adaptive The types of Non Adaptive
nodes. routing algorithm, are routing algorithm are
o Distributed algorithm: It is also known as decentralized algorithm as it Centralized, isolation flooding and random
computes the least-cost path between source and destination in an iterative and distributed walks.
and distributed manner. In the decentralized algorithm, no node has the algorithm.
knowledge about the cost of all the network links.
Complexity Adaptive Routing Non-Adaptive Routing
algorithms are more algorithms are simple.
Non-Adaptive Routing algorithm complex.
o Non Adaptive routing algorithm is also known as a static routing algorithm.
o When booting up the network, the routing information stores to the routers.
o Non Adaptive routing algorithms do not take the routing decision based on
the network topology or network traffic.
Distance Vector Routing Algorithm
The Non-Adaptive Routing algorithm is of two types: o The Distance vector algorithm is iterative, asynchronous and
distributed.
Flooding: In case of flooding, every incoming packet is sent to all the outgoing links o Distributed: It is distributed in that each node receives information
except the one from it has been reached. The disadvantage of flooding is that node from one or more of its directly attached neighbors, performs
may contain several copies of a particular packet. calculation and then distributes the result back to its neighbors.
Random walks: In case of random walks, a packet sent by the node to one of its o Iterative: It is iterative in that its process continues until no more
neighbors randomly. An advantage of using random walks is that it uses the information is available to be exchanged between neighbors.
alternative routes very efficiently. o Asynchronous: It does not require that all of its nodes operate in
the lock step with each other.
Differences b/w Adaptive and Non-Adaptive Routing o The Distance vector algorithm is a dynamic algorithm.
Algorithm o It is mainly used in ARPANET, and RIP.
o Each router maintains a distance table known as Vector.
Basis Of Adaptive Routing Non-Adaptive
Comparison algorithm Routing algorithm
Three Keys to understand the working of
Define Adaptive Routing
algorithm is an
The Non-Adaptive Routing
algorithm is an algorithm
Distance Vector Routing Algorithm:
o Knowledge about the whole network: Each router shares its knowledge
algorithm that that constructs the static
through the entire network. The Router sends its collected knowledge about
constructs the routing table to determine which
the network to its neighbors.
table based on the node to send the packet.
o Routing only to neighbors: The router sends its knowledge about the
network conditions.
network to only those routers which have direct links. The router sends
whatever it has about the network through the ports. The information is

[Unit 3 Notes] By Prof. Narendra Kumar Page 20


received by the router and uses the information to update its own routing
table. Sharing Information
o Information sharing at regular intervals: Within 30 seconds, the router
sends the information to the neighboring routers.
Distance Vector Routing Algorithm
Let dx(y) be the cost of the least-cost path from node x to node y. The least costs are
related by Bellman-Ford equation,
dx(y) = minv{c(x,v) + dv(y)}
Where the minv is the equation taken for all x neighbors. After traveling from x to
v, if we consider the least-cost path from v to y, the path cost will be c(x,v)+dv(y).
The least cost from x to y is the minimum of c(x,v)+dv(y) taken over all neighbors.
With the Distance Vector Routing algorithm, the node x contains the following
routing information:
o For each neighbor v, the cost c(x,v) is the path cost from x to directly
attached neighbor, v. o In the above figure, each cloud represents the network, and the number
o The distance vector x, i.e., Dx = [ Dx(y) : y in N ], containing its cost to all inside the cloud represents the network ID.
destinations, y, in N. o All the LANs are connected by routers, and they are represented in boxes
o The distance vector of each of its neighbors, i.e., Dv = [ Dv(y) : y in N ] for labeled as A, B, C, D, E, F.
each neighbor v of x. o Distance vector routing algorithm simplifies the routing process by
Distance vector routing is an asynchronous algorithm in which node x sends the assuming the cost of every link is one unit. Therefore, the efficiency of
copy of its distance vector to all its neighbors. When node x receives the new transmission can be measured by the number of links to reach the
distance vector from one of its neighboring vector, v, it saves the distance vector of destination.
v and uses the Bellman-Ford equation to update its own distance vector. The o In Distance vector routing, the cost is based on hop count.
equation is given below:
dx(y) = minv{ c(x,v) + dv(y)} for each node y in N
The node x has updated its own distance vector table by using the above equation
and sends its updated table to all its neighbors so that they can update their own
distance vectors.
Algorithm
At each node x,
Initialization
for all destinations y in N:
Dx(y) = c(x,y) // If y is not a neighbor then c(x,y) = ∞
for each neighbor w
Dw(y) = ? for all destination y in N.
for each neighbor w
send distance vector Dx = [ Dx(y) : y in N ] to w In the above figure, we observe that the router sends the knowledge to the immediate
loop neighbors. The neighbors add this knowledge to their own knowledge and sends the
wait(until I receive any distance vector from some neighbor w) updated table to their own neighbors. In this way, routers get its own information
for each y in N: plus the new information about the neighbors.
Dx(y) = minv{c(x,v)+Dv(y)}
If Dx(y) is changed for any destination y
Send distance vector Dx = [ Dx(y) : y in N ] to all neighbors
forever
[Unit 3 Notes] By Prof. Narendra Kumar Page 21
o When A receives a routing table from B, then it uses its information to
Routing Table update the table.
Two process occurs: o The routing table of B shows how the packets can move to the networks 1
o Creating the Table and 4.
o Updating the Table o The B is a neighbor to the A router, the packets from A to B can reach in
Creating the Table one hop. So, 1 is added to all the costs given in the B's table and the sum
Initially, the routing table is created for each router that contains atleast three types will be the cost to reach a particular network.
of information such as Network ID, the cost and the next hop.

o After adjustment, A then combines this table with its own table to create a
combined table.

o NET ID: The Network ID defines the final destination of the packet.
o Cost: The cost is the number of hops that packet must take to get there.
o Next hop: It is the router to which the packet must be delivered.

o The combined table may contain some duplicate data. In the above figure,
the combined table of router A contains the duplicate data, so it keeps only
those data which has the lowest cost. For example, A can send the data to
network 1 in two ways. The first, which uses no next router, so it costs one
hop. The second requires two hops (A to B, then B to Network 1). The first
option has the lowest cost, therefore it is kept and the second one is
dropped.

o In the above figure, the original routing tables are shown of all the routers.
In a routing table, the first column represents the network ID, the second
column represents the cost of the link, and the third column is empty.
o These routing tables are sent to all the neighbors.
For Example:
1. A sends its routing table to B, F & E.
2. B sends its routing table to A & C.
3. C sends its routing table to B & D.
4. D sends its routing table to E & C. o The process of creating the routing table continues for all routers. Every
5. E sends its routing table to A & D. router receives the information from the neighbors, and update the routing
6. F sends its routing table to A. table.
Final routing tables of all the routers are given below:
Updating the Table
[Unit 3 Notes] By Prof. Narendra Kumar Page 22
o The Dijkstra's algorithm is an iterative, and it has the property that after
kth iteration of the algorithm, the least cost paths are well known for k
destination nodes.
Let's describe some notations:
o c( i , j): Link cost from node i to node j. If i and j nodes are not directly
linked, then c(i , j) = ∞.
o D(v): It defines the cost of the path from source code to destination v that
has the least cost currently.
o P(v): It defines the previous node (neighbor of v) along with current least
cost path from source to v.
o N: It is the total number of nodes available in the network.
Algorithm
Initialization
N = {A} // A is a root node.

Link State Routing


for all nodes v
if v adjacent to A
Link state routing is a technique in which each router shares the knowledge of its then D(v) = c(A,v)
neighborhood with every other router in the internetwork. else D(v) = infinity
The three keys to understand the Link State Routing algorithm: loop
find w not in N such that D(w) is a minimum.
o Knowledge about the neighborhood: Instead of sending its routing table, a
Add w to N
router sends the information about its neighborhood only. A router
Update D(v) for all v adjacent to w and not in N:
broadcast its identities and cost of the directly attached links to other D(v) = min(D(v) , D(w) + c(w,v))
routers. Until all nodes in N
o Flooding: Each router sends the information to every other router on the In the above algorithm, an initialization step is followed by the loop. The number of
internetwork except its neighbors. This process is known as Flooding. Every times the loop is executed is equal to the total number of nodes available in the
router that receives the packet sends the copies to all its neighbors. Finally, network.
each and every router receives a copy of the same information. Let's understand through an example:
o Information sharing: A router sends the information to every other router
only when the change occurs in the information.

Link State Routing has two phases:


Reliable Flooding
o Initial state: Each node knows the cost of its neighbors.
o Final state: Each node knows the entire graph.
Route Calculation
Each node uses Dijkstra's algorithm on the graph to calculate the optimal routes to
all nodes.
o The Link state routing algorithm is also known as Dijkstra's algorithm
which is used to find the shortest path from one node to every other node in
the network.

[Unit 3 Notes] By Prof. Narendra Kumar Page 23


In the above figure, source vertex is A. b) Calculating the shortest path from A to C.
1. v = C, w = E
Step 1: 2. D(B) = min( D(C) , D(E) + c(E,C) )
The first step is an initialization step. The currently known least cost path from A to 3. = min( 4 , 2+1 )
its directly attached neighbors, B, C, D are 2,5,1 respectively. The cost from A to B 4. = min( 4,3)
is set to 2, from A to D is set to 1 and from A to C is set to 5. The cost from A to E 5. The minimum value is 3. Therefore, the currently shortest path from A to C is 3.
and F are set to infinity as they are not directly linked to A. c) Calculating the shortest path from A to F.
1. v = F, w = E
2. D(B) = min( D(F) , D(E) + c(E,F) )
Step 2: 3. = min( ∞ , 2+2 )
In the above table, we observe that vertex D contains the least cost path in step 1. 4. = min(∞ ,4)
Therefore, it is added in N. Now, we need to determine a least-cost path through D 5. The minimum value is 4. Therefore, the currently shortest path from A to F is 4.
vertex.
a) Calculating shortest path from A to B Step N D(B),P( D(C),P( D(D),P D(E), D(F),
1. v = B, w = D
2. D(B) = min( D(B) , D(D) + c(D,B) ) B) C) (D) P(E) P(F)
3. = min( 2, 1+2)>
4. = min( 2, 3) 1 A 2,A 5,A 1,A ∞ ∞
5. The minimum value is 2. Therefore, the currently shortest path from A to B is 2.
b) Calculating shortest path from A to C 2 A 2,A 4,D 2,D ∞
1. v = C, w = D D
2. D(B) = min( D(C) , D(D) + c(D,C) )
3. = min( 5, 1+3) 3 A 2,A 3,E 4,E
4. = min( 5, 4) D
5. The minimum value is 4. Therefore, the currently shortest path from A to C is 4.</p> E

c) Calculating shortest path from A to E Step 4:


1. v = E, w = D In the above table, we observe that B vertex has the least cost path in step 3.
2. D(B) = min( D(E) , D(D) + c(D,E) ) Therefore, it is added in N. Now, we determine the least cost path of remaining
3. = min( ∞, 1+1) vertices through B.
4. = min(∞, 2) a) Calculating the shortest path from A to C.
5. The minimum value is 2. Therefore, the currently shortest path from A to E is 2. 1. v = C, w = B
Note: The vertex D has no direct link to vertex E. Therefore, the value of 2. D(B) = min( D(C) , D(B) + c(B,C) )
D(F) is infinity. 3. = min( 3 , 2+3 )
4. = min( 3,5)
5. The minimum value is 3. Therefore, the currently shortest path from A to C is 3.
Step 3: b) Calculating the shortest path from A to F.
In the above table, we observe that both E and B have the least cost path in step 2. 1. v = F, w = B
Let's consider the E vertex. Now, we determine the least cost path of remaining 2. D(B) = min( D(F) , D(B) + c(B,F) )
vertices through E. 3. = min( 4, ∞)
a) Calculating the shortest path from A to B. 4. = min(4, ∞)
1. v = B, w = E 5. The minimum value is 4. Therefore, the currently shortest path from A to F is 4.
2. D(B) = min( D(B) , D(E) + c(E,B) )
3. = min( 2 , 2+ ∞ ) Step N D(B),P( D(C),P D(D),P(D D(E D(
4. = min( 2, ∞) B) (C) ) ),P( F),
5. The minimum value is 2. Therefore, the currently shortest path from A to B is 2.

[Unit 3 Notes] By Prof. Narendra Kumar Page 24


E) P(
Final table:
F) Step N D(B), D(C), D(D),P( D(E), D(F)
P(B) P(C) D) P(E) ,P(F
1 A 2,A 5,A 1,A ∞ ∞
)
2 AD 2,A 4,D 2, ∞
D 1 A 2,A 5,A 1,A ∞ ∞

3 AD 2,A 3,E 4, 2 AD 2,A 4,D 2,D ∞


E E
3 ADE 2,A 3,E 4,E
4 AD 3,E 4,
EB E 4 ADEB 3,E 4,E

Step 5: 5 ADEBC 4,E


In the above table, we observe that C vertex has the least cost path in step 4.
Therefore, it is added in N. Now, we determine the least cost path of remaining 6 ADEBC
vertices through C. F
a) Calculating the shortest path from A to F.
1. v = F, w = C Disadvantage:
2. D(B) = min( D(F) , D(C) + c(C,F) ) Heavy traffic is created in Line state routing due to Flooding. Flooding can cause an
3. = min( 4, 3+5) infinite looping, this problem can be solved by using Time-to-leave field
4. = min(4,8)
5. The minimum value is 4. Therefore, the currently shortest path from A to F is 4.

Step N D(B), D(C), D(D), D(E), D(F),P IPv4 - Packet Structure


P(B) P(C) P(D) P(E) (F) Internet Protocol being a layer-3 protocol (OSI) takes data Segments
from layer-4 (Transport) and divides it into packets. IP packet
1 A 2,A 5,A 1,A ∞ ∞
encapsulates data unit received from above layer and add to its own
2 AD 2,A 4,D 2,D ∞ header information.

3 ADE 2,A 3,E 4,E

4 ADE 3,E 4,E The encapsulated data is referred to as IP Payload. IP header contains all
B
the necessary information to deliver the packet at the other end.
5 ADE 4,E
BC

[Unit 3 Notes] By Prof. Narendra Kumar Page 25


 Protocol − Tells the Network layer at the destination host, to
which Protocol this packet belongs to, i.e. the next level Protocol.
For example protocol number of ICMP is 1, TCP is 6 and UDP is
17.
 Header Checksum − This field is used to keep checksum value
of entire header which is then used to check if the packet is
received error-free.
 Source Address − 32-bit address of the Sender (or source) of the
packet.
 Destination Address − 32-bit address of the Receiver (or
destination) of the packet.
IP header includes many relevant information including Version  Options − This is optional field, which is used if the value of IHL
Number, which, in this context, is 4. Other details are as follows − is greater than 5. These options may contain values for options
 Version − Version no. of Internet Protocol used (e.g. IPv4). such as Security, Record Route, Time Stamp, etc.
 IHL − Internet Header Length; Length of entire IP header.
 DSCP − Differentiated Services Code Point; this is Type of
Service. IPV6 Address Structure
 ECN − Explicit Congestion Notification; It carries information An IPv6 address is made of 128 bits divided into eight 16-bits blocks.
about the congestion seen in the route. Each block is then converted into 4-digit Hexadecimal numbers
 Total Length − Length of entire IP Packet (including IP header separated by colon symbols.
and IP Payload).
 Identification − If IP packet is fragmented during the Fixed Header
transmission, all the fragments contain same identification
number. to identify original IP packet they belong to.
 Flags − As required by the network resources, if IP Packet is too
large to handle, these ‘flags’ tells if they can be fragmented or
not. In this 3-bit flag, the MSB is always set to ‘0’.
 Fragment Offset − This offset tells the exact position of the
fragment in the original IP Packet.
 Time to Live − To avoid looping in the network, every packet is IPv6 fixed header is 40 bytes long and contains the following
sent with some TTL value set, which tells the network how many information.
routers (hops) this packet can cross. At each hop, its value is
decremented by one and when the value reaches zero, the packet
is discarded.

[Unit 3 Notes] By Prof. Narendra Kumar Page 26


S.N. Field & Description 7
Source Address (128-bits): This field indicates the address
1 of originator of the packet.
Version (4-bits): It represents the version of Internet
Protocol, i.e. 0110. 8
Destination Address (128-bits): This field provides the
2 address of intended recipient of the packet.
Traffic Class (8-bits): These 8 bits are divided into two
parts. The most significant 6 bits are used for Type of
Service to let the Router Known what services should be
provided to this packet. The least significant 2 bits are used
for Explicit Congestion Notification (ECN).
Ipv4 Ipv6
3
Flow Label (20-bits): This label is used to maintain the
sequential flow of the packets belonging to a communication. Address length IPv4 is a 32-bit IPv6 is a 128-bit address.
The source labels the sequence to help the router identify that address.
a particular packet belongs to a specific flow of information.
Fields IPv4 is a numeric IPv6 is an alphanumeric
This field helps avoid re-ordering of data packets. It is address that consists address that consists of 8
designed for streaming/real-time media. of 4 fields which are fields, which are
separated by dot (.). separated by colon.
4
Payload Length (16-bits): This field is used to tell the
Classes IPv4 has 5 different IPv6 does not contain
routers how much information a particular packet contains in
classes of IP address classes of IP addresses.
its payload. Payload is composed of Extension Headers and that includes Class A,
Upper Layer data. With 16 bits, up to 65535 bytes can be Class B, Class C,
indicated; but if the Extension Headers contain Hop-by-Hop Class D, and Class E.
Extension Header, then the payload may exceed 65535 bytes
and this field is set to 0. Number of IP IPv4 has a limited IPv6 has a large number
address number of IP of IP addresses.
5 addresses.
Next Header (8-bits): This field is used to indicate either the
type of Extension Header, or if the Extension Header is not VLSM It supports VLSM It does not support
present then it indicates the Upper Layer PDU. The values (Virtual Length VLSM.
for the type of Upper Layer PDU are same as IPv4’s. Subnet Mask). Here,
VLSM means that
6 Ipv4 converts IP
Hop Limit (8-bits): This field is used to stop packet to loop addresses into a
in the network infinitely. This is same as TTL in IPv4. The subnet of different
value of Hop Limit field is decremented by 1 as it passes a sizes.
link (router/hop). When the field reaches 0 the packet is
discarded. Address It supports manual It supports manual,
configuration and DHCP DHCP, auto-
configuration. configuration, and

[Unit 3 Notes] By Prof. Narendra Kumar Page 27


renumbering. octets each field contains 2
octets. Therefore, the
Address space It generates 4 billion It generates 340 total number of octets in
unique addresses undecillion unique IPv6 is 16.
addresses.

End-to-end In IPv4, end-to-end In the case of IPv6, end-


connection connection integrity is to-end connection Congestion Control
integrity unachievable. integrity is achievable.

Security In IPv4, security In IPv6, IPSEC is Congestion control refers to techniques and mechanisms that can either
features depends on the developed for security prevent congestion, before it happens, or remove congestion, after it has
application. This IP purposes. happened.
address is not
developed in keeping
the security feature in
mind.

Address In IPv4, the IP In IPv6, the


representation address is represented representation of the IP
in decimal. address in hexadecimal.

Fragmentation Fragmentation is done Fragmentation is done by


by the senders and the the senders only.
forwarding routers.

Packet flow It does not provide It uses flow label field in


identification any mechanism for the header for the packet We can divide congestion control mechanisms into two broad categories:
packet flow flow identification. open-loop congestion control (prevention) and closed-loop congestion
identification. control (removal)
Checksum field The checksum field is The checksum field is 1. Open-Loop Congestion Control
available in IPv4. not available in IPv6.

Transmission IPv4 is broadcasting. On the other hand, IPv6 In open-loop congestion control, policies are applied to prevent
scheme is multicasting, which congestion before it happens. In these mechanisms, congestion control is
provides efficient handled by either the source or the destination.
network operations.
a. Retransmission Policy
Encryption and It does not provide It provides encryption Retransmission is sometimes unavoidable. If the sender feels that a sent
Authentication encryption and and authentication.
packet is lost or corrupted, the packet needs to be retransmitted.
authentication.

Number of It consists of 4 octets. It consists of 8 fields, and b. Window Policy

[Unit 3 Notes] By Prof. Narendra Kumar Page 28


The type of window at the sender may also affect congestion. The
Selective Repeat window is better than the Go-Back-N window for
congestion control. The Selective Repeat window, on the other hand, tries
to send the specific packets that have been lost or corrupted.

c. Acknowledgment Policy
The acknowledgment policy imposed by the receiver may also affect
congestion. If the receiver does not acknowledge every packet it receives,
it may slow down the sender and help prevent congestion.
c. Implicit Signaling
d. Discarding Policy In implicit signaling, there is no communication between the congested
A good discarding policy by the routers may prevent congestion and at node or nodes and the source. The source guesses that there is congestion
the same time may not harm the integrity of the transmission. somewhere in the network from other symptoms.

e. Admission Policy d. Explicit Signaling


An admission policy, which is a quality-of-service mechanism, can also The node that experiences congestion can explicitly send a signal to the
prevent congestion in virtual-circuit networks. source or destination.

2. Closed-Loop Congestion Control i. Backward Signaling

Closed-loop congestion control mechanisms try to alleviate congestion A bit can be set in a packet moving in the direction opposite to the
after it happens. Several mechanisms have been used by different congestion. This bit can warn the source that there is congestion and that
protocols. it needs to slow down to avoid the discarding of packets.

a. Backpressure ii. Forward Signaling


Backpressure is a node-to-node congestion control that starts with a node
and propagates, in the opposite direction of data flow, to the source. A bit can be set in a packet moving in the direction of the congestion.
This bit can warn the destination that there is congestion. The receiver in
this case can use policies, such as slowing down the acknowledgments, to
alleviate the congestion.

Congestion control algorithms

Leaky Bucket Algorithm


b. Choke Packet
• It is a traffic shaping mechanism that controls the amount and the
A choke packet is a packet sent by a node to the source to inform it of
rate of the traffic sent to the network.
congestion.
• A leaky bucket algorithm shapes busty traffic into fixed rate
traffic by averaging the data rate.
• Imagine a bucket with a small hole at the bottom.

[Unit 3 Notes] By Prof. Narendra Kumar Page 29


• The same concept can be applied to packets in the network. Now, if the host wants to send busty data, it can consume all 10,000
Consider that data is coming from the source at variable speeds. tokens at once for sending 10,000 cells or bytes.
Suppose that a source sends data at 12 Mbps for 4 seconds. Then Thus a host can send busty data as long as bucket is not empty.
there is no data for 3 seconds. The source again transmits data at a
rate of 10 Mbps for 2 seconds. Thus, in a time span of 9 seconds,
68 Mb data has been transmitted.

If a leaky bucket algorithm is used, the data flow will be 8 Mbps for 9
seconds. Thus constant flow is maintained.

Token bucket Algorithm


• The leaky bucket algorithm allows only an average (constant) rate
of data flow. Its major problem is that it cannot deal with busty
data.
• A leaky bucket algorithm does not consider the idle time of the
host.
• A token bucket algorithm allows busty data transfers.
• A token bucket algorithm is a modification of leaky bucket in
which leaky bucket contains tokens.
• Token bucket algorithm allows idle hosts to accumulate credit for
the future in form of tokens.
• For example, if a system generates 100 tokens in one clock tick
and the host is idle for 100 ticks. The bucket will contain 10,000
tokens.

[Unit 3 Notes] By Prof. Narendra Kumar Page 30

You might also like