Unit-3Network Layer-2 Computer Networks
Unit-3Network Layer-2 Computer Networks
1. The main responsibility of the Network layer is to carry the data packets from the
source to the destination without changing or using them.
2. If the packets are too large for delivery, they are fragmented i.e., broken down
into smaller packets.
3. It decides the route to be taken by the packets to travel from the source to the
destination among the multiple routes available in a network (also called
routing).
4. The source and destination addresses are added to the data packets inside the
network layer.
The services which are offered by the network layer protocol are as follows:
1. Packetizing
2. Routing
3. Forwarding
Packetizing
The process of encapsulating the data received from the upper layers of the network
(also called payload) in a network layer packet at the source and decapsulating the
payload from the network layer packet at the destination is known as packetizing.
The source host adds a header that contains the source and destination address and
some other relevant information required by the network layer protocol to the payload
received from the upper layer protocol and delivers the packet to the data link layer.
Routing
Routing is the process of moving data from one device to another device. These are
two other services offered by the network layer. In a network, there are a number of
routes available from the source to the destination. The network layer specifies some
strategies which find out the best possible route. This process is referred to as
routing. There are a number of routing protocols that are used in this process and
they should be run to help the routers coordinate with each other and help in
establishing communication throughout the network.
Forwarding
Forwarding is simply defined as the action applied by each router when a packet
arrives at one of its interfaces. When a router receives a packet from one of its
attached networks, it needs to forward the packet to another attached network
(unicast routing) or to some attached networks (in the case of multicast routing).
Routers are used on the network for forwarding a packet from the local network to
the remote network. So, the process of routing involves packet forwarding from an
entry interface out to an exit interface.
Works on protocols like Routing Information Works on protocols like UDP Encapsulating
Protocol (RIP) for Routing. Security Payloads
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.
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
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.
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.
Class C
In Class C, an IP address is assigned to only small-sized networks.
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.
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.
D 1110 Not Defined Not Defined Not Defined Not 224.0.0.0 to 239.255.255.255
Defined
E 1111 Not Defined Not Defined Not Defined Not 240.0.0.0 to 255.255.255.255
Defined
Advantages:
Disadvantages:
RARP
DHCP can be implemented on local networks as well as large enterprise networks. DHCP is the
default protocol used by the most routers and networking equipment. DHCP is also called RFC
(Request for comments) 2131.
ICMP Protocol
The ICMP stands for Internet Control Message Protocol. It is a network layer protocol. It is
used for error handling in the network layer, and it is primarily used on network devices such
as routers. As different types of errors can exist in the network layer, so ICMP can be used to
report these errors and to debug those errors.
For example, some sender wants to send the message to some destination, but the router
couldn't send the message to the destination. In this case, the router sends the message to
the sender that I could not send the message to that destination.
The IP protocol does not have any error-reporting or error-correcting mechanism, so it uses a
message to convey the information. For example, if someone sends the message to the
destination, the message is somehow stolen between the sender and the destination. If no
one reports the error, then the sender might think that the message has reached the
destination. If someone in-between reports the error, then the sender will resend the message
very quickly.
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 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.
o The routing algorithm initializes and maintains the routing table for the process of path
determination.
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.
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.
Dynamic Routing
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.
Dijkstra Algorithm-
The idea is to build a graph of the subnet, with each node of the graph
representing a routerand each arc of the graph representing a communication
line or link.
To choose a route between a given pair of routers, the algorithm just finds the
shortest pathbetween them on the graph
1. Start with the local node (router) as the root of the tree. Assign a cost of
0 to this node andmake it the first permanent node.
2. Examine each neighbor of the node that was the last permanent node.
3. Assign a cumulative cost to each node and make it tentative
4. Among the list of tentative nodes
a. Find the node with the smallest cost and make it Permanent
b. If a node can be reached from more than one route then select the
route with theshortest cumulative cost.
5. Repeat steps 2 to 4 until every node becomes permanent
Flooding
• Another static algorithm is flooding, in which every incoming packet is
sent out on every outgoing line except the one it arrived on.
• Flooding obviously generates vast numbers of duplicate packets, in fact,
an infinite number unless some measures are taken to damp the process.
Calculation of a routing table
Too many packets present in (a part of) the network causes packet delay and
loss that degrades performance. This situation is called congestion.
The network and transport layers share the responsibility for handling
congestion. Since congestion occurs within the network, it is the network
layer that directly experiences it and must ultimately determine what to do
with the excess packets.
However, the most effective way to control congestion is to reduce the load
that the transport layer is placing on the network. This requires the network
and transport layers to work together. In this chapter we will look at the
network aspects of congestion.
Congestion control has to do with making sure the network is able to carry
the offered traffic. It is a global issue, involving the behavior of all the hosts
and routers.
IPv6
IPv4 produces 4 billion addresses, and the developers think that these addresses are enough,
but they were wrong. IPv6 is the next generation of IP addresses. The main difference between
IPv4 and IPv6 is the address size of IP addresses. The IPv4 is a 32-bit address, whereas IPv6 is a
128-bit hexadecimal address. IPv6 provides a large address space, and it contains a simple
header as compared to IPv4.
The address format of IPv6:
The above diagram shows the address format of IPv4 and IPv6. An IPv4 is a 32-bit decimal
address. It contains 4 octets or fields separated by 'dot', and each field is 8-bit in size. The
number that each field contains should be in the range of 0-255. Whereas an IPv6 is a 128-bit
hexadecimal address. It contains 8 fields separated by a colon, and each field is 16-bit in size.
Advantages of IPv6
Reliability
Faster Speeds: IPv6 supports multicast rather than broadcast in IPv4.This
feature allows bandwidth-intensive packet flows (like multimedia streams) to be
sent to multiple destinations all at once.
Stronger Security: IPSecurity, which provides confidentiality, and data
integrity, is embedded into IPv6.
Routing efficiency
Most importantly it’s the final solution for growing nodes in Global-network.
Disadvantages of IPv6
Conversion: Due to widespread present usage of IPv4 it will take a long
period to completely shift to IPv6.
Communication: IPv4 and IPv6 machines cannot communicate directly with
each other. They need an intermediate technology to make that possible.
IPv4 is a numeric address that consists of 4 fields IPv6 is an alphanumeric address that
which are separated by dot (.). consists of 8 fields, which are separated
by colon.
IPv4 has 5 different classes of IP address that IPv6 does not contain classes of IP
includes Class A, Class B, Class C, Class D, and addresses.
Class E.
IPv4 has a limited number of IP addresses. IPv6 has a large number of IP addresses.
In IPv4, security depends on the application. This In IPv6, IPSEC is developed for security
IP address is not developed in keeping the purposes.
security feature in mind.
It does not provide any mechanism for packet It uses flow label field in the header for
flow identification. the packet flow identification.
The checksum field is available in IPv4. The checksum field is not available in
IPv6.