0% found this document useful (0 votes)
15 views17 pages

Chapter 5

The document discusses several key concepts in network layer: 1. Tunneling allows two separate networks to communicate by encapsulating packets and routing them through intermediate networks, bypassing complexities. 2. Packet fragmentation breaks large packets into smaller fragments if they exceed the maximum transmission unit, to be reassembled at the destination. 3. Network addressing assigns logical addresses to interfaces of hosts and routers to allow communication. IP addresses have a network and host portion. 4. IP addresses are divided into classes A, B, C, D and E based on network and host bit allocation, determining the number of available networks and hosts in each class. 5. Subnetting further divides network classes into

Uploaded by

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

Chapter 5

The document discusses several key concepts in network layer: 1. Tunneling allows two separate networks to communicate by encapsulating packets and routing them through intermediate networks, bypassing complexities. 2. Packet fragmentation breaks large packets into smaller fragments if they exceed the maximum transmission unit, to be reassembled at the destination. 3. Network addressing assigns logical addresses to interfaces of hosts and routers to allow communication. IP addresses have a network and host portion. 4. IP addresses are divided into classes A, B, C, D and E based on network and host bit allocation, determining the number of available networks and hosts in each class. 5. Subnetting further divides network classes into

Uploaded by

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

Chapter-5// The Network Layer

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.

DR. GANGONE SWAPNA 1


Chapter-5// The Network Layer

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.

DR. GANGONE SWAPNA 2


Chapter-5// The Network Layer

Let's understand through a simple example.

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.

DR. GANGONE SWAPNA 3


Chapter-5// The Network Layer

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:
• The network ID cannot start with 127 as 127 is used by Class A.
• 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.
• The Network ID in which all the bits are set to 1 cannot be assigned as it
is reserved for the multicast address.

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.

DR. GANGONE SWAPNA 4


Chapter-5// The Network Layer

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

DR. GANGONE SWAPNA 5


Chapter-5// The Network Layer

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.

Classful Network Architecture

Class Higher NET HOST No.of No.of Range


bits ID bits ID bits networks hosts per
network

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 Not Not Not Defined 224.0.0.0 to


Defined Defined Defined 239.255.255.255

E 1111 Not Not Not Not Defined 240.0.0.0 to


Defined Defined Defined 255.255.255.255

DR. GANGONE SWAPNA 6


Chapter-5// The Network Layer

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.

represent network 0 represent hosts

DR. GANGONE SWAPNA 7


Chapter-5// The Network Layer

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.

DR. GANGONE SWAPNA 8


Chapter-5// The Network Layer

Representation of 8 Bit Octet

The above representation shows the structure of 8- bit octet.


Now, we will see how to obtain the binary representation of the above IP
address, i.e., 66.94.29.13
Step 1: First, we find the binary number of 66.

To obtain 66, we put 1 under 64 and 2 as the sum of 64 and 2 is equal to 66


(64+2=66), and the remaining bits will be zero, as shown above. Therefore, the
binary bit version of 66 is 01000010.
The address format of IPv4:

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.

DR. GANGONE SWAPNA 9


Chapter-5// The Network Layer

Network Layer Protocols in TCP/IP


1.ARP(Address Resolution Protocol)
o It is used to associate an IP address with the MAC address.
o Each device on the network is recognized by the MAC address imprinted
on the NIC. Therefore, we can say that devices need the MAC address for
communication on a local area network. MAC address can be changed
easily. For example, if the NIC on a particular machine fails, the MAC
address changes but IP address does not change. ARP is used to find the
MAC address of the node when an internet address is known.
Note: MAC address: The MAC address is used to identify the actual device.
IP address: It is an address used to locate a device on the network.

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.

DR. GANGONE SWAPNA 10


Chapter-5// The Network Layer

2.RARP (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.

3.ICMP (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

DR. GANGONE SWAPNA 11


Chapter-5// The Network Layer

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.

4.IGMP (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.

DR. GANGONE SWAPNA 12


Chapter-5// The Network Layer

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.

Routing, Routing Protocols and Multicasting


Routing
o A Routing 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.

DR. GANGONE SWAPNA 13


Chapter-5// The Network Layer

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 algorithms are used for routing the packets. The routing
algorithm is nothing but a software responsible for deciding the optimal
path through which packet can be transmitted.
o The routing protocols use the metric to determine the best path for the
packet delivery. The metric is the standard of measurement such as hop
count, bandwidth, delay, current load on the path, etc. used by the
routing algorithm to determine the optimal path to the destination.
Types of Routing
Routing can be classified into three categories:
o Static Routing
o Default Routing
o Dynamic Routing

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.

DR. GANGONE SWAPNA 14


Chapter-5// The Network Layer

o Security: It provides security as the system administrator is allowed only


to have control over the routing to a particular network.
Disadvantages of Static Routing:
Following are the disadvantages of Static Routing:
o For a large network, it becomes a very difficult task to add each route
manually to the routing table.
o The system administrator should have a good knowledge of a topology as
he has to add each route manually.

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.

DR. GANGONE SWAPNA 15


Chapter-5// The Network Layer

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 & It is more effective in selecting the best route in
response to the changes in the condition or topology.
Disadvantages of Dynamic Routing:
o It is more expensive in terms of CPU and bandwidth usage.

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.

DR. GANGONE SWAPNA 16


Chapter-5// The Network Layer

3.Exterior Gateway Protocol (EGP)


Exterior Gateway Protocol or EGP is a protocol that is used to exchange data
between gateway hosts that neighbor each other within autonomous systems.
In other words, EGP provides a forum for routers to share information across
different domains. The most high-profile example of an EGP is the internet
itself. The routing table of the EGP protocol includes known routers, route
costs, and network addresses of neighboring devices. EGP was widely-used by
larger organizations but has since been replaced by BGP.

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.

DR. GANGONE SWAPNA 17

You might also like