CN Unit-Iii
CN Unit-Iii
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. The network layer
adds a header to the packet which includes the logical addresses of both the
sender and the receiver.
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.
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.
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.
• 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.
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
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.
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.
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.
Metrics are the network variables used to determine the best route to the destination.
For some protocols use the static metrics means that their value cannot be changed
and for some other routing protocols use the dynamic metrics means that their value
can be assigned by the system administrator.
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. If the routing protocol
considers the hop as a primary metric value, then the path with the least hop
count will be considered as the best path 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. The link that has a higher
transfer rate like gigabit is preferred over the link that has the lower capacity
like 56 kb. The protocol will determine the bandwidth capacity for all the links
along the path, and the overall higher bandwidth will be considered as the best
route.
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. If the traffic increases, then the
load value will also be increased. The load value changes with respect to the
change in the traffic.
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. Any reliability factor can be
considered for the assignment of reliability ratings, which are generally numeric
values assigned by the system administrator.
Types of Routing
Routing can be classified into three categories:
o Static Routing
o Default Routing
o Dynamic Routing
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
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.
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.
ARP
o ARP stands for 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(National Informatics Center). 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.
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.
In the above screenshot, we observe the association of IP address to the MAC address.
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.
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.
Error Reporting
ICMP protocol reports the error messages to the sender.
o Destination unreachable
o Source Quench
o Time Exceeded
o Parameter problems
o Redirection
There are two ways when Time Exceeded message can be generated:
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.
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.
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
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 LeaveReport
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.
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:
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.
Routing Table
Two process occurs:
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.
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.
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.
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.
Packet Fragmentation
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.
Congestion causes choking of the communication medium. When too many packets are
displayed in a method of the subnet, the subnet's performance degrades. Hence, a network's
communication channel is called congested if packets are traversing the path and experience
delays mainly over the path's propagation delay.