CN - Unit 3 - Notes
CN - Unit 3 - Notes
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.
Routing
o 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.
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.
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.
Routing Algorithms
The main function of the network layer is routing packets from the source machine to
the destination machine. In most networks, packets will require multiple hops to make
the journey.
Routing is the technique of determining the optimal path to transmit the data
from one location to another.
The router may assist in completing this task. It is a device that operates on
the network layer of the OSI model and the internet layer of the TCP and IP
model.
The routing algorithm enables the router to select the best route between the
source and the destination. Furthermore, it stores path data in a table known as
the routing table.
The routing algorithm is that part of the network layer software responsible
for deciding which output line an incoming packet should be transmitted on.
Isolated: In this method each, node makes its routing decisions using the information
it has without seeking information from other nodes. The sending nodes don’t have
information about the status of a particular link. The disadvantage is that packets may
be sent through a congested network which may result in delay. Examples: backward
learning.
Distributed: In this method, the node receives information from its neighbours and
then takes the decision about routing the packets. A disadvantage is that the packet
may be delayed if there is a change in between intervals in which it receives
information and sends packets. It is also known as a decentralized algorithm as it
computes the least-cost path between source and destination. A Distance vector
algorithm is a decentralized algorithm as it never knows the complete path from source to the
destination, instead it knows the direction through which the packet is to be forwarded along
with the least cost path.
Random walks: In case of random walks, a packet sent by the node to one of its
neighbours randomly. This is a highly robust method that is usually implemented by
sending packets onto the link which is least queued. An advantage of using random
walks is that it uses the alternative routes very efficiently.
Dijkstra Shortest Path Routing Algorithm
Each node is labelled (in parentheses) with its distance from the source node along the
best-known path. The distances must be non-negative, as they will be if they are based
on real quantities like bandwidth and delay.
Initially, no paths are known, so all nodes are labelled with infinity. As the algorithm
proceeds and paths are found, the labels may change, reflecting better paths. A label
may be either tentative or permanent. Initially, all labels are tentative. When it is
discovered that a label represents the shortest possible path from the source to that
node, it is made permanent and never changed thereafter.
We want to find the shortest path from A to D. We start out by marking node A as
permanent, indicated by a filled-in circle. Then we examine, in turn, each of the nodes
adjacent to A (the working node), relabelling each one with the distance to A.
Whenever a node is relabelled, we also label it with the node from which the probe
was made so that we can reconstruct the final path later. If the network had more than
one shortest path from A to D and we wanted to find all of them, we would need to
remember all the probe nodes that could reach a node with the same distance.
Having examined each of the nodes adjacent to A, we examine all the tentatively
labelled nodes in the whole graph and make the one with the smallest label
permanent, as shown in Fig.- b. This one becomes the new working node.
We now start at B and examine all nodes adjacent to it. If the sum of the label on B
and the distance from B to the node being considered is less than the label on that
node, we have a shorter path, so the node is relabelled. After all the nodes adjacent to
the working node have been inspected and the tentative labels changed, if possible,
the entire graph is searched for the tentatively labelled node with the smallest value.
This node is made permanent and becomes the working node for the next round.
The distance vector routing algorithm is sometimes called by other names, most
commonly the distributed Bellman-Ford routing algorithm, after the researchers
who developed it (Bellman, 1957; and Ford and Fulkerson, 1962). It was the original
ARPANET routing algorithm and was also used in the Internet under the name RIP.
In distance vector routing, each router maintains a routing table indexed by, and
containing one entry for each router in the network. This entry has two parts: the
preferred outgoing line to use for that destination and an estimate of the distance to
that destination. The distance might be measured as the number of hops or using
another metric.
The router is assumed to know the ‘‘distance’’ to each of its neighbours. If the metric
is hops, the distance is just one hop. If the metric is propagation delay, router can
measure it directly with special ECHO packets that the receiver just timestamps and
sends back as fast as it can.
As an example, assume that delay is used as a metric and that the router knows the
delay to each of its neighbours. Once every T msec, each router sends to each
neighbour a list of its estimated delays to each destination. It also receives a similar list
from each neighbour.
Imagine that one of these tables has just come in from neighbour X, with Xi being X’s
estimate of how long it takes to get to router i. If the router knows that the delay to X
is m msec, it also knows that it can reach router i via X in Xi + m msec. By performing
this calculation for each neighbour, a router can find out which estimate seems the
best and use that estimate and the corresponding link in its new routing table. Note
that the old routing table is not used in the calculation.
This updating process is illustrated in Fig. 5-9. Part (a) shows a network. The first four
columns of part (b) show the delay vectors received from the neighbours of router J.
A claim to have a 12-msec delay to B, a 25-msec delay to C, a 40- msec delay to D, etc.
Suppose that J has measured or estimated its delay to its neighbours, A, I, H, and K, as
8, 10, 12, and 6 msec, respectively.
Consider how J computes its new route to router G. It knows that it can get to A in 8
msec, and furthermore A claims to be able to get to G in 18 msec, so J knows it can
count on a delay of 26 msec to G if it forwards packets bound for G to A. Similarly, it
computes the delay to G via I, H, and K as 41 (31 + 10), 18 (6 + 12), and 37 (31 + 6)
msec, respectively. The best of these values is 18, so it makes an entry in its routing
table that the delay to G is 18 msec and that the route to use is via H. The same
calculation is performed for all the other destinations, with the new routing table
shown in the last column of the figure.
Count -to -Infinity- Problem
The settling of routes to best paths across the network is called convergence. Distance
vector routing is useful as a simple technique by which routers can collectively
compute shortest paths, but it has a serious drawback in practice: although it
converges to the correct answer, it may do so slowly. It reacts rapidly to good news,
but leisurely to bad news.
Consider a router whose best route to destination X is long. If, on the next exchange,
neighbour A suddenly reports a short delay to X, the router just switches over to using
the line to A to send traffic to X. In one vector exchange, the good news is processed.
To see how fast good news propagates, consider the five-node (linear) network of Fig.
5-10, where the delay metric is the number of hops. Suppose A is down initially, and
all the other routers know this. In other words, they have all recorded the delay to A
as infinity.
When A comes up, the other routers learn about it via the vector exchanges. At the
time of the first exchange, B learns that its left-hand neighbour has zero delay to A. B
now makes an entry in its routing table indicating that A is one hop away to the left.
All the other routers still think that A is down. At this point, the routing table entries
for A are as shown in the second row of Fig. 5-10(a).
On the next exchange, C learns that B has a path of length 1 to A, so it updates its
routing table to indicate a path of length 2, but D and E do not hear the good news
until later. Clearly, the good news is spreading at the rate of one hop per exchange. In
a network whose longest path is of length N hops, within N exchanges everyone will
know about newly revived links and routers.
Now let us consider the situation of Fig. 5-10(b), in which all the links and routers are
initially up. Routers B, C, D, and E have distances to A of 1, 2, 3, and 4 hops, respectively.
Suddenly, either A goes down or the link between A and B is cut (which is effectively
the same thing from B’s point of view).
At the first packet exchange, B does not hear anything from A. Fortunately, C says ‘‘Do
not worry; I have a path to A of length 2.’’ Little does B suspect that C’s path runs
through B itself. For all B knows, C might have ten links all with separate paths to A of
length 2. As a result, B thinks it can reach A via C, with a path length of 3. D and E do
not update their entries for A on the first exchange.
On the second exchange, C notices that each of its neighbours claims to have a path
to A of length 3. It picks one of them at random and makes its new distance to A 4, as
shown in the third row of Fig. 5-10(b). Subsequent exchanges produce the history
shown in the rest of Fig. 5-10(b). From this figure, it should be clear why bad news
travels slowly: no router ever has a value more than one higher than the minimum of
all its neighbours. Gradually, all routers work their way up to infinity, but the number
of exchanges required depends on the numerical value used for infinity. For this
reason, it is wise to set infinity to the longest path plus 1. Not entirely surprisingly, this
problem is known as the count-to-infinity problem.
The core of the problem is that when X tells Y that it has a path somewhere, Y
has no way of knowing whether it itself is on the path.
The idea behind link state routing is simple and can be stated as five parts. Each router
must do the following things to make it work:
4. Send this packet to and receive packets from all other routers.
5. Compute the shortest path to every other router.
Building the link state packets is easy. The hard part is determining when to build them.
One possibility is to build them periodically, that is, at regular intervals. Another
possibility is to build them when some significant event occurs, such as a line or
neighbour going down or coming back up again or changing its properties
appreciably.
This algorithm has a few problems, but they are manageable. First, if the sequence
numbers wrap around, confusion will reign. The solution here is to use a 32-bit
sequence number. With one link state packet per second, it would take 137 years to
wrap around, so this possibility can be ignored. Second, if a router ever crashes, it will
lose track of its sequence number. If it starts again at 0, the next packet it sends will be
rejected as a duplicate. Third, if a sequence number is ever corrupted and 65,540 is
received instead of 4 (a 1-bit error), packets 5 through 65,540 will be rejected as
obsolete, since the current sequence number will be thought to be 65,540. The solution
to all these problems is to include the age of each packet after the sequence number
and decrement it once per second. When the age hits zero, the information from that
router is discarded. Normally, a new packet comes in, say, every 10 sec, so router
information only times out when a router is down (or six consecutive packets have
been lost, an unlikely event). The Age field is also decremented by each router during
the initial flooding process, to make sure no packet can get lost and live for an
indefinite period of time (a packet whose age is zero is discarded).
IPV4 ADDRESSES
The IP address, often known as the Internet address, is the unique identifier used in
the IP layer of the TCP/IP protocol suite to identify each device's connection to the
Internet. A host's or router's connection to the Internet is defined by its 32-bit IPv4
address, which is unique and used worldwide. The IP address, not the host or router,
is what identifies the connection because it could change if the device is relocated to
a different network.
Since each address specifies a single and exclusive connection to the Internet, IPv4
addresses are distinctive. A device has two IPv4 addresses if it has two networks
connecting to the Internet through it. Because every host that wishes to connect to the
Internet must use the IPv4 addressing scheme, IPv4 addresses are considered
universal.
Address Space
A protocol like IPv4 that defines addresses has an address space. An address space is
the total number of addresses used by the protocol. If a protocol uses b bits to define
an address, the address space is 2b because each bit can have two different values (0
or 1). IPv4 uses 32-bit addresses, which means that the address space is 232 or
4,294,967,296 (more than four billion). If there were no restrictions, more than 4 billion
devices could be connected to the Internet.
Notation
There are three common notations to show an IPv4 address: binary notation (base 2),
dotted-decimal notation (base 256), and hexadecimal notation (base 16). In binary
notation, an IPv4 address is displayed as 32 bits. To make the address more readable,
one or more spaces are usually inserted between each octet (8 bits). Each octet is often
referred to as a byte. To make the IPv4 address more compact and easier to read, it is
usually written in decimal form with a decimal point (dot) separating the bytes. This
format is referred to as dotted-decimal notation. Note that because each byte (octet)
is only 8 bits, each number in the dotted-decimal notation is between 0 and 255 .
Hierarchy in Addressing
The addressing system is hierarchical in every type of communication network that
requires delivery, including phone and postal networks.
Although it is separated into two parts, a 32-bit IPv4 address is also hierarchical. The
network is defined by the first component of the address, known as the prefix, and
the node is defined by the second component, known as the suffix (connection of a
device to the Internet). A 32-bit IPv4 address's prefix and suffix are shown in the given
figure. The lengths of the prefix and suffix are n bits and (32 - n) bits, respectively.
Prefixes can have variable or fixed lengths. The IPv4 network identification was initially
intended to be a fixed-length prefix. Classful addressing is the term used to describe
this outmoded system. The brand-new addressing method, known as classless
addressing, makes use of a variable-length network prefix.
CLASSFUL ADDRESSING
When the Internet started, an IPv4 address was designed with a fixed-length prefix,
but to accommodate both small and large networks, three fixed-length prefixes were
designed instead of one (n = 8, n = 16, and n = 24). The whole address space was
divided into five classes (class A, B, C, D, and E), as shown in Figure. This scheme is
referred to as classful addressing.
In class A, the network length is 8 bits, but since the first bit, which is 0, defines the
class, we can have only seven bits as the network identifier. This means there are only
227 = 128 networks in the world that can have a class A address.
In class B, the network length is 16 bits, but since the first two bits, which are (10)2,
define the class, we can have only 14 bits as the network identifier. This means there
are only 214 = 16,384 networks in the world that can have a class B address.
All addresses that start with (110)2 belong to class C. In class C, the network length is
24 bits, but since three bits define the class, we can have only 21 bits as the network
identifier. This means there are 221 = 2,097,152 networks in the world that can have a
class C address.
Class D is not divided into prefix and suffix. It is used for multicast addresses. All
addresses that start with 1111 in binary belong to class E. As in Class D, Class E is not
divided into prefix and suffix and is used as reserve.
CLASSLESS ADDRESSING
In classless addressing, variable-length blocks are used that belong to no classes. We
can have a block of 1 address, 2 addresses, 4 addresses, 128 addresses, and so on. In
classless addressing, the whole address space is divided into variable length blocks.
The prefix in an address defines the block (network); the suffix defines the node
(device). Theoretically, we can have a block of 20 , 21 , 22 , ..., 232 addresses. One of the
restrictions, as we discuss later, is that the number of addresses in a block needs to be
a power of 2. An organization can be granted one block of addresses. Figure shows
the division of the whole address space into nonoverlapping blocks.
Unlike classful addressing, the prefix length in classless addressing is variable. We can
have a prefix length that ranges from 0 to 32. The size of the network is inversely
proportional to the length of the prefix. A small prefix means a larger network; a large
prefix means a smaller network. We need to emphasize that the idea of classless
addressing can be easily applied to classful addressing. An address in class A can be
thought of as a classless address in which the prefix length is 8. An address in class B
can be thought of as a classless address in which the prefix is 16, and so on. In other
words, classful addressing is a special case of classless addressing.
To alleviate address depletion, two strategies were proposed and, to some extent,
implemented: subnetting and supernetting. In subnetting, a class A or class B block is
divided into several subnets. Each subnet has a larger prefix length than the original
network. For example, if a network in class A is divided into four subnets, each subnet
has a prefix of nsub = 10. At the same time, if all of the addresses in a network are not
used, subnetting allows the addresses to be divided among several organizations. This
idea did not work because most large organizations were not happy about dividing
the block and giving some of the unused addresses to smaller organizations. While
subnetting was devised to divide a large block into smaller ones, supernetting was
devised to combine several class C blocks into a larger block to be attractive to
organizations that need more than the 256 addresses available in a class C block. This
idea did not work either because it makes the routing of packets more difficult.
IPv6 Addressing:
The main reason for migration from IPv4 to IPv6 is the small size of the address space
in IPv4. In this section, we show how the huge address space of IPv6 prevents address
depletion in the future. An IPv6 address is 128 bits or 16 bytes (octets) long, four times
the address length in IPv4.
Representation :
A computer normally stores the address in binary, but it is clear that 128 bits cannot
easily be handled by humans. Several notations have been proposed to represent IPv6
addresses when they are handled by humans. The following shows two of these
notations: binary and colon hexadecimal. Binary notation is used when the addresses
are stored in a computer. The colon hexadecimal notation (or colon hex for short)
divides the address into eight sections, each made of four hexadecimal digits
separated by colons.