Chapter 5
Chapter 5
Chapter-5
The Network Layer
Internetworking in Computer Network
In real world scenario, networks under same administration are generally
scattered geographically. There may exist requirement of connecting two
different networks of same kind as well as of different kinds. Routing between
two networks is called internetworking.
Networks can be considered different based on various parameters such as,
Protocol, topology, Layer-2 network and addressing scheme.
Tunneling
If they are two geographically separate networks, which want to communicate
with each other, they may deploy a dedicated line between or they have to pass
their data through intermediate networks.
Tunneling is a mechanism by which two or more same networks communicate
with each other, by passing intermediate networking complexities. Tunneling is
configured at both ends.
When the data enters from one end of Tunnel, it is tagged. This tagged data is
then routed inside the intermediate or transit network to reach the other end of
Tunnel. When data exists the Tunnel its tag is removed and delivered to the
other part of the network.
Both ends seem as if they are directly connected and tagging makes data travel
through transit network without any modifications.
Packet Fragmentation
A data packet can have more or less packet length depending upon the
application. Devices in the transit path also have their hardware and software
capabilities which tell what amount of data that device can handle and what
size of packet it can process.
If the data packet size is less than or equal to the size of packet the transit
network can handle, it is processed neutrally. If the packet is larger, it is
broken into smaller pieces and then forwarded. This is called packet
fragmentation. Each fragment contains the same destination and source
address and routed through transit path easily. At the receiving end it is
assembled again.
If a packet with DF (don’t fragment) bit set to 1 comes to a router which can
not handle the packet because of its length, the packet is dropped.
When a packet is received by a router has its MF (more fragments) bit set to 1,
the router then knows that it is a fragmented packet and parts of the original
packet is on the way.
If packet is fragmented too small, the overhead is increases. If the packet is
fragmented too large, intermediate router may not be able to process it and it
might get dropped.
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. When a router forwards the datagram, then it forwards the
packet to one of the links. The boundary between the router and link is
known as an interface, and the router can have multiple interfaces, one
for each of its links. Each interface is capable of sending and receiving
the IP packets, so IP requires each interface to have an address.
o Each IP address is 32 bits long, and they are represented in the form of
"dot-decimal notation" where each byte is written in the decimal form,
and they are separated by the period. An IP address would look like
193.32.216.9 where 193 represents the decimal notation of first 8 bits of
an address, 32 represents the decimal notation of second 8 bits of an
address.
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.
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
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.
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 01, 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
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 are 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.
A 0 8 24 27 224 0.0.0.0 to
127.255.255.255
What is Subnetting?
Subnetting 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?
Here are important reasons for using Subnetting:
• IPV4 Subnetting reduces network traffic by eliminating collision and
broadcast traffic and thus improves overall performance.
• Optimized IP network performance & Facilitates spanning of large
geographical distances.
• Subnetting process helps to allocate IP addresses that prevent large
numbers of IP network addresses from remaining unused.
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.
What is IP?
An IP stands for internet protocol. An IP address is assigned to each device
connected to a network. Each device uses an IP address for communication. It
also behaves as an identifier as this address is used to identify the device on a
network. It defines the technical format of the packets. Mainly, both the
networks, i.e., IP and TCP, are combined together, so together, they are referred
to as a TCP/IP . It creates a virtual connection between the source and the
destination.
We can also define an IP address as a numeric address assigned to each device
on a network. An IP address is assigned to each device so that the device on a
network can be identified uniquely. To facilitate the routing of packets, TCP/IP
protocol uses a 32-bit logical address known as IPv4 (Internet Protocol version
4).
An IP address consists of two parts, i.e., the first one is a network address, and
the other one is a host address.
There are two types of IP addresses
o IPv4
o IPv6
What is IPv4?
IPv4 is a version 4 of IP. It is a current version and the most commonly used IP
address. It is a 32-bit address written in four numbers separated by 'dot', i.e.,
periods. This address is unique for each device.
For example, 66.94.29.13
The above example represents the IP address in which each group of numbers
separated by periods is called an Octet. Each number in an octet is in the
range from 0-255. This address can produce 4,294,967,296 possible unique
addresses.
In today's computer network world, computers do not understand the IP
addresses in the standard numeric format as the computers understand the
numbers in binary form only. The binary number can be either 1 or 0. The IPv4
consists of four sets, and these sets represent the octet. The bits in each octet
represent a number.
Each bit in an octet can be either 1 or 0. If the bit the 1, then the number it
represents will count, and if the bit is 0, then the number it represents does
not count.
Drawback of IPv4
Currently, the population of the world is 7.6 billion. Every user is having more
than one device connected with the internet, and private companies also rely
on the internet. As we know that IPv4 produces 4 billion addresses, which are
not enough for each device connected to the internet on a planet. Although the
various techniques were invented, such as variable- length mask, network
address translation, port address translation, classes, inter-domain
translation, to conserve the bandwidth of IP address and slow down the
depletion of an IP address. In these techniques, public IP is converted into a
private IP due to which the user having public IP can also use the internet. But
still, this was not so efficient, so it gave rise to the development of the next
generation of IP addresses, i.e., IPv6.
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.
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.
Static Routing
o Static Routing is also known as Nonadaptive 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.
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 hop 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.
Routing Protocols
Routing protocols which are used within an organization or administration are
called Interior Gateway Protocols or IGP. RIP, OSPF are examples of IGP.
Routing between different organizations or administrations may have Exterior
Gateway Protocol, and there is only one EGP i.e. Border Gateway Protocol.
1.Routing Information Protocol (RIP)
Routing Information Protocol or RIP is one of the first routing protocols to be
created. RIP is used in both Local Area Networks (LANs) and Wide Area
Networks (WANs), and also runs on the Application layer of the OSI model.
There are multiple versions of RIP including RIPv1 and RIPv2. The original
version or RIPv1 determines network paths based on the IP destination and the
hop count of the journey. It is less secure as compared to default and static
routing.
2.Interior Gateway Protocol (IGRP)
Interior Gateway Protocol or IGRP is a distance vector routing protocol
produced by Cisco. IGRP was designed to build on the foundations laid down
on RIP to function more effectively within larger connected networks
and removed the 15 hop cap that was placed on RIP. IGRP uses metrics such
as bandwidth, delay, reliability, and load to compare the viability of routes
within the network. However, only bandwidth and delay are used under IGRP’s
default settings.
Multicast
Multicast is a method of group communication where the sender sends data
to multiple receivers or nodes present in the network simultaneously.
Multicasting is a type of one-to-many and many-to-many communication as it
allows sender or senders to send data packets to multiple receivers at once
across LANs or WANs.