SlideShare a Scribd company logo
1 of 30
Download to read offline
[Unit 3 Notes] By Prof. Narendra Kumar Page 1
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.
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.
o Guaranteed delivery with bounded delay: This service guarantees that the
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
destination in the order in which they are sent.
o Guaranteed max jitter: This service ensures that the amount of time taken
between two successive transmissions at the sender is equal to the time
between their receipt at the destination.
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
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
such a way, the network layer maintains the data integrity and source
authentication services.
Point-to-Point Communication
A point-to-point communication is also known as P2P. In the
context of telecommunication, it is an established connection
between two nodes that may be used to communicate back and
forth. A basic telephone call, in which one phone is connected to
another, and both nodes can send and receive audio, is the most
common example of point-to-point communication.
These P2P connections were first established utilizing circuit-
switched landlines in the early days of telephony. However, point-
to-point communication in modern networks nowadays is made
possible by complex fibre-optic networks. P2P connections of
[Unit 3 Notes] By Prof. Narendra Kumar Page 2
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.
o In the above figure, a router has three interfaces labeled as 1, 2 & 3 and each
router interface contains its own IP 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)
specifies the host in the network.
Classful Addressing
An IP address is 32-bit long. An IP address is divided into sub-classes:
o Class A
o Class B
o Class C
o Class D
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.
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.
The total number of networks in Class A = 27
= 128 network address
The total number of hosts in Class A = 224
- 2 = 16,777,214 host address
Class B
In Class B, an IP address is assigned to those networks that range from small-sized to
large-sized networks.
o The Network ID is 16 bits long.
o The Host ID is 16 bits long.
In Class B, the higher order bits of the first octet is always set to 10, and the
remaining14 bits determine the network ID. The other 16 bits determine the Host ID.
The total number of networks in Class B = 214
= 16384 network address
The total number of hosts in Class B = 216
- 2 = 65534 host address
[Unit 3 Notes] By Prof. Narendra Kumar Page 3
Class C
In Class C, an IP address is assigned to only small-sized networks.
o The Network ID is 24 bits long.
o The host ID is 8 bits long.
In Class C, the higher order bits of the first octet is always set to 110, and the
remaining 21 bits determine the network ID. The 8 bits of the host ID determine the
host in a network.
The total number of networks = 221
= 2097152 network address
The total number of hosts = 28
- 2 = 254 host address
Class D
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
remaining bits determines the host ID in any network.
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.
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.
Rules for assigning Network ID:
If the hosts are located within the same local network, then they are assigned with the
same network ID. The following are the rules for assigning Network ID:
o The network ID cannot start with 127 as 127 is used by Class A.
o The Network ID in which all the bits are set to 0 cannot be assigned as it is
used to specify a particular host on the local network.
o The Network ID in which all the bits are set to 1 cannot be assigned as it is
reserved for the multicast address.
Classful Network Architecture
What is Subnetting?
Sub-netting is the practice of dividing a network into two or smaller
networks. It increases routing efficiency, which helps to enhance the
security of the network and reduces the size of the broadcast domain.
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.
Why Use Subnetting?
[Unit 3 Notes] By Prof. Narendra Kumar Page 4
Here are important reasons for using Subnetting:
 It helps you to maximize IP addressing efficiency.
 Extend the life of IPV4.
 Public IPV4 Addresses are scarce.
 IPV4 Subnetting reduces network traffic by eliminating collision
and broadcast traffic and thus improves overall performance.
 This method allows you to apply network security policies at the
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.
Two types of subnet masks are:
 The default Subnet Mask is the number of bits which is reserved by
the address class. Using this default mask will accommodate a
single network subnet in the relative class.
 A Custom Subnet Mask can be defined by an administrator
to accommodate many Network
How to Use a Subnet Mask?
The subnet mask is used by the router to cover up the network address. It
shows which bits are used to identify the subnet.
Every network has its own unique address, Like here, class B network has
network address 172.20.0.0, which has all zeroes in the host portion of the
address.
Example IP address: 11000001. Here 1st
and 2nd
bits are 1, and the 3rd
bit is
0; hence, it is class C.
Methods of Subnet Masking
We can subnet the masking process in two ways: Straight or Short-cut.
1) Straight
You should use the binary notation method for both the address and the
mask and then apply the AND operation to get the block address.
2) Short-Cut Method
 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 5
Class Higher bits NET ID bits HOST ID bits No.of
network
s
No.of hosts
per network
Range
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
Defined
Not Defined 224.0.0.0 to 239.255.255.255
E 1111 Not Defined Not Defined Not
Defined
Not Defined 240.0.0.0 to 255.255.255.255
[Unit 3 Notes] By Prof. Narendra Kumar Page 6
Class Default subnet mask
No. of
networks
No. of host
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-
In networking,
 The process of dividing a single network into multiple sub
networks is called as subnetting.
 The sub networks so created are called as subnets.
Example-
Following diagram shows the subnetting of a big single
network into 4 smaller subnets-
Advantages-
The two main advantages of subnetting a network are-
 It improves the security.
 The maintenance and administration of subnets is easy.
 Subnet ID-
 Each subnet has its unique network address known as
its Subnet ID.
 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-
1. Fixed Length Subnetting
2. Variable Length Subnetting
1. Fixed Length Subnetting-
Fixed length subnetting also called as classful subnetting divides the
network into subnets where-
• All the subnets are of same size.
• 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.
Subnetting Examples-
Now, we shall discuss some examples of subnetting a network-
Example-01:
Consider-
• We have a big single network having IP Address 200.1.2.0.
• We want to do subnetting and divide this network into 2 subnets.
Clearly, the given network belongs to class C.
[Unit 3 Notes] By Prof. Narendra Kumar Page 7
For creating two subnets and to represent their subnet IDs, we require 1
bit. So,
 We borrow one bit from the Host ID part.
 After borrowing one bit, Host ID part remains with only 7 bits.
 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 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-
• IP Address of the subnet = 200.1.2.128
• 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.10000000, 200.1.2.11111111] =
[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.
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.
 If borrowed bits = 00, then it represents the 1st subnet.
 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 8
 If borrowed bits = 11, then it represents the 4th subnet.
 IP Address of the four subnets are-
 200.1.2.00000000 = 200.1.2.0
 200.1.2.01000000 = 200.1.2.64
 200.1.2.10000000 = 200.1.2.128
 200.1.2.11000000 = 200.1.2.192
For 1st Subnet-
 IP Address of the subnet = 200.1.2.0
 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.00000000, 200.1.2.00111111] =
[200.1.2.0, 200.1.2.63]
 Direct Broadcast Address = 200.1.2.00111111 = 200.1.2.63
 Limited Broadcast Address = 255.255.255.255
For 2nd Subnet-
 IP Address of the subnet = 200.1.2.64
 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.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-
 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
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
Example-03:
Consider-
 We have a big single network having IP Address 200.1.2.0.
 We want to do subnetting and divide this network into 3 subnets.
Here, the subnetting will be performed in two steps-
1. Dividing the given network into 2 subnets
2. Dividing one of the subnets further into 2 subnets
Step-01: Dividing Given Network into 2 Subnets-
The subnetting will be performed exactly in the same way as performed in
Example-01.
After subnetting, we have-
[Unit 3 Notes] By Prof. Narendra Kumar Page 9
Step-02: Dividing One Subnet into 2 Subnets-
 We perform the subnetting of one of the subnets further into 2
subnets.
 Consider we want to do subnetting of the 2nd subnet having IP
Address 200.1.2.128.
 For creating two subnets and to represent their subnet IDs, we
require 1 bit. So,
 We borrow one more bit from the Host ID part.
 After borrowing one bit, Host ID part remains with only 6 bits.
 If 2nd borrowed bit = 0, then it represents one subnet.
 If 2nd borrowed bit = 1, then it represents the other subnet.
IP Address of the two subnets are-
 200.1.2.10000000 = 200.1.2.128
 200.1.2.11000000 = 200.1.2.192
Finally, the given single network is divided into 3 subnets having IP
Address-
 200.1.2.0
 200.1.2.128
 200.1.2.192
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-
 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
For 3rd 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
Point-01:
Subnetting leads to loss of IP Addresses.
During subnetting,
 We have to face a loss of IP Addresses.
 This is because two IP Addresses are wasted for each subnet.
 One IP address is wasted for its network address.
 Other IP Address is wasted for its direct broadcasting address.
Point-02: Subnetting leads to complicated communication process.
[Unit 3 Notes] By Prof. Narendra Kumar Page 10
After subnetting, the communication process becomes complex involving
the following 4 steps-
1. Identifying the network
2. Identifying the sub network
3. Identifying the host
4. Identifying the process
PRACTICE PROBLEMS BASED ON SUBNETTING IN
NETWORKING-
Problem-01:
Suppose a network with IP Address 192.16.0.0. is divided into 2 subnets,
find number of hosts per subnet.
Also for the first subnet, find-
1. Subnet Address
2. First Host ID
3. Last Host ID
4. Broadcast Address
Solution-
 Given IP Address belongs to class C.
 So, 24 bits are reserved for the Net ID.
 The given network is divided into 2 subnets.
 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 =
172.16.0.127
Problem-03:
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
2. 4094
3. 4092
4. 4090
Solution-
 Number of bits reserved for network ID in the given subnet mask =
20.
 So, Number of bits reserved for Host ID = 32 – 20 = 12 bits.
 Thus, Number of hosts per subnet = 212
– 2 = 4094.
 In class B, 16 bits are reserved for the network.
 So, Number of bits reserved for subnet ID = 20 – 16 = 4 bits.
 Number of subnets possible = 24
= 16.
 Thus, Option (B) is correct.
To gain better understanding about IPv4 Subnetting,
IP Subnetting
As we talked about before, there are two parts in an IP Address. One for
them is Network part and the another is Host part. With IP Subnetting,
we are adding one more part. This is “Subnet Part”. From the Host part,
we borrow some bits and we will use this part for Subnet. In this lesson,
we will learn Subnetting with Subnetting Examples.
As a basic definion, Subnetting is dividing the network into smaller
network groups and by doing this, using the IP Address Block more
efficient.
[Unit 3 Notes] By Prof. Narendra Kumar Page 11
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
addresses that improves the efficiency of address distribution and replaces
the previous system based on Class A, Class B and Class C networks.
The CIDR number is typically preceded by a slash “/” and follows the IP
address. For example, an IP address of 131.10. 55.70 with a subnet mask
of 255.0. 0.0 (which has 8 network bits) would be represented as 131.10.
What is a CIDR of 24?
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
means that the first 24 bits of the IP address are reserved for network
routing.
What is 255.255 255.0 CIDR?
The subnet mask 255.255. 255.0 translates to /24 in CIDR-speak, as 24
bits are used for the network. That leaves 8 bits / 256 IPs for nodes.
In CIDR notation, IP addresses are written as a prefix, and a suffix is
attached to indicate how many bits are in the entire address. The suffix is
set apart from the prefix with a slash mark. For instance, in the CIDR
notation 192.0. 1.0/24, the prefix or IP address is 192.0.
CIDR is used on the addresses that will advertise to the internet. So, it is
used in the Internet Service Provider part. VLSM is used in a company or
in smaller networks to use IP address spaces ideally.
VLSM (Variable Length Subnet Mask) is the term that is used for using
different Subnet Mask for different sun networks. In other words, it is the
mechanism that allows different Subnet Masks and provide division of a
network into sub networks. It is like Subnet of subnets.
Special Subnets
In Subnetting some Subnet Masks are used specifically sometimes. These
are /24, /30, /31/ and /32.
• /24 is the Subnet Mask that is usually used in the local networks by
default.
• /32 is the Subnet Mask used generally on Loopback and System
interfaces.
• /31 is the Subnet Mask used on point-to-point links.
• /30 is also widely used in Service Provider Networks for point-to-
point connections.
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 12
“always up and never physically down” characteristics generally. We give
these Loopback Interfaces a /32 Loopback IP address.
IP Subnetting Examples: Example 1
In the first one of the Subnetting Examples, we will use, 192.168.5.85
/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 : 192.168.5.85
Subnet Mask : 255.255.255.0
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
the number of bits that network part has. And the 0s will show the host
part bits.
IP Address : 11000000. 10101000.00000101.01010101
Subnet Mask : 11111111. 11111111. 11111111.00000000
So, here, the first 24 bits (First 3 octets) are network bits and the last 8
bits (Last octet) are the host bits.
For this IP and Subnet Mask, to determine the Network Address of this IP
address, we will use “AND” operation between IP Address and Subnet
Mask in binary mode.
IP Add: 11000000. 10101000.00000101.01010101
SubM : 11111111. 11111111. 11111111.00000000
AND : 11000000. 10101000.00000101.00000000
When we use AND operation with this binary numbers, as you can see,
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
will be same as IP address and the last octet will be full of 0s.
For this example our broadcast address will be 192.168.5.255. AS you can
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
addresses.
IP Subnetting Examples: Example 2
In the second one of Subnetting Examples, we will do a little more
complex example. This time our IP address will be 10.128.240.50/30.
IP Address : 10.128.240.50
Sunet Mask : 255.255.255.252
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.
/30 means that the subnet mask has 30 bits 1s and 2 bits 0s. Remember
the total Subnet Mask is 32 bits. So in binary mode our Subnet Mask is:
11111111.11111111.11111111.11111100 (First 30 bits are 1s and 2 bits
are 0s)
And the decimal equal of this Subnet Mask is : 255.255.255.252
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
the binary equals of IP address and Subnet and use AND again.
IP Add : 00001010.10000000.11110000.00110010
SubM : 11111111.11111111.11111111.11111100
AND : 00001010.10000000.11110000.00110000
The result of AND operation is the Network Address. This
is 00001010.10000000.11110000.00110000 in binary. The decimal value
of this is 10.128.240.48.
Here, the last two bits are host bits and the other bits are network bits.
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
value is 10.128.240.51.
The middle addresses can be used for hosts. These addresses
are 10.128.240.49 and 10.128.240.50.
[Unit 3 Notes] By Prof. Narendra Kumar Page 13
Network Address : 10.128.240.48
Host Addresses : 10.128.240.49 and 10.128.240.50
Broadcast Address : 10.128.240.51
/30 addresses are generally used in Service Provider Networks. So, you
can work with /30 too much in the future.
Subnetting Example 3
Think about 172.16.100.0/24 prefix and 172.16.100.0/28 prefix. As you
can see, the only difference is Subnet Mask. In the first prefix, first 24 bits
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
bits.
Let’s firstly talk about the first Prefix. We will write the IP Address and
the Subnet Mask of this Prefix in binary format:
172.16.100.0 = 10101100.00010000.01100100.00000000
255.255.255.0 =11111111.11111111.11111111.00000000
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 .
And the Broadcast address is 172.16.100.255. The other 254 IP addresses
are host IP addresses.
172.16.100.1
172.16.100.2
….
172.16.100.254
For the first prefix, we have only one network that has 254 hosts.
Now, let’s check the second prefix. 172.16.100.0 /28.
172.16.100.0 = 10101100.00010000.01100100.00000000
255.255.255.240 =11111111.11111111.11111111.11110000
When we use AND operation here, our network address will be the same,
in binary 10101100.00010000.01100100.00000000 or in decimal
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
(172.16.100.15)
This is for the first network. We divide the network by using higher
Subnet Mask. So, let’s look at the other networks:
10101100.00010000.01100100.00010000
10101100.00010000.01100100.00100000
10101100.00010000.01100100.00110000
10101100.00010000.01100100.01000000
….
10101100.00010000.01100100.11110000
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.
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
can divide the network into smaller pieces. So, we will not waste the IP
Addresses. Smaller networks that has few hosts do not need more
addresses.
Internet Protocol address(IP)
IP address stands for “Internet Protocol address.” The Internet Protocol is
a set of rules for communication over the internet, such as sending mail,
streaming video, or connecting to a website. An IP address identifies a
network or device on the internet.
[Unit 3 Notes] By Prof. Narendra Kumar Page 14
Address Resolution Protocol (ARP) and
its types
Address Resolution Protocol (ARP) is a communication protocol used to
find the MAC (Media Access Control) address of a device from its IP
address. This protocol is used when a device wants to communicate with
another device on a Local Area Network or Ethernet.
Types of ARP
There are four types of Address Resolution Protocol, which is given
below:
o Proxy ARP
o Gratuitous ARP
o Reverse ARP (RARP)
o Inverse ARP
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
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.
Example - If Host A wants to transmit data to Host B, which is on the
different network, then Host A sends an ARP request message to receive a
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
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.
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.
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
ARP gateway router table. A table is created by the network administrator
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 15
Steps taken by ARP protocol
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
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 ARP cache is empty, then device broadcast the message to the entire
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.
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
address association by using the ARP command utility.
RARP
o RARP stands for Reverse Address Resolution Protocol.
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
encapsulated in the data portion of a frame.
[Unit 3 Notes] By Prof. Narendra Kumar Page 16
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
report the error but not to correct them.
o An IP datagram contains the addresses of both source and destination, but it
does not know the address of the previous router through which it has been
passed. Due to this reason, ICMP can only send the messages to the source,
but not to the immediate routers.
o ICMP protocol communicates the error messages to the sender. ICMP
messages cause the errors to be returned back to the user processes.
o ICMP messages are transmitted within IP datagram.
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:
o Destination unreachable: The message of "Destination Unreachable" is
sent from receiver to the sender when destination cannot be reached, or
packet is discarded when the destination is not reachable.
o Source Quench: The purpose of the source quench message is congestion
control. The message sent from the congested router to the source host to
reduce the transmission rate. ICMP will take the IP of the discarded packet
and then add the source quench message to the IP datagram to inform the
source host to reduce its transmission rate. The source host will reduce the
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 17
Sometimes packet discarded due to some bad routing implementation, and this
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
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
sends the "Redirection message" to the host to update its routing table.
IGMP
o IGMP stands for Internet Group Message Protocol.
o The IP protocol supports two types of communication:
o Unicasting: It is a communication between one sender and one
receiver. Therefore, we can say that it is one-to-one
communication.
o Multicasting: Sometimes the sender wants to send the same
message to a large number of receivers simultaneously. This
process is known as multicasting which has one-to-many
communication.
o The IGMP protocol is used by the hosts and router to support multicasting.
o The IGMP protocol is used by the hosts and router to identify the hosts in a
LAN that are the members of a group.
o IGMP is a part of the IP layer, and IGMP has a fixed-size message.
o The IGMP message is encapsulated within an IP datagram.
The Format of IGMP message
Where,
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
message. It determines the maximum time the host can send the Membership Report
message in response to the Membership Query message.
Checksum: It determines the entire payload of the IP datagram in which IGMP
message is encapsulated.
Group Address: The behavior of this field depends on the type of the message sent.
o For Membership Query, the group address is set to zero for General Query
and set to multicast group address for a specific query.
o For Membership Report, the group address is set to the multicast group
address.
o For Leave Group, it is set to the multicast group address.
IGMP Messages
o Membership Query message
[Unit 3 Notes] By Prof. Narendra Kumar Page 18
o This message is sent by a router to all hosts on a local area network
to determine the set of all the multicast groups that have been
joined by the host.
o It also determines whether a specific multicast group has been
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
members on that host.
o Membership Report message
o The host responds to the membership query message with a
membership report message.
o Membership report messages can also be generated by the host
when a host wants to join the multicast group without waiting for a
membership query message from the router.
o Membership report messages are received by a router as well as all
the hosts on an attached interface.
o Each membership report message includes the multicast address of
a single group that the host wants to join.
o IGMP protocol does not care which host has joined the group or
how many hosts are present in a single group. It only cares whether
one or more attached hosts belong to a single multicast group.
o The membership Query message sent by a router also includes a
"Maximum Response time". After receiving a membership query
message and before sending the membership report message, the
host waits for the random amount of time from 0 to the maximum
response time. If a host observes that some other attached host has
sent the "Maximum Report message", then it discards its
"Maximum Report message" as it knows that the attached router
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
transmission of a "Membership Report message".
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
o A router is a networking device that forwards the packet based on the
information available in the packet header and forwarding table.
o The routing algorithm initializes and maintains the routing table for the
process of path determination.
Routing Metrics and Costs
Routing metrics and costs are used for determining the best route to the destination.
The factors used by the protocols to determine the shortest path, these factors are
known as a metric.
The most common metric values are given below:
o Hop count: Hop count is defined as a metric that specifies the number of
passes through internetworking devices such as a router, a packet must
travel in a route to move from source to the destination.
o Delay: It is a time taken by the router to process, queue and transmit a
datagram to an interface. The protocols use this metric to determine the
delay values for all the links along the path end-to-end. The path having the
lowest delay value will be considered as the best path.
o Bandwidth: The capacity of the link is known as a bandwidth of the link.
The bandwidth is measured in terms of bits per second.
o Load: Load refers to the degree to which the network resource such as a
router or network link is busy. A Load can be calculated in a variety of
ways such as CPU utilization, packets processed per second.
o Reliability: Reliability is a metric factor may be composed of a fixed value.
It depends on the network links, and its value is measured dynamically.
Some networks go down more often than others. After network failure,
some network links repaired more easily than other network links.
Types of Routing
Routing can be classified into three categories:
[Unit 3 Notes] By Prof. Narendra Kumar Page 19
Static Routing
o Static Routing is also known as Non adaptive Routing.
o It is a technique in which the administrator manually adds the routes in a
routing table.
o A Router can send the packets for the destination along the route defined by
the administrator.
o In this technique, routing decisions are not made based on the condition or
topology of the networks
Advantages Of Static Routing
Following are the advantages of Static Routing:
o No Overhead: It has ho overhead on the CPU usage of the router.
Therefore, the cheaper router can be used to obtain static routing.
o Bandwidth: It has not bandwidth usage between the routers.
o Security: It provides security as the system administrator is allowed only to
have control over the routing to a particular network.
Default Routing
o Default Routing is a technique in which a router is configured to send all the
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.
o Default Routing is used when networks deal with the single exit point.
o It is also useful when the bulk of transmission networks have to transmit the
data to the same hp device.
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.
The Dynamic protocol should have the following features:
o All the routers must have the same dynamic routing protocol in order to
exchange the routes.
o If the router discovers any change in the condition or topology, then router
broadcast this information to all other routers.
Advantages of Dynamic Routing:
o It is easier to configure.
o It is more effective in selecting the best route in response to the changes in
the condition or topology.
Routing algorithm
o In order to transfer the packets from source to the destination, the network
layer must determine the best route through which packets can be
transmitted.
o Whether the network layer provides datagram service or virtual circuit
service, the main job of the network layer is to provide the best route. The
routing protocol provides this job.
o The routing protocol is a routing algorithm that provides the best path from
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
destination but the best route to send the packets is determined by the
routing algorithm.
Classification of a Routing algorithm
The Routing algorithm is divided into two categories:
o Adaptive Routing algorithm
o Non-adaptive Routing algorithm
Adaptive Routing algorithm
o An adaptive routing algorithm is also known as dynamic routing algorithm.
o This algorithm makes the routing decisions based on the topology and
network traffic.
o The main parameters related to this algorithm are hop count, distance and
estimated transit time.
[Unit 3 Notes] By Prof. Narendra Kumar Page 20
An adaptive routing algorithm can be classified into three parts:
o Centralized algorithm: It is also known as global routing algorithm as it
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
is obtained before actually performing any calculation.
o Link state algorithm is referred to as a centralized algorithm since it is
aware of the cost of each link in the network.
o Isolation algorithm: It is an algorithm that obtains the routing information
by using local information rather than gathering information from other
nodes.
o Distributed algorithm: It is also known as decentralized algorithm as it
computes the least-cost path between source and destination in an iterative
and distributed manner. In the decentralized algorithm, no node has the
knowledge about the cost of all the network links.
Non-Adaptive Routing algorithm
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.
The Non-Adaptive Routing algorithm is of two types:
Flooding: In case of flooding, every incoming packet is sent to all the outgoing links
except the one from it has been reached. The disadvantage of flooding is that node
may contain several copies of a particular packet.
Random walks: In case of random walks, a packet sent by the node to one of its
neighbors randomly. An advantage of using random walks is that it uses the
alternative routes very efficiently.
Differences b/w Adaptive and Non-Adaptive Routing
Algorithm
Basis Of
Comparison
Adaptive Routing
algorithm
Non-Adaptive
Routing algorithm
Define Adaptive Routing
algorithm is an
algorithm that
constructs the routing
table based on the
network conditions.
The Non-Adaptive Routing
algorithm is an algorithm
that constructs the static
table to determine which
node to send the packet.
Usage Adaptive routing
algorithm is used by
dynamic routing.
The Non-Adaptive Routing
algorithm is used by static
routing.
Routing
decision
Routing decisions are
made based on
topology and network
traffic.
Routing decisions are the
static tables.
Categorization The types of adaptive
routing algorithm, are
Centralized, isolation
and distributed
algorithm.
The types of Non Adaptive
routing algorithm are
flooding and random
walks.
Complexity Adaptive Routing
algorithms are more
complex.
Non-Adaptive Routing
algorithms are simple.
Distance Vector Routing Algorithm
o The Distance vector algorithm is iterative, asynchronous and
distributed.
o Distributed: It is distributed in that each node receives information
from one or more of its directly attached neighbors, performs
calculation and then distributes the result back to its neighbors.
o Iterative: It is iterative in that its process continues until no more
information is available to be exchanged between neighbors.
o Asynchronous: It does not require that all of its nodes operate in
the lock step with each other.
o The Distance vector algorithm is a dynamic algorithm.
o It is mainly used in ARPANET, and RIP.
o Each router maintains a distance table known as Vector.
Three Keys to understand the working of
Distance Vector Routing Algorithm:
o Knowledge about the whole network: Each router shares its knowledge
through the entire network. The Router sends its collected knowledge about
the network to its neighbors.
o Routing only to neighbors: The router sends its knowledge about the
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 21
received by the router and uses the information to update its own routing
table.
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 The distance vector x, i.e., Dx = [ Dx(y) : y in N ], containing its cost to all
destinations, y, in N.
o The distance vector of each of its neighbors, i.e., Dv = [ Dv(y) : y in N ] for
each neighbor v of x.
Distance vector routing is an asynchronous algorithm in which node x sends the
copy of its distance vector to all its neighbors. When node x receives the new
distance vector from one of its neighboring vector, v, it saves the distance vector of
v and uses the Bellman-Ford equation to update its own distance vector. The
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
loop
wait(until I receive any distance vector from some neighbor w)
for each y in N:
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
Sharing Information
o In the above figure, each cloud represents the network, and the number
inside the cloud represents the network ID.
o All the LANs are connected by routers, and they are represented in boxes
labeled as A, B, C, D, E, F.
o Distance vector routing algorithm simplifies the routing process by
assuming the cost of every link is one unit. Therefore, the efficiency of
transmission can be measured by the number of links to reach the
destination.
o In Distance vector routing, the cost is based on hop count.
In the above figure, we observe that the router sends the knowledge to the immediate
neighbors. The neighbors add this knowledge to their own knowledge and sends the
updated table to their own neighbors. In this way, routers get its own information
plus the new information about the neighbors.
[Unit 3 Notes] By Prof. Narendra Kumar Page 22
Routing Table
Two process occurs:
o Creating the Table
o Updating the Table
Creating the Table
Initially, the routing table is created for each router that contains atleast three types
of information such as Network ID, the cost and the next hop.
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 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.
5. E sends its routing table to A & D.
6. F sends its routing table to A.
Updating the Table
o When A receives a routing table from B, then it uses its information to
update the table.
o The routing table of B shows how the packets can move to the networks 1
and 4.
o The B is a neighbor to the A router, the packets from A to B can reach in
one hop. So, 1 is added to all the costs given in the B's table and the sum
will be the cost to reach a particular network.
o After adjustment, A then combines this table with its own table to create a
combined table.
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 The process of creating the routing table continues for all routers. Every
router receives the information from the neighbors, and update the routing
table.
Final routing tables of all the routers are given below:
[Unit 3 Notes] By Prof. Narendra Kumar Page 23
Link State Routing
Link state routing is a technique in which each router shares the knowledge of its
neighborhood with every other router in the internetwork.
The three keys to understand the Link State Routing algorithm:
o Knowledge about the neighborhood: Instead of sending its routing table, a
router sends the information about its neighborhood only. A router
broadcast its identities and cost of the directly attached links to other
routers.
o Flooding: Each router sends the information to every other router on the
internetwork except its neighbors. This process is known as Flooding. Every
router that receives the packet sends the copies to all its neighbors. Finally,
each and every router receives a copy of the same information.
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.
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.
for all nodes v
if v adjacent to A
then D(v) = c(A,v)
else D(v) = infinity
loop
find w not in N such that D(w) is a minimum.
Add w to N
Update D(v) for all v adjacent to w and not in N:
D(v) = min(D(v) , D(w) + c(w,v))
Until all nodes in N
In the above algorithm, an initialization step is followed by the loop. The number of
times the loop is executed is equal to the total number of nodes available in the
network.
Let's understand through an example:
[Unit 3 Notes] By Prof. Narendra Kumar Page 24
In the above figure, source vertex is A.
Step 1:
The first step is an initialization step. The currently known least cost path from A to
its directly attached neighbors, B, C, D are 2,5,1 respectively. The cost from A to B
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
and F are set to infinity as they are not directly linked to A.
Step 2:
In the above table, we observe that vertex D contains the least cost path in step 1.
Therefore, it is added in N. Now, we need to determine a least-cost path through D
vertex.
a) Calculating shortest path from A to B
1. v = B, w = D
2. D(B) = min( D(B) , D(D) + c(D,B) )
3. = min( 2, 1+2)>
4. = min( 2, 3)
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
1. v = C, w = D
2. D(B) = min( D(C) , D(D) + c(D,C) )
3. = min( 5, 1+3)
4. = min( 5, 4)
5. The minimum value is 4. Therefore, the currently shortest path from A to C is 4.</p>
c) Calculating shortest path from A to E
1. v = E, w = D
2. D(B) = min( D(E) , D(D) + c(D,E) )
3. = min( ∞, 1+1)
4. = min(∞, 2)
5. The minimum value is 2. Therefore, the currently shortest path from A to E is 2.
Note: The vertex D has no direct link to vertex E. Therefore, the value of
D(F) is infinity.
Step 3:
In the above table, we observe that both E and B have the least cost path in step 2.
Let's consider the E vertex. Now, we determine the least cost path of remaining
vertices through E.
a) Calculating the shortest path from A to B.
1. v = B, w = E
2. D(B) = min( D(B) , D(E) + c(E,B) )
3. = min( 2 , 2+ ∞ )
4. = min( 2, ∞)
5. The minimum value is 2. Therefore, the currently shortest path from A to B is 2.
b) Calculating the shortest path from A to C.
1. v = C, w = E
2. D(B) = min( D(C) , D(E) + c(E,C) )
3. = min( 4 , 2+1 )
4. = min( 4,3)
5. The minimum value is 3. Therefore, the currently shortest path from A to C is 3.
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) )
3. = min( ∞ , 2+2 )
4. = min(∞ ,4)
5. The minimum value is 4. Therefore, the currently shortest path from A to F is 4.
Step N D(B),P(
B)
D(C),P(
C)
D(D),P
(D)
D(E),
P(E)
D(F),
P(F)
1 A 2,A 5,A 1,A ∞ ∞
2 A
D
2,A 4,D 2,D ∞
3 A
D
E
2,A 3,E 4,E
Step 4:
In the above table, we observe that B vertex has the least cost path in step 3.
Therefore, it is added in N. Now, we determine the least cost path of remaining
vertices through B.
a) Calculating the shortest path from A to C.
1. v = C, w = B
2. D(B) = min( D(C) , D(B) + c(B,C) )
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.
b) Calculating the shortest path from A to F.
1. v = F, w = B
2. D(B) = min( D(F) , D(B) + c(B,F) )
3. = min( 4, ∞)
4. = min(4, ∞)
5. The minimum value is 4. Therefore, the currently shortest path from A to F is 4.
Step N D(B),P(
B)
D(C),P
(C)
D(D),P(D
)
D(E
),P(
D(
F),
[Unit 3 Notes] By Prof. Narendra Kumar Page 25
E) P(
F)
1 A 2,A 5,A 1,A ∞ ∞
2 AD 2,A 4,D 2,
D
∞
3 AD
E
2,A 3,E 4,
E
4 AD
EB
3,E 4,
E
Step 5:
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
vertices through C.
a) Calculating the shortest path from A to F.
1. v = F, w = C
2. D(B) = min( D(F) , D(C) + c(C,F) )
3. = min( 4, 3+5)
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),
P(B)
D(C),
P(C)
D(D),
P(D)
D(E),
P(E)
D(F),P
(F)
1 A 2,A 5,A 1,A ∞ ∞
2 AD 2,A 4,D 2,D ∞
3 ADE 2,A 3,E 4,E
4 ADE
B
3,E 4,E
5 ADE
BC
4,E
Final table:
Step N D(B),
P(B)
D(C),
P(C)
D(D),P(
D)
D(E),
P(E)
D(F)
,P(F
)
1 A 2,A 5,A 1,A ∞ ∞
2 AD 2,A 4,D 2,D ∞
3 ADE 2,A 3,E 4,E
4 ADEB 3,E 4,E
5 ADEBC 4,E
6 ADEBC
F
Disadvantage:
Heavy traffic is created in Line state routing due to Flooding. Flooding can cause an
infinite looping, this problem can be solved by using Time-to-leave field
IPv4 - Packet Structure
Internet Protocol being a layer-3 protocol (OSI) takes data Segments
from layer-4 (Transport) and divides it into packets. IP packet
encapsulates data unit received from above layer and add to its own
header information.
The encapsulated data is referred to as IP Payload. IP header contains all
the necessary information to deliver the packet at the other end.
[Unit 3 Notes] By Prof. Narendra Kumar Page 26
IP header includes many relevant information including Version
Number, which, in this context, is 4. Other details are as follows −
 Version − Version no. of Internet Protocol used (e.g. IPv4).
 IHL − Internet Header Length; Length of entire IP header.
 DSCP − Differentiated Services Code Point; this is Type of
Service.
 ECN − Explicit Congestion Notification; It carries information
about the congestion seen in the route.
 Total Length − Length of entire IP Packet (including IP header
and IP Payload).
 Identification − If IP packet is fragmented during the
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
sent with some TTL value set, which tells the network how many
routers (hops) this packet can cross. At each hop, its value is
decremented by one and when the value reaches zero, the packet
is discarded.
 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.
 Options − This is optional field, which is used if the value of IHL
is greater than 5. These options may contain values for options
such as Security, Record Route, Time Stamp, etc.
IPV6 Address Structure
An IPv6 address is made of 128 bits divided into eight 16-bits blocks.
Each block is then converted into 4-digit Hexadecimal numbers
separated by colon symbols.
Fixed Header
IPv6 fixed header is 40 bytes long and contains the following
information.
[Unit 3 Notes] By Prof. Narendra Kumar Page 27
S.N. Field & Description
1
Version (4-bits): It represents the version of Internet
Protocol, i.e. 0110.
2
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).
3
Flow Label (20-bits): This label is used to maintain the
sequential flow of the packets belonging to a communication.
The source labels the sequence to help the router identify that
a particular packet belongs to a specific flow of information.
This field helps avoid re-ordering of data packets. It is
designed for streaming/real-time media.
4
Payload Length (16-bits): This field is used to tell the
routers how much information a particular packet contains in
its payload. Payload is composed of Extension Headers and
Upper Layer data. With 16 bits, up to 65535 bytes can be
indicated; but if the Extension Headers contain Hop-by-Hop
Extension Header, then the payload may exceed 65535 bytes
and this field is set to 0.
5
Next Header (8-bits): This field is used to indicate either the
type of Extension Header, or if the Extension Header is not
present then it indicates the Upper Layer PDU. The values
for the type of Upper Layer PDU are same as IPv4’s.
6
Hop Limit (8-bits): This field is used to stop packet to loop
in the network infinitely. This is same as TTL in IPv4. The
value of Hop Limit field is decremented by 1 as it passes a
link (router/hop). When the field reaches 0 the packet is
discarded.
7
Source Address (128-bits): This field indicates the address
of originator of the packet.
8
Destination Address (128-bits): This field provides the
address of intended recipient of the packet.
Ipv4 Ipv6
Address length IPv4 is a 32-bit
address.
IPv6 is a 128-bit address.
Fields IPv4 is a numeric
address that consists
of 4 fields which are
separated by dot (.).
IPv6 is an alphanumeric
address that consists of 8
fields, which are
separated by colon.
Classes IPv4 has 5 different
classes of IP address
that includes Class A,
Class B, Class C,
Class D, and Class E.
IPv6 does not contain
classes of IP addresses.
Number of IP
address
IPv4 has a limited
number of IP
addresses.
IPv6 has a large number
of IP addresses.
VLSM It supports VLSM
(Virtual Length
Subnet Mask). Here,
VLSM means that
Ipv4 converts IP
addresses into a
subnet of different
sizes.
It does not support
VLSM.
Address
configuration
It supports manual
and DHCP
configuration.
It supports manual,
DHCP, auto-
configuration, and
[Unit 3 Notes] By Prof. Narendra Kumar Page 28
renumbering.
Address space It generates 4 billion
unique addresses
It generates 340
undecillion unique
addresses.
End-to-end
connection
integrity
In IPv4, end-to-end
connection integrity is
unachievable.
In the case of IPv6, end-
to-end connection
integrity is achievable.
Security
features
In IPv4, security
depends on the
application. This IP
address is not
developed in keeping
the security feature in
mind.
In IPv6, IPSEC is
developed for security
purposes.
Address
representation
In IPv4, the IP
address is represented
in decimal.
In IPv6, the
representation of the IP
address in hexadecimal.
Fragmentation Fragmentation is done
by the senders and the
forwarding routers.
Fragmentation is done by
the senders only.
Packet flow
identification
It does not provide
any mechanism for
packet flow
identification.
It uses flow label field in
the header for the packet
flow identification.
Checksum field The checksum field is
available in IPv4.
The checksum field is
not available in IPv6.
Transmission
scheme
IPv4 is broadcasting. On the other hand, IPv6
is multicasting, which
provides efficient
network operations.
Encryption and
Authentication
It does not provide
encryption and
authentication.
It provides encryption
and authentication.
Number of It consists of 4 octets. It consists of 8 fields, and
octets each field contains 2
octets. Therefore, the
total number of octets in
IPv6 is 16.
Congestion Control
Congestion control refers to techniques and mechanisms that can either
prevent congestion, before it happens, or remove congestion, after it has
happened.
We can divide congestion control mechanisms into two broad categories:
open-loop congestion control (prevention) and closed-loop congestion
control (removal)
1. Open-Loop Congestion Control
In open-loop congestion control, policies are applied to prevent
congestion before it happens. In these mechanisms, congestion control is
handled by either the source or the destination.
a. Retransmission Policy
Retransmission is sometimes unavoidable. If the sender feels that a sent
packet is lost or corrupted, the packet needs to be retransmitted.
b. Window Policy
[Unit 3 Notes] By Prof. Narendra Kumar Page 29
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.
d. Discarding Policy
A good discarding policy by the routers may prevent congestion and at
the same time may not harm the integrity of the transmission.
e. Admission Policy
An admission policy, which is a quality-of-service mechanism, can also
prevent congestion in virtual-circuit networks.
2. Closed-Loop Congestion Control
Closed-loop congestion control mechanisms try to alleviate congestion
after it happens. Several mechanisms have been used by different
protocols.
a. Backpressure
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.
b. Choke Packet
A choke packet is a packet sent by a node to the source to inform it of
congestion.
c. Implicit Signaling
In implicit signaling, there is no communication between the congested
node or nodes and the source. The source guesses that there is congestion
somewhere in the network from other symptoms.
d. Explicit Signaling
The node that experiences congestion can explicitly send a signal to the
source or destination.
i. Backward Signaling
A bit can be set in a packet moving in the direction opposite to the
congestion. This bit can warn the source that there is congestion and that
it needs to slow down to avoid the discarding of packets.
ii. Forward Signaling
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
• It is a traffic shaping mechanism that controls the amount and the
rate of the traffic sent to the network.
• 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 30
• The same concept can be applied to packets in the network.
Consider that data is coming from the source at variable speeds.
Suppose that a source sends data at 12 Mbps for 4 seconds. Then
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.
Now, if the host wants to send busty data, it can consume all 10,000
tokens at once for sending 10,000 cells or bytes.
Thus a host can send busty data as long as bucket is not empty.

More Related Content

What's hot

What's hot (20)

IEEE standards 802.3.&802.11
IEEE standards 802.3.&802.11IEEE standards 802.3.&802.11
IEEE standards 802.3.&802.11
 
Simple mail transfer protocol
Simple mail transfer protocolSimple mail transfer protocol
Simple mail transfer protocol
 
Data Communication Basics
Data Communication BasicsData Communication Basics
Data Communication Basics
 
Rajesh basics of networking and routing
Rajesh basics of networking and routingRajesh basics of networking and routing
Rajesh basics of networking and routing
 
Signaling system 7 (ss7)
Signaling system 7 (ss7)Signaling system 7 (ss7)
Signaling system 7 (ss7)
 
Chap03 gmm prot_03_kh
Chap03 gmm prot_03_khChap03 gmm prot_03_kh
Chap03 gmm prot_03_kh
 
Presentación pop3
Presentación pop3Presentación pop3
Presentación pop3
 
UMTS Protocols
UMTS ProtocolsUMTS Protocols
UMTS Protocols
 
data communication
data communicationdata communication
data communication
 
High-level architecture of Mobile Cellular Networks from 2G to 5G
High-level architecture of Mobile Cellular Networks from 2G to 5GHigh-level architecture of Mobile Cellular Networks from 2G to 5G
High-level architecture of Mobile Cellular Networks from 2G to 5G
 
OSI Layers
OSI LayersOSI Layers
OSI Layers
 
Application layer
Application layerApplication layer
Application layer
 
DHCP
DHCPDHCP
DHCP
 
Handover parameters in_lte
Handover parameters in_lteHandover parameters in_lte
Handover parameters in_lte
 
Mobile ip presentation
Mobile ip presentationMobile ip presentation
Mobile ip presentation
 
Data communication
Data communicationData communication
Data communication
 
Ethernet
EthernetEthernet
Ethernet
 
Presentación POP3
Presentación POP3Presentación POP3
Presentación POP3
 
GSM Air Interface
GSM Air Interface GSM Air Interface
GSM Air Interface
 
Network Monitoring Basics
Network Monitoring BasicsNetwork Monitoring Basics
Network Monitoring Basics
 

Similar to AKTU Computer Networks notes --- Unit 3.pdf

https://diplomasolutionstudents.blogspot.com/
https://diplomasolutionstudents.blogspot.com/https://diplomasolutionstudents.blogspot.com/
https://diplomasolutionstudents.blogspot.com/Rathodpradip1
 
IDC lectureA - Network Layer & IP Addressing with Cisco Notes.ppt
IDC lectureA - Network Layer & IP Addressing with Cisco Notes.pptIDC lectureA - Network Layer & IP Addressing with Cisco Notes.ppt
IDC lectureA - Network Layer & IP Addressing with Cisco Notes.pptJayaprasanna4
 
Ip address and subnet masking final
Ip address and subnet masking finalIp address and subnet masking final
Ip address and subnet masking finalNeerajBhardwaj57
 
Unit 1- Network Layer and Protocols-4.pptx
Unit 1- Network Layer and Protocols-4.pptxUnit 1- Network Layer and Protocols-4.pptx
Unit 1- Network Layer and Protocols-4.pptxDESTROYER39
 
Exploration network chapter_5_modified
Exploration network chapter_5_modifiedExploration network chapter_5_modified
Exploration network chapter_5_modifiedrajesh531
 
SYSTEM NETWORK ADMINISTRATIONS GOALS and TIPS
SYSTEM NETWORK ADMINISTRATIONS GOALS and TIPSSYSTEM NETWORK ADMINISTRATIONS GOALS and TIPS
SYSTEM NETWORK ADMINISTRATIONS GOALS and TIPSProf Ansari
 
IP_ADDRESSING_AND_SUBNETTING.pptx
IP_ADDRESSING_AND_SUBNETTING.pptxIP_ADDRESSING_AND_SUBNETTING.pptx
IP_ADDRESSING_AND_SUBNETTING.pptxgamerchan1
 
Sept 2017 osi and tcp ip protocols
Sept 2017   osi  and tcp ip protocolsSept 2017   osi  and tcp ip protocols
Sept 2017 osi and tcp ip protocolsshahin raj
 
IP Addressing & subnetting strategy
IP Addressing & subnetting strategyIP Addressing & subnetting strategy
IP Addressing & subnetting strategyMustafa Salam
 
Lecture 3 network layer
Lecture 3 network layerLecture 3 network layer
Lecture 3 network layerRonoh Kennedy
 
Concept of networking
Concept of networkingConcept of networking
Concept of networkingsumit dimri
 

Similar to AKTU Computer Networks notes --- Unit 3.pdf (20)

https://diplomasolutionstudents.blogspot.com/
https://diplomasolutionstudents.blogspot.com/https://diplomasolutionstudents.blogspot.com/
https://diplomasolutionstudents.blogspot.com/
 
Ip address
Ip address Ip address
Ip address
 
IP & MAC Addressing
IP & MAC Addressing IP & MAC Addressing
IP & MAC Addressing
 
IDC lectureA - Network Layer & IP Addressing with Cisco Notes.ppt
IDC lectureA - Network Layer & IP Addressing with Cisco Notes.pptIDC lectureA - Network Layer & IP Addressing with Cisco Notes.ppt
IDC lectureA - Network Layer & IP Addressing with Cisco Notes.ppt
 
Ip address and subnet masking final
Ip address and subnet masking finalIp address and subnet masking final
Ip address and subnet masking final
 
lecture-2-tcp-ip.ppt
lecture-2-tcp-ip.pptlecture-2-tcp-ip.ppt
lecture-2-tcp-ip.ppt
 
Unit 1- Network Layer and Protocols-4.pptx
Unit 1- Network Layer and Protocols-4.pptxUnit 1- Network Layer and Protocols-4.pptx
Unit 1- Network Layer and Protocols-4.pptx
 
Exploration network chapter_5_modified
Exploration network chapter_5_modifiedExploration network chapter_5_modified
Exploration network chapter_5_modified
 
SYSTEM NETWORK ADMINISTRATIONS GOALS and TIPS
SYSTEM NETWORK ADMINISTRATIONS GOALS and TIPSSYSTEM NETWORK ADMINISTRATIONS GOALS and TIPS
SYSTEM NETWORK ADMINISTRATIONS GOALS and TIPS
 
Dcn class a subnetting
Dcn class a subnettingDcn class a subnetting
Dcn class a subnetting
 
IP Addressing
IP AddressingIP Addressing
IP Addressing
 
IP_ADDRESSING_AND_SUBNETTING.pptx
IP_ADDRESSING_AND_SUBNETTING.pptxIP_ADDRESSING_AND_SUBNETTING.pptx
IP_ADDRESSING_AND_SUBNETTING.pptx
 
Sept 2017 osi and tcp ip protocols
Sept 2017   osi  and tcp ip protocolsSept 2017   osi  and tcp ip protocols
Sept 2017 osi and tcp ip protocols
 
IPv4 Addressing
 IPv4 Addressing   IPv4 Addressing
IPv4 Addressing
 
Networking HMT-2
Networking HMT-2Networking HMT-2
Networking HMT-2
 
Computer Networks basics
Computer Networks basicsComputer Networks basics
Computer Networks basics
 
IP Addressing & subnetting strategy
IP Addressing & subnetting strategyIP Addressing & subnetting strategy
IP Addressing & subnetting strategy
 
Lecture 3 network layer
Lecture 3 network layerLecture 3 network layer
Lecture 3 network layer
 
Reserved ip addresses
Reserved ip addressesReserved ip addresses
Reserved ip addresses
 
Concept of networking
Concept of networkingConcept of networking
Concept of networking
 

Recently uploaded

Supermarket billing system project report..pdf
Supermarket billing system project report..pdfSupermarket billing system project report..pdf
Supermarket billing system project report..pdfKamal Acharya
 
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdfRESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdfKamal Acharya
 
Diploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdfDiploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdfJNTUA
 
Teachers record management system project report..pdf
Teachers record management system project report..pdfTeachers record management system project report..pdf
Teachers record management system project report..pdfKamal Acharya
 
"United Nations Park" Site Visit Report.
"United Nations Park" Site  Visit Report."United Nations Park" Site  Visit Report.
"United Nations Park" Site Visit Report.MdManikurRahman
 
Linux Systems Programming: Semaphores, Shared Memory, and Message Queues
Linux Systems Programming: Semaphores, Shared Memory, and Message QueuesLinux Systems Programming: Semaphores, Shared Memory, and Message Queues
Linux Systems Programming: Semaphores, Shared Memory, and Message QueuesRashidFaridChishti
 
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdfInstruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdfEr.Sonali Nasikkar
 
ANSI(ST)-III_Manufacturing-I_05052020.pdf
ANSI(ST)-III_Manufacturing-I_05052020.pdfANSI(ST)-III_Manufacturing-I_05052020.pdf
ANSI(ST)-III_Manufacturing-I_05052020.pdfBertinKamsipa1
 
2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edgePaco Orozco
 
Dairy management system project report..pdf
Dairy management system project report..pdfDairy management system project report..pdf
Dairy management system project report..pdfKamal Acharya
 
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdfDR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdfDrGurudutt
 
Circuit Breaker arc phenomenon.pdf engineering
Circuit Breaker arc phenomenon.pdf engineeringCircuit Breaker arc phenomenon.pdf engineering
Circuit Breaker arc phenomenon.pdf engineeringKanchhaTamang
 
ALCOHOL PRODUCTION- Beer Brewing Process.pdf
ALCOHOL PRODUCTION- Beer Brewing Process.pdfALCOHOL PRODUCTION- Beer Brewing Process.pdf
ALCOHOL PRODUCTION- Beer Brewing Process.pdfMadan Karki
 
Lesson no16 application of Induction Generator in Wind.ppsx
Lesson no16 application of Induction Generator in Wind.ppsxLesson no16 application of Induction Generator in Wind.ppsx
Lesson no16 application of Induction Generator in Wind.ppsxmichaelprrior
 
Introduction to Heat Exchangers: Principle, Types and Applications
Introduction to Heat Exchangers: Principle, Types and ApplicationsIntroduction to Heat Exchangers: Principle, Types and Applications
Introduction to Heat Exchangers: Principle, Types and ApplicationsKineticEngineeringCo
 
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisSeismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisDr.Costas Sachpazis
 
Theory for How to calculation capacitor bank
Theory for How to calculation capacitor bankTheory for How to calculation capacitor bank
Theory for How to calculation capacitor banktawat puangthong
 
RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5
RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5
RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5T.D. Shashikala
 
Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...
Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...
Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...ShivamTiwari995432
 
Introduction to Artificial Intelligence and History of AI
Introduction to Artificial Intelligence and History of AIIntroduction to Artificial Intelligence and History of AI
Introduction to Artificial Intelligence and History of AISheetal Jain
 

Recently uploaded (20)

Supermarket billing system project report..pdf
Supermarket billing system project report..pdfSupermarket billing system project report..pdf
Supermarket billing system project report..pdf
 
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdfRESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
 
Diploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdfDiploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdf
 
Teachers record management system project report..pdf
Teachers record management system project report..pdfTeachers record management system project report..pdf
Teachers record management system project report..pdf
 
"United Nations Park" Site Visit Report.
"United Nations Park" Site  Visit Report."United Nations Park" Site  Visit Report.
"United Nations Park" Site Visit Report.
 
Linux Systems Programming: Semaphores, Shared Memory, and Message Queues
Linux Systems Programming: Semaphores, Shared Memory, and Message QueuesLinux Systems Programming: Semaphores, Shared Memory, and Message Queues
Linux Systems Programming: Semaphores, Shared Memory, and Message Queues
 
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdfInstruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
 
ANSI(ST)-III_Manufacturing-I_05052020.pdf
ANSI(ST)-III_Manufacturing-I_05052020.pdfANSI(ST)-III_Manufacturing-I_05052020.pdf
ANSI(ST)-III_Manufacturing-I_05052020.pdf
 
2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge
 
Dairy management system project report..pdf
Dairy management system project report..pdfDairy management system project report..pdf
Dairy management system project report..pdf
 
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdfDR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
 
Circuit Breaker arc phenomenon.pdf engineering
Circuit Breaker arc phenomenon.pdf engineeringCircuit Breaker arc phenomenon.pdf engineering
Circuit Breaker arc phenomenon.pdf engineering
 
ALCOHOL PRODUCTION- Beer Brewing Process.pdf
ALCOHOL PRODUCTION- Beer Brewing Process.pdfALCOHOL PRODUCTION- Beer Brewing Process.pdf
ALCOHOL PRODUCTION- Beer Brewing Process.pdf
 
Lesson no16 application of Induction Generator in Wind.ppsx
Lesson no16 application of Induction Generator in Wind.ppsxLesson no16 application of Induction Generator in Wind.ppsx
Lesson no16 application of Induction Generator in Wind.ppsx
 
Introduction to Heat Exchangers: Principle, Types and Applications
Introduction to Heat Exchangers: Principle, Types and ApplicationsIntroduction to Heat Exchangers: Principle, Types and Applications
Introduction to Heat Exchangers: Principle, Types and Applications
 
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisSeismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
 
Theory for How to calculation capacitor bank
Theory for How to calculation capacitor bankTheory for How to calculation capacitor bank
Theory for How to calculation capacitor bank
 
RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5
RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5
RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5
 
Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...
Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...
Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...
 
Introduction to Artificial Intelligence and History of AI
Introduction to Artificial Intelligence and History of AIIntroduction to Artificial Intelligence and History of AI
Introduction to Artificial Intelligence and History of AI
 

AKTU Computer Networks notes --- Unit 3.pdf

  • 1. [Unit 3 Notes] By Prof. Narendra Kumar Page 1 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. 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. o Guaranteed delivery with bounded delay: This service guarantees that the 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 destination in the order in which they are sent. o Guaranteed max jitter: This service ensures that the amount of time taken between two successive transmissions at the sender is equal to the time between their receipt at the destination. 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 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 such a way, the network layer maintains the data integrity and source authentication services. Point-to-Point Communication A point-to-point communication is also known as P2P. In the context of telecommunication, it is an established connection between two nodes that may be used to communicate back and forth. A basic telephone call, in which one phone is connected to another, and both nodes can send and receive audio, is the most common example of point-to-point communication. These P2P connections were first established utilizing circuit- switched landlines in the early days of telephony. However, point- to-point communication in modern networks nowadays is made possible by complex fibre-optic networks. P2P connections of
  • 2. [Unit 3 Notes] By Prof. Narendra Kumar Page 2 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. o In the above figure, a router has three interfaces labeled as 1, 2 & 3 and each router interface contains its own IP 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) specifies the host in the network. Classful Addressing An IP address is 32-bit long. An IP address is divided into sub-classes: o Class A o Class B o Class C o Class D 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. 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. The total number of networks in Class A = 27 = 128 network address The total number of hosts in Class A = 224 - 2 = 16,777,214 host address Class B In Class B, an IP address is assigned to those networks that range from small-sized to large-sized networks. o The Network ID is 16 bits long. o The Host ID is 16 bits long. In Class B, the higher order bits of the first octet is always set to 10, and the remaining14 bits determine the network ID. The other 16 bits determine the Host ID. The total number of networks in Class B = 214 = 16384 network address The total number of hosts in Class B = 216 - 2 = 65534 host address
  • 3. [Unit 3 Notes] By Prof. Narendra Kumar Page 3 Class C In Class C, an IP address is assigned to only small-sized networks. o The Network ID is 24 bits long. o The host ID is 8 bits long. In Class C, the higher order bits of the first octet is always set to 110, and the remaining 21 bits determine the network ID. The 8 bits of the host ID determine the host in a network. The total number of networks = 221 = 2097152 network address The total number of hosts = 28 - 2 = 254 host address Class D 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 remaining bits determines the host ID in any network. 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. 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. Rules for assigning Network ID: If the hosts are located within the same local network, then they are assigned with the same network ID. The following are the rules for assigning Network ID: o The network ID cannot start with 127 as 127 is used by Class A. o The Network ID in which all the bits are set to 0 cannot be assigned as it is used to specify a particular host on the local network. o The Network ID in which all the bits are set to 1 cannot be assigned as it is reserved for the multicast address. Classful Network Architecture What is Subnetting? Sub-netting is the practice of dividing a network into two or smaller networks. It increases routing efficiency, which helps to enhance the security of the network and reduces the size of the broadcast domain. 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. Why Use Subnetting?
  • 4. [Unit 3 Notes] By Prof. Narendra Kumar Page 4 Here are important reasons for using Subnetting:  It helps you to maximize IP addressing efficiency.  Extend the life of IPV4.  Public IPV4 Addresses are scarce.  IPV4 Subnetting reduces network traffic by eliminating collision and broadcast traffic and thus improves overall performance.  This method allows you to apply network security policies at the 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. Two types of subnet masks are:  The default Subnet Mask is the number of bits which is reserved by the address class. Using this default mask will accommodate a single network subnet in the relative class.  A Custom Subnet Mask can be defined by an administrator to accommodate many Network How to Use a Subnet Mask? The subnet mask is used by the router to cover up the network address. It shows which bits are used to identify the subnet. Every network has its own unique address, Like here, class B network has network address 172.20.0.0, which has all zeroes in the host portion of the address. Example IP address: 11000001. Here 1st and 2nd bits are 1, and the 3rd bit is 0; hence, it is class C. Methods of Subnet Masking We can subnet the masking process in two ways: Straight or Short-cut. 1) Straight You should use the binary notation method for both the address and the mask and then apply the AND operation to get the block address. 2) Short-Cut Method  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.
  • 5. [Unit 3 Notes] By Prof. Narendra Kumar Page 5 Class Higher bits NET ID bits HOST ID bits No.of network s No.of hosts per network Range 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 Defined Not Defined 224.0.0.0 to 239.255.255.255 E 1111 Not Defined Not Defined Not Defined Not Defined 240.0.0.0 to 255.255.255.255
  • 6. [Unit 3 Notes] By Prof. Narendra Kumar Page 6 Class Default subnet mask No. of networks No. of host 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- In networking,  The process of dividing a single network into multiple sub networks is called as subnetting.  The sub networks so created are called as subnets. Example- Following diagram shows the subnetting of a big single network into 4 smaller subnets- Advantages- The two main advantages of subnetting a network are-  It improves the security.  The maintenance and administration of subnets is easy.  Subnet ID-  Each subnet has its unique network address known as its Subnet ID.  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- 1. Fixed Length Subnetting 2. Variable Length Subnetting 1. Fixed Length Subnetting- Fixed length subnetting also called as classful subnetting divides the network into subnets where- • All the subnets are of same size. • 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. Subnetting Examples- Now, we shall discuss some examples of subnetting a network- Example-01: Consider- • We have a big single network having IP Address 200.1.2.0. • We want to do subnetting and divide this network into 2 subnets. Clearly, the given network belongs to class C.
  • 7. [Unit 3 Notes] By Prof. Narendra Kumar Page 7 For creating two subnets and to represent their subnet IDs, we require 1 bit. So,  We borrow one bit from the Host ID part.  After borrowing one bit, Host ID part remains with only 7 bits.  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 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- • IP Address of the subnet = 200.1.2.128 • 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.10000000, 200.1.2.11111111] = [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. 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.  If borrowed bits = 00, then it represents the 1st subnet.  If borrowed bits = 01, then it represents the 2nd subnet.  If borrowed bits = 10, then it represents the 3rd subnet.
  • 8. [Unit 3 Notes] By Prof. Narendra Kumar Page 8  If borrowed bits = 11, then it represents the 4th subnet.  IP Address of the four subnets are-  200.1.2.00000000 = 200.1.2.0  200.1.2.01000000 = 200.1.2.64  200.1.2.10000000 = 200.1.2.128  200.1.2.11000000 = 200.1.2.192 For 1st Subnet-  IP Address of the subnet = 200.1.2.0  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.00000000, 200.1.2.00111111] = [200.1.2.0, 200.1.2.63]  Direct Broadcast Address = 200.1.2.00111111 = 200.1.2.63  Limited Broadcast Address = 255.255.255.255 For 2nd Subnet-  IP Address of the subnet = 200.1.2.64  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.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-  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 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 Example-03: Consider-  We have a big single network having IP Address 200.1.2.0.  We want to do subnetting and divide this network into 3 subnets. Here, the subnetting will be performed in two steps- 1. Dividing the given network into 2 subnets 2. Dividing one of the subnets further into 2 subnets Step-01: Dividing Given Network into 2 Subnets- The subnetting will be performed exactly in the same way as performed in Example-01. After subnetting, we have-
  • 9. [Unit 3 Notes] By Prof. Narendra Kumar Page 9 Step-02: Dividing One Subnet into 2 Subnets-  We perform the subnetting of one of the subnets further into 2 subnets.  Consider we want to do subnetting of the 2nd subnet having IP Address 200.1.2.128.  For creating two subnets and to represent their subnet IDs, we require 1 bit. So,  We borrow one more bit from the Host ID part.  After borrowing one bit, Host ID part remains with only 6 bits.  If 2nd borrowed bit = 0, then it represents one subnet.  If 2nd borrowed bit = 1, then it represents the other subnet. IP Address of the two subnets are-  200.1.2.10000000 = 200.1.2.128  200.1.2.11000000 = 200.1.2.192 Finally, the given single network is divided into 3 subnets having IP Address-  200.1.2.0  200.1.2.128  200.1.2.192 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-  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 For 3rd 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 Point-01: Subnetting leads to loss of IP Addresses. During subnetting,  We have to face a loss of IP Addresses.  This is because two IP Addresses are wasted for each subnet.  One IP address is wasted for its network address.  Other IP Address is wasted for its direct broadcasting address. Point-02: Subnetting leads to complicated communication process.
  • 10. [Unit 3 Notes] By Prof. Narendra Kumar Page 10 After subnetting, the communication process becomes complex involving the following 4 steps- 1. Identifying the network 2. Identifying the sub network 3. Identifying the host 4. Identifying the process PRACTICE PROBLEMS BASED ON SUBNETTING IN NETWORKING- Problem-01: Suppose a network with IP Address 192.16.0.0. is divided into 2 subnets, find number of hosts per subnet. Also for the first subnet, find- 1. Subnet Address 2. First Host ID 3. Last Host ID 4. Broadcast Address Solution-  Given IP Address belongs to class C.  So, 24 bits are reserved for the Net ID.  The given network is divided into 2 subnets.  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 = 172.16.0.127 Problem-03: 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 2. 4094 3. 4092 4. 4090 Solution-  Number of bits reserved for network ID in the given subnet mask = 20.  So, Number of bits reserved for Host ID = 32 – 20 = 12 bits.  Thus, Number of hosts per subnet = 212 – 2 = 4094.  In class B, 16 bits are reserved for the network.  So, Number of bits reserved for subnet ID = 20 – 16 = 4 bits.  Number of subnets possible = 24 = 16.  Thus, Option (B) is correct. To gain better understanding about IPv4 Subnetting, IP Subnetting As we talked about before, there are two parts in an IP Address. One for them is Network part and the another is Host part. With IP Subnetting, we are adding one more part. This is “Subnet Part”. From the Host part, we borrow some bits and we will use this part for Subnet. In this lesson, we will learn Subnetting with Subnetting Examples. As a basic definion, Subnetting is dividing the network into smaller network groups and by doing this, using the IP Address Block more efficient.
  • 11. [Unit 3 Notes] By Prof. Narendra Kumar Page 11 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 addresses that improves the efficiency of address distribution and replaces the previous system based on Class A, Class B and Class C networks. The CIDR number is typically preceded by a slash “/” and follows the IP address. For example, an IP address of 131.10. 55.70 with a subnet mask of 255.0. 0.0 (which has 8 network bits) would be represented as 131.10. What is a CIDR of 24? 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 means that the first 24 bits of the IP address are reserved for network routing. What is 255.255 255.0 CIDR? The subnet mask 255.255. 255.0 translates to /24 in CIDR-speak, as 24 bits are used for the network. That leaves 8 bits / 256 IPs for nodes. In CIDR notation, IP addresses are written as a prefix, and a suffix is attached to indicate how many bits are in the entire address. The suffix is set apart from the prefix with a slash mark. For instance, in the CIDR notation 192.0. 1.0/24, the prefix or IP address is 192.0. CIDR is used on the addresses that will advertise to the internet. So, it is used in the Internet Service Provider part. VLSM is used in a company or in smaller networks to use IP address spaces ideally. VLSM (Variable Length Subnet Mask) is the term that is used for using different Subnet Mask for different sun networks. In other words, it is the mechanism that allows different Subnet Masks and provide division of a network into sub networks. It is like Subnet of subnets. Special Subnets In Subnetting some Subnet Masks are used specifically sometimes. These are /24, /30, /31/ and /32. • /24 is the Subnet Mask that is usually used in the local networks by default. • /32 is the Subnet Mask used generally on Loopback and System interfaces. • /31 is the Subnet Mask used on point-to-point links. • /30 is also widely used in Service Provider Networks for point-to- point connections. Loopback Interface is the “virtual” interfaces. There can be many Loopback interfaces in a Router. Loopback Interfaces are used for its
  • 12. [Unit 3 Notes] By Prof. Narendra Kumar Page 12 “always up and never physically down” characteristics generally. We give these Loopback Interfaces a /32 Loopback IP address. IP Subnetting Examples: Example 1 In the first one of the Subnetting Examples, we will use, 192.168.5.85 /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 : 192.168.5.85 Subnet Mask : 255.255.255.0 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 the number of bits that network part has. And the 0s will show the host part bits. IP Address : 11000000. 10101000.00000101.01010101 Subnet Mask : 11111111. 11111111. 11111111.00000000 So, here, the first 24 bits (First 3 octets) are network bits and the last 8 bits (Last octet) are the host bits. For this IP and Subnet Mask, to determine the Network Address of this IP address, we will use “AND” operation between IP Address and Subnet Mask in binary mode. IP Add: 11000000. 10101000.00000101.01010101 SubM : 11111111. 11111111. 11111111.00000000 AND : 11000000. 10101000.00000101.00000000 When we use AND operation with this binary numbers, as you can see, 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 will be same as IP address and the last octet will be full of 0s. For this example our broadcast address will be 192.168.5.255. AS you can 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 addresses. IP Subnetting Examples: Example 2 In the second one of Subnetting Examples, we will do a little more complex example. This time our IP address will be 10.128.240.50/30. IP Address : 10.128.240.50 Sunet Mask : 255.255.255.252 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. /30 means that the subnet mask has 30 bits 1s and 2 bits 0s. Remember the total Subnet Mask is 32 bits. So in binary mode our Subnet Mask is: 11111111.11111111.11111111.11111100 (First 30 bits are 1s and 2 bits are 0s) And the decimal equal of this Subnet Mask is : 255.255.255.252 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 the binary equals of IP address and Subnet and use AND again. IP Add : 00001010.10000000.11110000.00110010 SubM : 11111111.11111111.11111111.11111100 AND : 00001010.10000000.11110000.00110000 The result of AND operation is the Network Address. This is 00001010.10000000.11110000.00110000 in binary. The decimal value of this is 10.128.240.48. Here, the last two bits are host bits and the other bits are network bits. 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 value is 10.128.240.51. The middle addresses can be used for hosts. These addresses are 10.128.240.49 and 10.128.240.50.
  • 13. [Unit 3 Notes] By Prof. Narendra Kumar Page 13 Network Address : 10.128.240.48 Host Addresses : 10.128.240.49 and 10.128.240.50 Broadcast Address : 10.128.240.51 /30 addresses are generally used in Service Provider Networks. So, you can work with /30 too much in the future. Subnetting Example 3 Think about 172.16.100.0/24 prefix and 172.16.100.0/28 prefix. As you can see, the only difference is Subnet Mask. In the first prefix, first 24 bits 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 bits. Let’s firstly talk about the first Prefix. We will write the IP Address and the Subnet Mask of this Prefix in binary format: 172.16.100.0 = 10101100.00010000.01100100.00000000 255.255.255.0 =11111111.11111111.11111111.00000000 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 . And the Broadcast address is 172.16.100.255. The other 254 IP addresses are host IP addresses. 172.16.100.1 172.16.100.2 …. 172.16.100.254 For the first prefix, we have only one network that has 254 hosts. Now, let’s check the second prefix. 172.16.100.0 /28. 172.16.100.0 = 10101100.00010000.01100100.00000000 255.255.255.240 =11111111.11111111.11111111.11110000 When we use AND operation here, our network address will be the same, in binary 10101100.00010000.01100100.00000000 or in decimal 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 (172.16.100.15) This is for the first network. We divide the network by using higher Subnet Mask. So, let’s look at the other networks: 10101100.00010000.01100100.00010000 10101100.00010000.01100100.00100000 10101100.00010000.01100100.00110000 10101100.00010000.01100100.01000000 …. 10101100.00010000.01100100.11110000 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. 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 can divide the network into smaller pieces. So, we will not waste the IP Addresses. Smaller networks that has few hosts do not need more addresses. Internet Protocol address(IP) IP address stands for “Internet Protocol address.” The Internet Protocol is a set of rules for communication over the internet, such as sending mail, streaming video, or connecting to a website. An IP address identifies a network or device on the internet.
  • 14. [Unit 3 Notes] By Prof. Narendra Kumar Page 14 Address Resolution Protocol (ARP) and its types Address Resolution Protocol (ARP) is a communication protocol used to find the MAC (Media Access Control) address of a device from its IP address. This protocol is used when a device wants to communicate with another device on a Local Area Network or Ethernet. Types of ARP There are four types of Address Resolution Protocol, which is given below: o Proxy ARP o Gratuitous ARP o Reverse ARP (RARP) o Inverse ARP 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 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. Example - If Host A wants to transmit data to Host B, which is on the different network, then Host A sends an ARP request message to receive a 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 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. 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. 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 ARP gateway router table. A table is created by the network administrator 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.
  • 15. [Unit 3 Notes] By Prof. Narendra Kumar Page 15 Steps taken by ARP protocol 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 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 ARP cache is empty, then device broadcast the message to the entire 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. 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 address association by using the ARP command utility. RARP o RARP stands for Reverse Address Resolution Protocol. 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 encapsulated in the data portion of a frame.
  • 16. [Unit 3 Notes] By Prof. Narendra Kumar Page 16 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 report the error but not to correct them. o An IP datagram contains the addresses of both source and destination, but it does not know the address of the previous router through which it has been passed. Due to this reason, ICMP can only send the messages to the source, but not to the immediate routers. o ICMP protocol communicates the error messages to the sender. ICMP messages cause the errors to be returned back to the user processes. o ICMP messages are transmitted within IP datagram. 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: o Destination unreachable: The message of "Destination Unreachable" is sent from receiver to the sender when destination cannot be reached, or packet is discarded when the destination is not reachable. o Source Quench: The purpose of the source quench message is congestion control. The message sent from the congested router to the source host to reduce the transmission rate. ICMP will take the IP of the discarded packet and then add the source quench message to the IP datagram to inform the source host to reduce its transmission rate. The source host will reduce the 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:
  • 17. [Unit 3 Notes] By Prof. Narendra Kumar Page 17 Sometimes packet discarded due to some bad routing implementation, and this 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 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 sends the "Redirection message" to the host to update its routing table. IGMP o IGMP stands for Internet Group Message Protocol. o The IP protocol supports two types of communication: o Unicasting: It is a communication between one sender and one receiver. Therefore, we can say that it is one-to-one communication. o Multicasting: Sometimes the sender wants to send the same message to a large number of receivers simultaneously. This process is known as multicasting which has one-to-many communication. o The IGMP protocol is used by the hosts and router to support multicasting. o The IGMP protocol is used by the hosts and router to identify the hosts in a LAN that are the members of a group. o IGMP is a part of the IP layer, and IGMP has a fixed-size message. o The IGMP message is encapsulated within an IP datagram. The Format of IGMP message Where, 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 message. It determines the maximum time the host can send the Membership Report message in response to the Membership Query message. Checksum: It determines the entire payload of the IP datagram in which IGMP message is encapsulated. Group Address: The behavior of this field depends on the type of the message sent. o For Membership Query, the group address is set to zero for General Query and set to multicast group address for a specific query. o For Membership Report, the group address is set to the multicast group address. o For Leave Group, it is set to the multicast group address. IGMP Messages o Membership Query message
  • 18. [Unit 3 Notes] By Prof. Narendra Kumar Page 18 o This message is sent by a router to all hosts on a local area network to determine the set of all the multicast groups that have been joined by the host. o It also determines whether a specific multicast group has been 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 members on that host. o Membership Report message o The host responds to the membership query message with a membership report message. o Membership report messages can also be generated by the host when a host wants to join the multicast group without waiting for a membership query message from the router. o Membership report messages are received by a router as well as all the hosts on an attached interface. o Each membership report message includes the multicast address of a single group that the host wants to join. o IGMP protocol does not care which host has joined the group or how many hosts are present in a single group. It only cares whether one or more attached hosts belong to a single multicast group. o The membership Query message sent by a router also includes a "Maximum Response time". After receiving a membership query message and before sending the membership report message, the host waits for the random amount of time from 0 to the maximum response time. If a host observes that some other attached host has sent the "Maximum Report message", then it discards its "Maximum Report message" as it knows that the attached router 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 transmission of a "Membership Report message". 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 o A router is a networking device that forwards the packet based on the information available in the packet header and forwarding table. o The routing algorithm initializes and maintains the routing table for the process of path determination. Routing Metrics and Costs Routing metrics and costs are used for determining the best route to the destination. The factors used by the protocols to determine the shortest path, these factors are known as a metric. The most common metric values are given below: o Hop count: Hop count is defined as a metric that specifies the number of passes through internetworking devices such as a router, a packet must travel in a route to move from source to the destination. o Delay: It is a time taken by the router to process, queue and transmit a datagram to an interface. The protocols use this metric to determine the delay values for all the links along the path end-to-end. The path having the lowest delay value will be considered as the best path. o Bandwidth: The capacity of the link is known as a bandwidth of the link. The bandwidth is measured in terms of bits per second. o Load: Load refers to the degree to which the network resource such as a router or network link is busy. A Load can be calculated in a variety of ways such as CPU utilization, packets processed per second. o Reliability: Reliability is a metric factor may be composed of a fixed value. It depends on the network links, and its value is measured dynamically. Some networks go down more often than others. After network failure, some network links repaired more easily than other network links. Types of Routing Routing can be classified into three categories:
  • 19. [Unit 3 Notes] By Prof. Narendra Kumar Page 19 Static Routing o Static Routing is also known as Non adaptive Routing. o It is a technique in which the administrator manually adds the routes in a routing table. o A Router can send the packets for the destination along the route defined by the administrator. o In this technique, routing decisions are not made based on the condition or topology of the networks Advantages Of Static Routing Following are the advantages of Static Routing: o No Overhead: It has ho overhead on the CPU usage of the router. Therefore, the cheaper router can be used to obtain static routing. o Bandwidth: It has not bandwidth usage between the routers. o Security: It provides security as the system administrator is allowed only to have control over the routing to a particular network. Default Routing o Default Routing is a technique in which a router is configured to send all the 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. o Default Routing is used when networks deal with the single exit point. o It is also useful when the bulk of transmission networks have to transmit the data to the same hp device. 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. The Dynamic protocol should have the following features: o All the routers must have the same dynamic routing protocol in order to exchange the routes. o If the router discovers any change in the condition or topology, then router broadcast this information to all other routers. Advantages of Dynamic Routing: o It is easier to configure. o It is more effective in selecting the best route in response to the changes in the condition or topology. Routing algorithm o In order to transfer the packets from source to the destination, the network layer must determine the best route through which packets can be transmitted. o Whether the network layer provides datagram service or virtual circuit service, the main job of the network layer is to provide the best route. The routing protocol provides this job. o The routing protocol is a routing algorithm that provides the best path from 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 destination but the best route to send the packets is determined by the routing algorithm. Classification of a Routing algorithm The Routing algorithm is divided into two categories: o Adaptive Routing algorithm o Non-adaptive Routing algorithm Adaptive Routing algorithm o An adaptive routing algorithm is also known as dynamic routing algorithm. o This algorithm makes the routing decisions based on the topology and network traffic. o The main parameters related to this algorithm are hop count, distance and estimated transit time.
  • 20. [Unit 3 Notes] By Prof. Narendra Kumar Page 20 An adaptive routing algorithm can be classified into three parts: o Centralized algorithm: It is also known as global routing algorithm as it 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 is obtained before actually performing any calculation. o Link state algorithm is referred to as a centralized algorithm since it is aware of the cost of each link in the network. o Isolation algorithm: It is an algorithm that obtains the routing information by using local information rather than gathering information from other nodes. o Distributed algorithm: It is also known as decentralized algorithm as it computes the least-cost path between source and destination in an iterative and distributed manner. In the decentralized algorithm, no node has the knowledge about the cost of all the network links. Non-Adaptive Routing algorithm 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. The Non-Adaptive Routing algorithm is of two types: Flooding: In case of flooding, every incoming packet is sent to all the outgoing links except the one from it has been reached. The disadvantage of flooding is that node may contain several copies of a particular packet. Random walks: In case of random walks, a packet sent by the node to one of its neighbors randomly. An advantage of using random walks is that it uses the alternative routes very efficiently. Differences b/w Adaptive and Non-Adaptive Routing Algorithm Basis Of Comparison Adaptive Routing algorithm Non-Adaptive Routing algorithm Define Adaptive Routing algorithm is an algorithm that constructs the routing table based on the network conditions. The Non-Adaptive Routing algorithm is an algorithm that constructs the static table to determine which node to send the packet. Usage Adaptive routing algorithm is used by dynamic routing. The Non-Adaptive Routing algorithm is used by static routing. Routing decision Routing decisions are made based on topology and network traffic. Routing decisions are the static tables. Categorization The types of adaptive routing algorithm, are Centralized, isolation and distributed algorithm. The types of Non Adaptive routing algorithm are flooding and random walks. Complexity Adaptive Routing algorithms are more complex. Non-Adaptive Routing algorithms are simple. Distance Vector Routing Algorithm o The Distance vector algorithm is iterative, asynchronous and distributed. o Distributed: It is distributed in that each node receives information from one or more of its directly attached neighbors, performs calculation and then distributes the result back to its neighbors. o Iterative: It is iterative in that its process continues until no more information is available to be exchanged between neighbors. o Asynchronous: It does not require that all of its nodes operate in the lock step with each other. o The Distance vector algorithm is a dynamic algorithm. o It is mainly used in ARPANET, and RIP. o Each router maintains a distance table known as Vector. Three Keys to understand the working of Distance Vector Routing Algorithm: o Knowledge about the whole network: Each router shares its knowledge through the entire network. The Router sends its collected knowledge about the network to its neighbors. o Routing only to neighbors: The router sends its knowledge about the network to only those routers which have direct links. The router sends whatever it has about the network through the ports. The information is
  • 21. [Unit 3 Notes] By Prof. Narendra Kumar Page 21 received by the router and uses the information to update its own routing table. 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 The distance vector x, i.e., Dx = [ Dx(y) : y in N ], containing its cost to all destinations, y, in N. o The distance vector of each of its neighbors, i.e., Dv = [ Dv(y) : y in N ] for each neighbor v of x. Distance vector routing is an asynchronous algorithm in which node x sends the copy of its distance vector to all its neighbors. When node x receives the new distance vector from one of its neighboring vector, v, it saves the distance vector of v and uses the Bellman-Ford equation to update its own distance vector. The 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 loop wait(until I receive any distance vector from some neighbor w) for each y in N: 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 Sharing Information o In the above figure, each cloud represents the network, and the number inside the cloud represents the network ID. o All the LANs are connected by routers, and they are represented in boxes labeled as A, B, C, D, E, F. o Distance vector routing algorithm simplifies the routing process by assuming the cost of every link is one unit. Therefore, the efficiency of transmission can be measured by the number of links to reach the destination. o In Distance vector routing, the cost is based on hop count. In the above figure, we observe that the router sends the knowledge to the immediate neighbors. The neighbors add this knowledge to their own knowledge and sends the updated table to their own neighbors. In this way, routers get its own information plus the new information about the neighbors.
  • 22. [Unit 3 Notes] By Prof. Narendra Kumar Page 22 Routing Table Two process occurs: o Creating the Table o Updating the Table Creating the Table Initially, the routing table is created for each router that contains atleast three types of information such as Network ID, the cost and the next hop. 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 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. 5. E sends its routing table to A & D. 6. F sends its routing table to A. Updating the Table o When A receives a routing table from B, then it uses its information to update the table. o The routing table of B shows how the packets can move to the networks 1 and 4. o The B is a neighbor to the A router, the packets from A to B can reach in one hop. So, 1 is added to all the costs given in the B's table and the sum will be the cost to reach a particular network. o After adjustment, A then combines this table with its own table to create a combined table. 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 The process of creating the routing table continues for all routers. Every router receives the information from the neighbors, and update the routing table. Final routing tables of all the routers are given below:
  • 23. [Unit 3 Notes] By Prof. Narendra Kumar Page 23 Link State Routing Link state routing is a technique in which each router shares the knowledge of its neighborhood with every other router in the internetwork. The three keys to understand the Link State Routing algorithm: o Knowledge about the neighborhood: Instead of sending its routing table, a router sends the information about its neighborhood only. A router broadcast its identities and cost of the directly attached links to other routers. o Flooding: Each router sends the information to every other router on the internetwork except its neighbors. This process is known as Flooding. Every router that receives the packet sends the copies to all its neighbors. Finally, each and every router receives a copy of the same information. 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. 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. for all nodes v if v adjacent to A then D(v) = c(A,v) else D(v) = infinity loop find w not in N such that D(w) is a minimum. Add w to N Update D(v) for all v adjacent to w and not in N: D(v) = min(D(v) , D(w) + c(w,v)) Until all nodes in N In the above algorithm, an initialization step is followed by the loop. The number of times the loop is executed is equal to the total number of nodes available in the network. Let's understand through an example:
  • 24. [Unit 3 Notes] By Prof. Narendra Kumar Page 24 In the above figure, source vertex is A. Step 1: The first step is an initialization step. The currently known least cost path from A to its directly attached neighbors, B, C, D are 2,5,1 respectively. The cost from A to B 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 and F are set to infinity as they are not directly linked to A. Step 2: In the above table, we observe that vertex D contains the least cost path in step 1. Therefore, it is added in N. Now, we need to determine a least-cost path through D vertex. a) Calculating shortest path from A to B 1. v = B, w = D 2. D(B) = min( D(B) , D(D) + c(D,B) ) 3. = min( 2, 1+2)> 4. = min( 2, 3) 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 1. v = C, w = D 2. D(B) = min( D(C) , D(D) + c(D,C) ) 3. = min( 5, 1+3) 4. = min( 5, 4) 5. The minimum value is 4. Therefore, the currently shortest path from A to C is 4.</p> c) Calculating shortest path from A to E 1. v = E, w = D 2. D(B) = min( D(E) , D(D) + c(D,E) ) 3. = min( ∞, 1+1) 4. = min(∞, 2) 5. The minimum value is 2. Therefore, the currently shortest path from A to E is 2. Note: The vertex D has no direct link to vertex E. Therefore, the value of D(F) is infinity. Step 3: In the above table, we observe that both E and B have the least cost path in step 2. Let's consider the E vertex. Now, we determine the least cost path of remaining vertices through E. a) Calculating the shortest path from A to B. 1. v = B, w = E 2. D(B) = min( D(B) , D(E) + c(E,B) ) 3. = min( 2 , 2+ ∞ ) 4. = min( 2, ∞) 5. The minimum value is 2. Therefore, the currently shortest path from A to B is 2. b) Calculating the shortest path from A to C. 1. v = C, w = E 2. D(B) = min( D(C) , D(E) + c(E,C) ) 3. = min( 4 , 2+1 ) 4. = min( 4,3) 5. The minimum value is 3. Therefore, the currently shortest path from A to C is 3. 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) ) 3. = min( ∞ , 2+2 ) 4. = min(∞ ,4) 5. The minimum value is 4. Therefore, the currently shortest path from A to F is 4. Step N D(B),P( B) D(C),P( C) D(D),P (D) D(E), P(E) D(F), P(F) 1 A 2,A 5,A 1,A ∞ ∞ 2 A D 2,A 4,D 2,D ∞ 3 A D E 2,A 3,E 4,E Step 4: In the above table, we observe that B vertex has the least cost path in step 3. Therefore, it is added in N. Now, we determine the least cost path of remaining vertices through B. a) Calculating the shortest path from A to C. 1. v = C, w = B 2. D(B) = min( D(C) , D(B) + c(B,C) ) 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. b) Calculating the shortest path from A to F. 1. v = F, w = B 2. D(B) = min( D(F) , D(B) + c(B,F) ) 3. = min( 4, ∞) 4. = min(4, ∞) 5. The minimum value is 4. Therefore, the currently shortest path from A to F is 4. Step N D(B),P( B) D(C),P (C) D(D),P(D ) D(E ),P( D( F),
  • 25. [Unit 3 Notes] By Prof. Narendra Kumar Page 25 E) P( F) 1 A 2,A 5,A 1,A ∞ ∞ 2 AD 2,A 4,D 2, D ∞ 3 AD E 2,A 3,E 4, E 4 AD EB 3,E 4, E Step 5: 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 vertices through C. a) Calculating the shortest path from A to F. 1. v = F, w = C 2. D(B) = min( D(F) , D(C) + c(C,F) ) 3. = min( 4, 3+5) 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), P(B) D(C), P(C) D(D), P(D) D(E), P(E) D(F),P (F) 1 A 2,A 5,A 1,A ∞ ∞ 2 AD 2,A 4,D 2,D ∞ 3 ADE 2,A 3,E 4,E 4 ADE B 3,E 4,E 5 ADE BC 4,E Final table: Step N D(B), P(B) D(C), P(C) D(D),P( D) D(E), P(E) D(F) ,P(F ) 1 A 2,A 5,A 1,A ∞ ∞ 2 AD 2,A 4,D 2,D ∞ 3 ADE 2,A 3,E 4,E 4 ADEB 3,E 4,E 5 ADEBC 4,E 6 ADEBC F Disadvantage: Heavy traffic is created in Line state routing due to Flooding. Flooding can cause an infinite looping, this problem can be solved by using Time-to-leave field IPv4 - Packet Structure Internet Protocol being a layer-3 protocol (OSI) takes data Segments from layer-4 (Transport) and divides it into packets. IP packet encapsulates data unit received from above layer and add to its own header information. The encapsulated data is referred to as IP Payload. IP header contains all the necessary information to deliver the packet at the other end.
  • 26. [Unit 3 Notes] By Prof. Narendra Kumar Page 26 IP header includes many relevant information including Version Number, which, in this context, is 4. Other details are as follows −  Version − Version no. of Internet Protocol used (e.g. IPv4).  IHL − Internet Header Length; Length of entire IP header.  DSCP − Differentiated Services Code Point; this is Type of Service.  ECN − Explicit Congestion Notification; It carries information about the congestion seen in the route.  Total Length − Length of entire IP Packet (including IP header and IP Payload).  Identification − If IP packet is fragmented during the 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 sent with some TTL value set, which tells the network how many routers (hops) this packet can cross. At each hop, its value is decremented by one and when the value reaches zero, the packet is discarded.  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.  Options − This is optional field, which is used if the value of IHL is greater than 5. These options may contain values for options such as Security, Record Route, Time Stamp, etc. IPV6 Address Structure An IPv6 address is made of 128 bits divided into eight 16-bits blocks. Each block is then converted into 4-digit Hexadecimal numbers separated by colon symbols. Fixed Header IPv6 fixed header is 40 bytes long and contains the following information.
  • 27. [Unit 3 Notes] By Prof. Narendra Kumar Page 27 S.N. Field & Description 1 Version (4-bits): It represents the version of Internet Protocol, i.e. 0110. 2 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). 3 Flow Label (20-bits): This label is used to maintain the sequential flow of the packets belonging to a communication. The source labels the sequence to help the router identify that a particular packet belongs to a specific flow of information. This field helps avoid re-ordering of data packets. It is designed for streaming/real-time media. 4 Payload Length (16-bits): This field is used to tell the routers how much information a particular packet contains in its payload. Payload is composed of Extension Headers and Upper Layer data. With 16 bits, up to 65535 bytes can be indicated; but if the Extension Headers contain Hop-by-Hop Extension Header, then the payload may exceed 65535 bytes and this field is set to 0. 5 Next Header (8-bits): This field is used to indicate either the type of Extension Header, or if the Extension Header is not present then it indicates the Upper Layer PDU. The values for the type of Upper Layer PDU are same as IPv4’s. 6 Hop Limit (8-bits): This field is used to stop packet to loop in the network infinitely. This is same as TTL in IPv4. The value of Hop Limit field is decremented by 1 as it passes a link (router/hop). When the field reaches 0 the packet is discarded. 7 Source Address (128-bits): This field indicates the address of originator of the packet. 8 Destination Address (128-bits): This field provides the address of intended recipient of the packet. Ipv4 Ipv6 Address length IPv4 is a 32-bit address. IPv6 is a 128-bit address. Fields IPv4 is a numeric address that consists of 4 fields which are separated by dot (.). IPv6 is an alphanumeric address that consists of 8 fields, which are separated by colon. Classes IPv4 has 5 different classes of IP address that includes Class A, Class B, Class C, Class D, and Class E. IPv6 does not contain classes of IP addresses. Number of IP address IPv4 has a limited number of IP addresses. IPv6 has a large number of IP addresses. VLSM It supports VLSM (Virtual Length Subnet Mask). Here, VLSM means that Ipv4 converts IP addresses into a subnet of different sizes. It does not support VLSM. Address configuration It supports manual and DHCP configuration. It supports manual, DHCP, auto- configuration, and
  • 28. [Unit 3 Notes] By Prof. Narendra Kumar Page 28 renumbering. Address space It generates 4 billion unique addresses It generates 340 undecillion unique addresses. End-to-end connection integrity In IPv4, end-to-end connection integrity is unachievable. In the case of IPv6, end- to-end connection integrity is achievable. Security features In IPv4, security depends on the application. This IP address is not developed in keeping the security feature in mind. In IPv6, IPSEC is developed for security purposes. Address representation In IPv4, the IP address is represented in decimal. In IPv6, the representation of the IP address in hexadecimal. Fragmentation Fragmentation is done by the senders and the forwarding routers. Fragmentation is done by the senders only. Packet flow identification It does not provide any mechanism for packet flow identification. It uses flow label field in the header for the packet flow identification. Checksum field The checksum field is available in IPv4. The checksum field is not available in IPv6. Transmission scheme IPv4 is broadcasting. On the other hand, IPv6 is multicasting, which provides efficient network operations. Encryption and Authentication It does not provide encryption and authentication. It provides encryption and authentication. Number of It consists of 4 octets. It consists of 8 fields, and octets each field contains 2 octets. Therefore, the total number of octets in IPv6 is 16. Congestion Control Congestion control refers to techniques and mechanisms that can either prevent congestion, before it happens, or remove congestion, after it has happened. We can divide congestion control mechanisms into two broad categories: open-loop congestion control (prevention) and closed-loop congestion control (removal) 1. Open-Loop Congestion Control In open-loop congestion control, policies are applied to prevent congestion before it happens. In these mechanisms, congestion control is handled by either the source or the destination. a. Retransmission Policy Retransmission is sometimes unavoidable. If the sender feels that a sent packet is lost or corrupted, the packet needs to be retransmitted. b. Window Policy
  • 29. [Unit 3 Notes] By Prof. Narendra Kumar Page 29 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. d. Discarding Policy A good discarding policy by the routers may prevent congestion and at the same time may not harm the integrity of the transmission. e. Admission Policy An admission policy, which is a quality-of-service mechanism, can also prevent congestion in virtual-circuit networks. 2. Closed-Loop Congestion Control Closed-loop congestion control mechanisms try to alleviate congestion after it happens. Several mechanisms have been used by different protocols. a. Backpressure 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. b. Choke Packet A choke packet is a packet sent by a node to the source to inform it of congestion. c. Implicit Signaling In implicit signaling, there is no communication between the congested node or nodes and the source. The source guesses that there is congestion somewhere in the network from other symptoms. d. Explicit Signaling The node that experiences congestion can explicitly send a signal to the source or destination. i. Backward Signaling A bit can be set in a packet moving in the direction opposite to the congestion. This bit can warn the source that there is congestion and that it needs to slow down to avoid the discarding of packets. ii. Forward Signaling 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 • It is a traffic shaping mechanism that controls the amount and the rate of the traffic sent to the network. • 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.
  • 30. [Unit 3 Notes] By Prof. Narendra Kumar Page 30 • The same concept can be applied to packets in the network. Consider that data is coming from the source at variable speeds. Suppose that a source sends data at 12 Mbps for 4 seconds. Then 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. Now, if the host wants to send busty data, it can consume all 10,000 tokens at once for sending 10,000 cells or bytes. Thus a host can send busty data as long as bucket is not empty.