0% found this document useful (0 votes)
47 views25 pages

CS8591 / Computer Networks Department of CSE & IT 2019 - 2020

The document provides an overview of key concepts in computer networks including: 1. The network layer is responsible for packetizing data, routing packets from source to destination, and forwarding packets through routers using routing tables. 2. There are two approaches to routing packets - connectionless datagram service and connection-oriented virtual circuit service. The virtual circuit approach establishes a connection before sending packets. 3. IP addresses, routing algorithms, protocols like IP and ICMPv4, unicast and multicast routing, and IPV6 addressing are discussed as part of the network layer.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views25 pages

CS8591 / Computer Networks Department of CSE & IT 2019 - 2020

The document provides an overview of key concepts in computer networks including: 1. The network layer is responsible for packetizing data, routing packets from source to destination, and forwarding packets through routers using routing tables. 2. There are two approaches to routing packets - connectionless datagram service and connection-oriented virtual circuit service. The virtual circuit approach establishes a connection before sending packets. 3. IP addresses, routing algorithms, protocols like IP and ICMPv4, unicast and multicast routing, and IPV6 addressing are discussed as part of the network layer.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 25

CS8591 / Computer Networks Department of CSE & IT 2019 - 2020

UNIT III NETWORK LAYER


Network Layer Services – Packet switching – Performance – IPV4 Addresses – Forwarding of IP
Packets - Network Layer Protocols: IP, ICMP v4 – Unicast Routing Algorithms – Protocols –
Multicasting Basics – IPV6 Addressing – IPV6 Protocol.

INTRODUCTION
the Internet is made of many networks (or links) connected through the connecting devices. In other words, the
Internet is an internetwork, a combination of LANs and WANs.
Packetizing
The first duty of the network layer is definitely packetizing: encapsulating the payload (data received from upper
layer) in a network-layer packet at the source and decapsulating the payload from the network-layer packet at the
destination.
Routing and Forwarding
Routing
The network layer is responsible for routing the packet from its source to the destination.A physical network is a
combination of networks (LANs and WANs) and routers that connect them. This means that there is more than one
route from the source to the destination. The network layer is responsible for finding the best one among these
possible routes.
Forwarding
Forwarding can be defined as the action applied
by each router when a packet arrives at one of its interfaces. The decision-making table a router normally uses for
applying this action is sometimes called the forwarding tableand sometimes the routing table. When a router
receives a packet from one of its
attached networks, it needs to forward the packet to another attached network (in unicast routing) or to some
attached networks (in multicast routing).
PACKET SWITCHING
A router, in fact, is a switch that creates a connection between an input port and an output port. In data
communication switching techniques are divided into two broad categories, circuit switching and packet switching,
only packet switching is used at the network layer because the unit of data at this layer is a packet. Packet-switched
network can use two different approaches to route the packets: the datagram approach and the virtual circuit
approach.
Datagram Approach: Connectionless Service
When the network layer provides a connectionless service, each packet traveling in the Internet is an independent
entity; there is no relationship between packets belonging to the same message. The switches in this type of network
are called routers. A packet belonging to a message may be followed by a packet belonging to the same message or
to a different message. A packet may be followed by a packet coming from the same or from a different source.
Each packet is routed based on the information contained in its header: source and destination addresses. The
destination address defines where it should go; the source address defines where it comes from. The router in this
case routes the packet based only on the destination address. The source address may be used to send an error
message to the source if the packet is discarded. Figure below shows the forwarding process in a router in this case.
We have used symbolic addresses such as A and B.

Virtual-Circuit Approach: Connection-Oriented Service


In a connection-oriented service (also called virtual-circuit approach), there is a relationship between all packets
belonging to a message. Before all datagrams in a message can be sent, a virtual connection should be set up to
define the path for the datagrams. After connection setup, the datagrams can all follow the same path. In this type of
service, not only must the packet contain the source and destination addresses, it must also contain a flow label, a
virtual circuit identifier that defines the virtual path the packet should follow. Figure below shows the concept of
connection-oriented service.

St. Joseph’s College of Engineering / St. Joseph’s Institute of Technology Page 1 of 25


CS8591 / Computer Networks Department of CSE & IT 2019 - 2020

Each packet is forwarded based on the label in the packet. To follow the idea of connection-oriented design to be
used in the Internet, we assume that the packet has a label when it reaches the router. Figure below shows the idea.
In this case, the forwarding decision is based on the value of the label, or virtual circuit identifier, as it is sometimes
called. To create a connection-oriented service, a three-phase process is used: setup, data transfer, and teardown. In
the setup phase, the source and destination addresses of the sender and receiver are used to make table entries for the
connection-oriented service. In the teardown phase, the source and destination inform the router to delete the
corresponding entries. Data transfer occurs between these two phases.
Setup Phase
In the setup phase, a router creates an entry for a virtual circuit. For example, suppose source A needs to create a
virtual circuit to destination B. Two auxiliary packets need to be exchanged between the sender and the receiver: the
request packet and the acknowledgment packet.
Request packet
A request packet is sent from the source to the destination. This auxiliary packet carries the source and destination
addresses.

1. Source A sends a request packet to router R1.


2.Router R1 receives the request packet. It knows that a packet going from A to B goes out through port 3. How the
router has obtained this information is a point covered later. For the moment, assume that it knows the output port.
The router creates an entry in its table for this virtual circuit, but it is only able to fill three of the four columns. The
router assigns the incoming port (1) and chooses an available incoming label (14) and the outgoing port (3). It does
not yet know the outgoing label, which will be found during the acknowledgment step. The router then forwards the
packet through port 3 to router R3.
3.Router R3 receives the setup request packet. The same events happen here as at router R1; three columns of the
table are completed: in this case, incoming port (1), incoming label (66), and outgoing port (3).
4.Router R4 receives the setup request packet. Again, three columns are completed: incoming port (1), incoming
label (22), and outgoing port (4).
5.Destination B receives the setup packet, and if it is ready to receive packets from A, it assigns a label to the
incoming packets that come from A, in this case 77, as shown in Figure below. This label lets the destination know
that the packets come from A, and not from other sources.
Acknowledgment Packet
A special packet, called the acknowledgment packet, completes the entries in the switching tables.

St. Joseph’s College of Engineering / St. Joseph’s Institute of Technology Page 2 of 25


CS8591 / Computer Networks Department of CSE & IT 2019 - 2020

The destination sends an acknowledgment to router R4. The acknowledgment carries the global source and
destination addresses so the router knows which entry in the table is to be completed. The packet also carries label
77, chosen by the destination as the incoming label for packets from A. Router R4 uses this label to complete the
outgoing label column for this entry. Note that 77 is the incoming label for destination B, but the outgoing label for
router R4. Router R4 sends an acknowledgment to router R3 that contains its incoming label in the table, chosen in
the setup phase. Router R3 uses this as the outgoing label in the table.
Router R3 sends an acknowledgment to router R1 that contains its incoming label in the table, chosen in the setup
phase. Router R1 uses this as the outgoing label in the table.
Finally router R1 sends an acknowledgment to source A that contains its incoming label in the table, chosen in the
setup phase.
The source uses this as the outgoing label for the data packets to be sent to destination B.
Data-Transfer Phase
The second phase is called the data-transfer phase. After all routers have created their forwarding table for a specific
virtual circuit, then the network-layer packets belonging to one message can be sent one after another. In Figure
below, we show the flow of a single packet, but the process is the same for 1, 2, or 100 packets. The source
computer uses the label 14, which it has received from router R1 in the setup phase. Router R1 forwards the packet
to router R3, but changes the label to 66.Router R3 forwards the packet to router R4, but changes the label to 22.
Finally, router R4 delivers the packet to its final destination with the label 77. All the packets in the message follow
the same sequence of labels, and the packets arrive in order at the destination.
Teardown Phase
In the teardown phase, source A, after sending all packets to B, sends a special packet called a teardown packet.
Destination B responds with a confirmation packet. All routers delete the corresponding entries from their tables.

NETWORK-LAYER PERFORMANCE
The upper-layer protocols that use the service of the network layer expect to receive an ideal service, but the network
layer is not perfect. The performance of a network can be measured in terms of delay, throughput, and packet
loss.
St. Joseph’s College of Engineering / St. Joseph’s Institute of Technology Page 3 of 25
CS8591 / Computer Networks Department of CSE & IT 2019 - 2020
Congestion control is
an issue that can improve the performance.
Delay
The delays in a network can be divided into four types: transmission delay, propagation delay, processing delay, and
queuing delay.
Transmission Delay
A source host or a router cannot send a packet instantaneously. A sender needs to put the bits in a packet on the line
one by one. If the first bit of the packet is put on the line at time t1 and the last bit is put on the line at time t2,
transmission delay of the packet is (t2
shorter if the sender can transmit faster. In other words, the transmission delay is Delaytr = (Packet length) /
(Transmission rate).
Propagation Delay
Propagation delay is the time it takes for a bit to travel from point A to point B in the transmission media. The
propagation delay for a packet-switched network depends on the propagation delay of each network (LAN or
WAN). The propagation delay depends on the propagation speed of the media, which is 3 * 10 8 meters/second in a
vacuum and normally much less in a wired medium; it also depends on the distance of the link. In other words,
propagation delay is Delaypg = (Distance) / (Propagation speed).
Processing Delay
The processing delay is the time required for a router or a destination host to receive a packet from its input port,
remove the header, perform an error detection procedure, and deliver the packet to the output port (in the case of a
router) or deliver the packet to the upper-layer protocol (in the case of the destination host). The processing delay
may be different for each packet, but normally is calculated as an average. Delaypr = Time required to process a
packet in a router or a destination host
Total Delay
Assuming equal delays for the sender, routers, and receiver, the total delay (source-to-destination delay) a packet
encounters can be calculated if we know the number of routers, n, in the whole path.
Total delay =(n +1) (Delaytr + Delaypg + Delaypr) + (n) (Delayqu)
Note that if we have n routers, we have (n + 1) links. Therefore, we have (n + 1) transmission delays related to n
routers and the source, (n +1) propagation delays related to (n +1) links, (n+1) processing delays related to n routers
and the destination, and only n queuing delays related to n routers.
Throughput
Throughput at any point in a network is defined as the number of bits passing through the point in a second, which is
actually the transmission rate of data at that point. In a path from source to destination, a packet may pass through
several links (networks),each with a different transmission rate.

Throughput =minimum {TR1, TR2, ……TRn}.

The average data rate for this path is 100 kbps, the minimum of the three different data rates.

The transmission rate of the main link in the calculation of the throughput is only 200 kbps because the link is shared
between three paths.
IPV4 ADDRESSES
An IPv4 address is a 32-bit address that uniquely and universally defines the connection of a host or a router to the
Internet.
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
St. Joseph’s College of Engineering / St. Joseph’s Institute of Technology Page 4 of 25
CS8591 / Computer Networks Department of CSE & IT 2019 - 2020
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).
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 dtted-decimal notation is between 0 and 255. We
sometimes see an IPv4 address in hexadecimal notation. Each hexadecimal digit is equivalent to four bits.This
means that a 32-bit address has 8hexadecimal digits.

Hierarchy in Addressing
A 32-bit IPv4 address is also hierarchical, but divided only into two parts. The first part of the address, called the
prefix, defines the network; the second part of the address, called the suffix, defines the node (connection of a device
to the Internet). The prefix length is n bits and the suffix length is (32 - n) bits.

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 18.18. 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 27 =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.

St. Joseph’s College of Engineering / St. Joseph’s Institute of Technology Page 5 of 25


CS8591 / Computer Networks Department of CSE & IT 2019 - 2020
Address Depletion
The reason that classful addressing has become obsolete is address depletion. Since the addresses were not
distributed properly, the Internet was faced with the problem of the addresses being rapidly used up, resulting in no
more addresses available for organizations and individuals that needed to be connected to the Internet. To
understand the problem, let us think about class A. This class can be assigned to only 128 organizations in the world,
but each organization needs to have a single network (seen by the rest of the world) with 16,777,216 nodes
(computers in this single network). Since there may be only a few organizations that are this large, most of the
addresses in this class were wasted (unused). Class B addresses were designed for midsize organizations, but many
of the addresses in this class also remained unused. Class C addresses have a completely different flaw in design.
The number of addresses that can be used in each network (256) was so small that most companies were not
comfortable using a block in this address class. Class E addresses were almost never used, wasting the whole class.

Subnetting and Supernetting


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.
Classless Addressing
Subnetting and supernetting in classful addressing did not really solve the address depletion problem. With the
growth of the Internet, it was clear that a larger address space was needed as a long-term solution. The larger address
space, however, requires that the length of IP addresses also be increased, which means the format of the IP packets
needs to be changed.
In 1996, the Internet authorities announced a new architecture called 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.
Prefix Length: Slash Notation
The first question that we need to answer in classless addressing is how to find the prefix length if an address is
given. Since the prefix length is not inherent in the address, we need to separately give the length of the prefix. In
this case, the prefix length, n, is added to the address, separated by a slash. The notation is informally referred to as
slash notation and formally as classless interdomain routing or CIDR (pronounced cider) strategy.

Extracting Information from an Address


Given any address in the block, we normally like to know three pieces of information about the block to which the
address belongs: the number of addresses, the first address in the block, and the last address. Since the value of
prefix length, n, is given, we can easily find these three pieces of information.
1. The number of addresses in the block is found as N =232-n.
2. To find the first address, we keep the n leftmost bits and set the (32 - n) rightmost bits all to 0s.
3. To find the last address, we keep the n leftmost bits and set the (32 - n) rightmost bits all to 1s.

EXAMPLE:
A classless address is given as 167.199.170.82/27. We can find the above three pieces of information
as follows. The number of addresses in the network is 232 - n = 25 = 32 addresses.
Address Mask
Another way to find the first and last addresses in the block is to use the address mask.The address mask is a 32-bit
number in which the n leftmost bits are set to 1s and the rest of the bits (32 -n) are set to 0s. A computer can easily
find the address mask

St. Joseph’s College of Engineering / St. Joseph’s Institute of Technology Page 6 of 25


CS8591 / Computer Networks Department of CSE & IT 2019 - 2020
because it is the complement of (2 32 -n -1). The reason for defining a mask in this way is that it can be used by a
computer program to extract the information in a block, using the three bit-wise operations NOT, AND, and OR.
1. The number of addresses in the block N =NOT (mask) +1.
2. The first address in the block =(Any address in the block) AND (mask).
3. The last address in the block =(Any address in the block) OR [(NOT (mask)].
The mask in dotted-decimal notation is 256.256.256.224. The AND, OR, and NOT operations can be applied to
individual bytes using calculators
Address: 167.199.170.82/27 10100111 11000111 10101010 01010010
First address: 167.199.170.64/27 10100111 11000111 10101010 01000000
Address: 167.199.170.82/27 10100111 11000111 10101010 01011111
Last address: 167.199.170.95/27 10100111 11000111 10101010 01011111

FORWARDING OF IP PACKETS
We discussed the concept of forwarding at the network layer earlier in this chapter. In this section, we extend the
concept to include the role of IP addresses in forwarding. As we discussed before, forwarding means to place the
packet in its route to its destination. When IP is used as a connectionless protocol, forwarding is based on the
destination address of the IP datagram; when the IP is used as a connection-oriented protocol, forwarding is based on
the label attached to an IP datagram.
Forwarding Based on Destination Address
In classless addressing, the whole address space is one entity; there are no classes. This means that forwarding
requires one row of information for each block involved. The table needs to be searched based on the network
address (first address in the block). Unfortunately, the destination address in the packet gives no clue about the
network address. To solve the problem, we need to include the mask (/n) in the table.

INTERNET PROTOCOL (IP)


The network layer in version 4 can be thought of as one main protocol and three auxiliary ones. The main protocol,
Internet Protocol version 4 (IPv4), is responsible for packetizing, forwarding, and delivery of a packet at the network
layer. The Internet Control Message Protocol version 4 (ICMPv4) helps IPv4 to handle some errors that may occur
in the network-layer delivery. The Internet Group Management Protocol (IGMP) is used to help IPv4 in
multicasting. The Address Resolution Protocol (ARP) is used to glue the network and data-link layers in mapping
network-layer addresses to link-layer addresses.

IPv4 is an unreliable datagram protocol—a best-effort delivery service. The term best-effort means that IPv4
packets
St. Joseph’s College of Engineering / St. Joseph’s Institute of Technology Page 7 of 25
CS8591 / Computer Networks Department of CSE & IT 2019 - 2020
can be corrupted, be lost, arrive out of order, or be delayed, and may create congestion for the network. If reliability
is important, IPv4
must be paired with a reliable transport-layer protocol such as TCP. An example of a more commonly understood
best-effort delivery service is the post office. IPv4 is also a connectionless protocol that uses the datagram approach.
This means that each datagram is handled independently, and each datagram can follow a different route to the
destination. This implies that datagrams sent by the same source to the same destination could arrive out of order.
Datagram Format

Discussing the meaning and rationale for the existence of each field is essential to understanding the operation of
IPv4; a brief description of each field is in order.
Version Number. The 4-bit version number (VER) field defines the version of the IPv4 protocol, which, obviously,
has the value of 4.
Header Length. The 4-bit header length (HLEN) field defines the total length of the datagram header in 4-
byte
words. The IPv4 datagram has a variable-length header. When a device receives a datagram, it needs to know when
the header stops and the data, which is encapsulated in the packet, starts. However, to make the value of the header
length (number of bytes) fit in a 4-bit header length, the total length of the header is calculated as 4-byte words. The
total length is divided by 4 and the value is inserted in the field. The receiver needs to multiply the value of this field
by 4 to find the total length.
Service Type. In the original design of the IP header, this field was referred to as type of service (TOS), which
defined how the datagram should be handled. In the late 1990s, IETF redefined the field to provide differentiated
services (DiffServ).
Total Length. This 16-bit field defines the total length (header plus data) of the IP datagram in bytes. A 16-bit
number can define a total length of up to 65,535 (when all bits are 1s). However, the size of the datagram is
normally much less than this. This field helps the receiving device to know when the packet has completely
arrived.
To
find the length of the data coming from the upper layer, subtract the header length from the total length. The header
length can be found by multiplying the value in the HLEN field by 4.
Identification, Flags, and Fragmentation Offset. These three fields are related to the fragmentation of the IP
datagram when the size of the datagram is larger than the underlying network can carry.
Time-to-live. Due to some malfunctioning of routing protocols (discussed later) a datagram may be circulating in the
Internet, visiting some networks over and over without reaching the destination. This may create extra traffic in the
Internet. The time-to-live (TTL) field is used to control the maximum number of hops (routers) visited by the
datagram. When a source host sends the datagram, it stores a number in this field. This value is approximately two
times the maximum number of routers between any two hosts. Each router that processes the datagram decrements
this number by one. If this value, after being decremented, is zero, the router discards the datagram.
Protocol. In TCP/IP, the data section of a packet, called the payload, carries the whole packet from another protocol.
A datagram, for example, can carry a packet belonging to any transport-layer protocol such as UDP or TCP. A
datagram can also
carry a packet from other protocols that directly use the service of the IP, such as some routing protocols or some
auxiliary
corruptedprotocols.
during the transmission. IP puts the burden of error checking of the payload on the protocol that owns the
Header checksum. IP is not a reliable protocol; it does not check whether the payload carried by a datagram is

St. Joseph’s College of Engineering / St. Joseph’s Institute of Technology Page 8 of 25


CS8591 / Computer Networks Department of CSE & IT 2019 - 2020
payload, such as UDP or TCP. The datagram header, however, is added by IP, and its error-checking is the
responsibility of IP. Errors in the IP header can be a disaster. For example, if the destination IP address is corrupted,
the packet can be delivered to the wrong host. If the protocol field is corrupted, the payload may be delivered to the
wrong protocol. If the fields related to the fragmentation are corrupted, the datagram cannot be reassembled
correctly at the destination, and so on. For these reasons, IP adds a header checksum field to check the header, but
not the payload.
Source and Destination Addresses. These 32-bit source and destination address fields define the IP address of the
source and destination respectively. The source host should know its IP address. The destination IP address is known
by the protocol that uses the service of IP
Options. A datagram header can have up to 40 bytes of options. Options can be used for network testing and
debugging. Although options are not a required part of the IP header, option processing is required of the IP
software. This means that all implementations must be able to handle options if they are present in the
header.
Payload. Payload, or data, is the main reason for creating a datagram. Payload is the packet coming from other
protocols that use the service of IP.
Fragmentation
A datagram can travel through different networks. Each router decapsulates the IP datagram from the frame it
receives, processes it, and then encapsulates it in another frame. The format and size of the received frame depend
on the protocol used by the physical network through which the frame has just traveled. The format and size of the
sent frame depend on the protocol used by the physical network through which the frame is going to travel.
Maximum Transfer Unit (MTU)
Each link-layer protocol has its own frame format. One of the features of each format is the maximum size of the
payload that can be encapsulated. In other words, when a datagram is encapsulated in a frame, the total size of the
datagram must be less than
this maximum size, which is defined by the restrictions imposed by the hardware and software used in the network

In order to make the IP protocol independent of the physical network, the designers decided to make the maximum
length of the IP datagram equal to 65,535 bytes.
This makes transmission more efficient if one day we use a link-layer protocol with an MTU of this size. However,
for other physical networks, we must divide the datagram to make it possible for it to pass through these networks.
This is called fragmentation.
When a datagram is fragmented, each fragment has its own header with most of the fields repeated, but some have
been changed. A fragmented datagram may itself be fragmented if it encounters a network with an even smaller
MTU. In other words, a datagram may be fragmented several times before it reaches the final destination.
Fields Related to Fragmentation
We mentioned before that three fields in an IP datagram are related to fragmentation:
identification, flags, and fragmentation offset. Let us explain these fields now. The 16-bit identification field
identifies a datagram originating from the source host. The combination of the identification and source IP address
must uniquely define a datagram as it leaves the source host. To guarantee uniqueness, the IP protocol uses a counter
to label the datagrams. The counter is initialized to a positive number.
When the IP protocol sends a datagram, it copies the current value of the counter to the identification field and
increments the counter by one. As long as the counter is kept in the main memory, uniqueness is guaranteed. When a
datagram is fragmented,
the value in the identification field is copied into all fragments. In other words, all fragments have the same
identification number, which is also the same as the original datagram. The identification number helps the
destination in reassembling the datagram. It knows that all fragments having the same identification value should be
assembled into one datagram.
The 3-bit flags field defines three flags. The leftmost bit is reserved (not used). The second bit (D bit) is called the
do
not fragment bit. If its value is 1, the machine must not fragment the datagram. If it cannot pass the
datagram
St. Joseph’s College of Engineering / St. Joseph’s Institute of Technology Page 9 of 25
CS8591 / Computer Networks Department of CSE & IT 2019 - 2020
through any available physical network, it discards the datagram and sends an ICMP error message to the source
host (discussed later). If its value is 0, the datagram can be fragmented if necessary. The third bit (M bit) is called the
more fragment bit. If its value is 1, it means the datagram is not the last fragment; there are more fragments after this
one. If its value is 0, it means this is the last or only fragment.
The 13-bit fragmentation offset field shows the relative position of this fragment with respect to the whole datagram.
It is the offset of the data in the original datagram measured in units of 8 bytes. Figure 19.6 shows a datagram with a
data size of 4000 bytes fragmented into three fragments. The bytes in the original datagram are numbered 0 to 3999.
The first fragment carries bytes 0 to 1399. The offset for this datagram is 0/8 = 0. The second fragment carries bytes
1400 to 2799; the offset value for this fragment is 1400/8 =175. Finally, the third fragment carries bytes 2800 to
3999. The offset value for this fragment is 2800/8 = 350.

ICMPv4
The IPv4 has no error-reporting or error-correcting mechanism. The IP protocol also lacks a mechanism for host and
management queries. A host sometimes needs to determine if a router or another host is alive. And sometimes a
network manager needs information from another host or router.
The Internet Control Message Protocol version 4 (ICMPv4) has been designed to compensate for the above two
deficiencies. It is a companion to the IP protocol. ICMP itself is a network-layer protocol.
MESSAGES
ICMP messages are divided into two broad categories: error-reporting messages and query messages. The error-
reporting messages report problems that a router or a host (destination) may encounter when it processes an IP
packet. The query messages, which occur in pairs, help a host or a network manager get specific information from a
router or another host. For example, nodes can discover their neighbors. Also, hosts can discover and learn about
routers on their network and routers can help a node redirect its messages. An ICMP message has an 8-byte
header
St. Joseph’s College of Engineering / St. Joseph’s Institute of Technology Page 10 of 25
CS8591 / Computer Networks Department of CSE & IT 2019 - 2020
and a variable-size data section. Although the general format of the header is different for each message type, the
first 4 bytes are common to all.

Error Reporting Messages


Since IP is an unreliable protocol, one of the main responsibilities of ICMP is to report some errors that may occur
during the processing of the IP datagram. ICMP does not correct errors, it simply reports them. Error correction is
left to the higher-level protocols. Error messages are always sent to the original source because the only information
available in the datagram about the route is the source and destination IP addresses.
Destination Unreachable
The most widely used error message is the destination unreachable (type 3). This message uses different codes (0
to
15) to define the type of error message and the reason why a datagram has not reached its final destination.
Source Quench
Another error message is called the source quench (type 4) message, which informs the sender that the network has
encountered congestion and the datagram has been dropped; the source needs to slow down sending more
datagrams. In other words, ICMP adds a kind of congestion control mechanism to the IP protocol by using this type
of message.
Redirection Message
The redirection message (type 5) is used when the source uses a wrong router to send out its message. The router
redirects the message to the appropriate router, but informs the source that it needs to change its default router in the
future. The IP address of the default router is sent in the message.
Time Exceeded
The time-to-live (TTL) field in the IP datagram and explained that it prevents a datagram from being aimlessly
circulated in the Internet. When the TTL value becomes 0, the datagram is dropped by the visiting router and a time
exceeded message (type 11) with code 0 is sent to the source to inform it about the situation. The time-exceeded
message (with code 1) can also be sent when not all fragments of a datagram arrive within a predefined period of
time.
Parameter Problem
A parameter problem message (type 12) can be sent when either there is a problem in the header of a datagram
(code 0) or some options are missing or cannot be interpreted (code 1).
Query Messages
Interestingly, query messages in ICMP can be used independently without relation to an IP datagram. Of course, a
query message needs to be encapsulated in a datagram, as a carrier. Query messages are used to probe or test the
liveliness of hosts or routers in the Internet, find the one-way or the round-trip time for an IP datagram between two
devices, or even find out whether the clocks in two devices are synchronized. Naturally, query messages come in
pairs: request and reply.
The echo request (type 8) and the echo reply (type 0) pair of messages are used by a host or a router to test the
liveliness of another host or router. A host or router sendsan echo request message to another host or router; if the
latter is alive, it responds with an echo reply message. We shortly see the applications of this pair in two debugging
tools: ping and traceroute.
The timestamp request (type 13) and the timestamp reply (type 14) pair of messages are used to find the round-trip
time between two devices or to check whether the clocks in two devices are synchronized. The timestamp request
message sends a 32-bit number, which defines the time the message is sent. The timestamp reply resends that
number, but also includes two new 32-bit numbers representing the time the request was received and the time the
response was sent. If all timestamps represent Universal time, the sender can calculate the one-way and round-trip
time.

St. Joseph’s College of Engineering / St. Joseph’s Institute of Technology Page 11 of 25


CS8591 / Computer Networks Department of CSE & IT 2019 - 2020
Unicast Routing
Unicast routing in the Internet, with a large number of routers and a huge number of hosts, can be done only by
using hierarchical routing: routing in several steps using different routing algorithms
An Internet as a Graph
To find the best route, an internet can be modeled as a graph. A graph in computer science is a set of nodes and
edges (lines) that connect the nodes. To model an internet as a graph, we can think of each router as a node and each
network between a pair of routers as an edge. An internet is, in fact, modeled as a weighted graph, in which each
edge is associated with a cost. If a weighted graph is used to represent a geographical area, the nodes can be cities
and the edges can be roads connecting the cities; the weights, in this case, are distances between cities.
Least-Cost Routing
When an internet is modeled as a weighted graph, one of the ways to interpret the best route from the source router
to the destination router is to find the least cost between the two. In other words, the source router chooses a route to
the destination router in such a way that the total cost for the route is the least cost among all possible routes.

Least-Cost Trees
If there are N routers in an internet, there are (N 1) least-cost paths from each router to any other router. This means
we need N N 1) least-cost paths for the whole internet. If we have only 10 routers in an internet, we need 90 least-
cost paths. A better way to see all of these paths is to combine them in a least-cost tree. A least-cost tree is a tree
with the source router as the root that spans the whole graph (visits all other nodes) and in which the path between
the root and any other node is the shortest.

ROUTING ALGORITHMS
Several routing algorithms have been designed in the past. The differences between these methods are in the way
they interpret the least cost and the way they create the least-cost tree for each node.
Distance-Vector Routing
The distance-vector (DV) routing uses the goal we discussed in the introduction, to find the best route. In distance-
vector routing, the first thing each node creates is its own least-cost tree with the rudimentary information it has
about its immediate neighbors. The incomplete trees are exchanged between immediate neighbors to make the trees
more and more complete and to represent the whole internet. We can say that in distance-vector routing, a router
continuously tells all of its neighbors what it knows about the whole internet (although the knowledge can be
incomplete).

St. Joseph’s College of Engineering / St. Joseph’s Institute of Technology Page 12 of 25


CS8591 / Computer Networks Department of CSE & IT 2019 - 2020
Bellman-Ford Equation
The heart of distance-vector routing is the famous Bellman-Ford equation. This equation is used to find the least
cost (shortest distance) between a source node, x, and a destination node, y, through some intermediary nodes (a, b,
c, …) when the costs between the source and the intermediary nodes and the least costs between the intermediary
nodes and the destination are given. The following shows the general case in which Dij is the shortest distance and
cij is the cost between nodes i and j.

In distance-vector routing, normally we want to update an existing least cost with a least cost through an
intermediary node, such as z, if the latter is shorter. In this case, the equation becomes simpler, as shown below:

Distance Vectors
The concept of a distance vector is the rationale for the name distance-vector routing. A least-cost tree is a
combination of least-cost paths from the root of the tree to all destinations. These paths are graphically glued
together to form the tree. Distance-vector routing unglues these paths and creates a distance vector, a one-
dimensional array to represent the tree.

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
When we know only one distance between two nodes, it is the least cost. Figure below shows all distance vectors for
our internet. However, we need to mention that these vectors are made asynchronously, when the corresponding
node has been booted; the existence of all of them in a figure does not mean synchronous creation of them. For
example, node A thinks that it is not connected to node G because the corresponding cell shows the least cost of
infinity. To improve these vectors, the nodes in the internet need to help each other by exchanging information. After
each node has created its vector, it sends a copy of the vector to all its immediate neighbors.

St. Joseph’s College of Engineering / St. Joseph’s Institute of Technology Page 13 of 25


CS8591 / Computer Networks Department of CSE & IT 2019 - 2020

In the first event, node A has sent its vector to node B. Node B updates its vector using the cost cBA =2. In the
second event, node E has sent its vector to node B. Node B updates its vector using the cost cEA =4. After the first
event, node B has one improvement in its vector: its least cost to node D has changed from infinity to 5 (via node A).
After the second event, node B has one more improvement in its vector; its least cost to node F has changed from
infinity to 6 (via node E).
Count to Infinity
A problem with distance-vector routing is that any decrease in cost (good news) propagates quickly, but any increase
in cost (bad news) will propagate slowly. For a routing protocol to work properly, if a link is broken (cost becomes
infinity), every other router should be aware of it immediately, but in distance-vector routing, this takes some time.
The problem is referred to as count to infinity.
Example:

St. Joseph’s College of Engineering / St. Joseph’s Institute of Technology Page 14 of 25


CS8591 / Computer Networks Department of CSE & IT 2019 - 2020

Routing Information Protocol (RIP)


The Routing Information Protocol (RIP) is one of the most widely used intra domain routing protocols based on
the distance-vector routing algorithm RIP routers advertise the cost of reaching different networks instead of
reaching other nodes in a theoretical graph. In other words, the cost is defined between a router and the network in
which the destination host is located. Second, to make the implementation of the cost simpler. A forwarding table in
RIP is a three-column table in which the first column is the address of the destination network, the second column is
the address of the next router to which the packet should be forwarded, and the third column is the cost (the number
of hops) to reach the destination network. RIP has gone through two versions: RIP-1 and RIP-2. The second version
is backward compatible with the first section; it allows the use of more information in the RIP messages that were
set to 0 in the first version.

RIP has two types of messages: request and response. A request message is sent by a router that has just come up or
by a router that has some time-out entries. A request message can ask about specific entries or all entries. A response
(or update) message can be either solicited or unsolicited. A solicited response message is sent only in answer to a
request message. It contains information about the destination specified in the corresponding request message.

Link-State Routing
A routing algorithm that directly follows our discussion for creating least-cost trees and forwarding tables is link-
state (LS) routing. This method uses the term link-state to define the characteristic of a link (an edge) that
represents a network in the internet. In this algorithm the cost associated with an edge defines the state of the link.
Links with lower costs are preferred to links with higher costs; if the cost of a link is infinity, it means that the link
does not exist or has been broken.
Link-State Database (LSDB)
To create a least-cost tree with this method, each node needs to have a complete map of the network, which means it
needs to know the state of each link. The collection of states for all links is called the link-state database (LSDB).
Each node can send some greeting messages to all its immediate neighbors (those nodes to which it is connected
directly) to collect two pieces of information for each neighboring node: the identity of the node and the cost of the
link. The combination of these two pieces of
information is called the LS packet (LSP)
Flooding
Each router sends link-state information out its links The next node sends it out through all of its links Except the
one where the information arrived

St. Joseph’s College of Engineering / St. Joseph’s Institute of Technology Page 15 of 25


CS8591 / Computer Networks Department of CSE & IT 2019 - 2020
Reliable flooding
Ensure all nodes receive link-state information Ensure all nodes use the latest version

Formation of Least-Cost Trees


To create a least-cost tree for itself, using the shared LSDB, each node needs to run the famous Dijkstra Algorithm.
This iterative algorithm uses the following steps:
1.The node chooses itself as the root of the tree, creating a tree with a single node, and sets the total cost of each
node based on the information in the LSDB.
2.The node selects one node, among all nodes not in the tree, which is closest to the root, and adds this to the tree.
After this node is added to the tree, the cost of all other nodes not in the tree needs to be updated because the
paths
may have been changed.
3. The node repeats step 2 until all nodes are added to the tree.
The forward search algorithm:
4. Initialize the Confirmed list with an entry for myself; this entry has a cost of 0.
5. For the node just added to the Confirmed list in the previous step, call it node Next and select its LSP.
6.For each neighbor (Neighbor) of Next, calculate the cost (Cost) to reach this Neighbor as the sum of the cost
from myself to Next and from Next to Neighbor.
a)If Neighbor is currently on neither the Confirmed nor the Tentative list, then add (Neighbor, Cost, Nexthop) to
the Tentative list, where Nexthop is the direction I go to reach Next
b) If Neighbor is currently on the Tentative list, and the Cost is less than the currently listed cost for the
Neighbor, then replace the current entry with (Neighbor, Cost, Nexthop) where Nexthop is the direction I go to
reach Next
4. If the Tentative list is empty, stop.
Otherwise, pick the entry from the Tentative list with the lowest cost, move it to the Confirmed list, and return to
Step 2.

St. Joseph’s College of Engineering / St. Joseph’s Institute of Technology Page 16 of 25


CS8591 / Computer Networks Department of CSE & IT 2019 - 2020

Open Shortest Path First (OSPF)


Open Shortest Path First (OSPF) is also an intradomain routing protocol like RIP, but it is based on the link-state
routing protocol
Metric
In OSPF, like RIP, the cost of reaching a destination from the host is calculated from the source router to the
destination network. However, each link (network) can be assigned a weight based on the throughput, round-trip
time, reliability, and so on. An administration can also decide to use the hop count as the cost. An interesting point
about the cost in OSPF is that different service types (TOSs) can have different weights as the cost.
Link-State Advertisement
OSPF is based on the link-state routing algorithm, which requires that a router advertise the state of each link to all
neighbors for the formation of the LSDB. When we discussed the link-state algorithm, we used the graph theory and
assumed that each router is a node and each network between two routers is an edge. The situation is different in the
real world, in which we need to advertise the existence of different entities as nodes, the different types of links that
connect each node to its neighbors, and the different types of cost associated with each link.
OSPF Implementation
OSPF is implemented as a program in the network layer, using the service of the IP for propagation. An IP datagram
that carries a message from OSPF sets the value of the protocol field to 89.

OSPF Messages – OSPF is a very complex protocol. It uses five different types of messages. These are as follows:
1. Hello message (Type 1) – It is used by the routers to introduce itself to the other routers.
2. Database description message (Type 2) – It is normally send in response to the Hello message.
3. Link-state request message (Type 3) – It is used by the routers that need information about specific Link-
State packet.
4. Link-state update message (Type 4) – It is the main OSPF message for building Link-State Database.
5.Link-state acknowledgement message (Type 5) – It is used to create reliability in the OSPF protocol.
Basic link state algorithm plus many features:
◆ Authentication of routing messages
◆Extra hierarchy: Partition into routing areas » “Border” router pretends to be directly connected to all routers in an
area (answers for them)
◆ Load balancing: Multiple equal cost routes

St. Joseph’s College of Engineering / St. Joseph’s Institute of Technology Page 17 of 25


CS8591 / Computer Networks Department of CSE & IT 2019 - 2020

Path-Vector Routing
Path Vector Routing is a routing algorithm in unicast routing protocol of network layer, and it is useful for
interdomain routing. The principle of path vector routing is similar to that of distance vector routing. It assumes that
there is one node in each autonomous system that acts on behalf of the entire autonomous system is called Speaker
node .The speaker node in an AS creates a routing cable and advertises to the speaker node in the neighbouring
ASs
.A speaker node advertises the path, not the metrics of the nodes, in its autonomous system or other autonomous
systems

It is the initial table for each speaker node in a system made four ASs. Here Node A1 is the speaker node for AS1,
B1 for AS2, C1 for AS3 and D1 for AS4, Node A1 creates an initial table that shows A1 to A5 and these are located

St. Joseph’s College of Engineering / St. Joseph’s Institute of Technology Page 18 of 25


CS8591 / Computer Networks Department of CSE & IT 2019 - 2020
in AS1, it can be reached through it.
A speaker in an autonomous system shares its table with immediate neighbours ,here Node A1 share its table with
nodes B1 and C1 , Node C1 share its table with nodes A1,B1 and D1 , Node B1 share its table with nodes A1 and C1
, Node D1 share its table with node C1 If router A1 receives a packet for nodes A3 , it knows that the path is in
AS1,but if it receives a packet for D1,it knows that the packet should go from AS1,to AS2 and then to AS3 ,then the
routing table shows that path completely on the other hand if the node D1 in AS4 receives a packet for node A2,it
knows it should go through AS4,AS3,and AS.
FUNCTIONS
PREVENTION OF LOOP The creation of loop can be avoided in path vector routing .A router receives a message
it checks to see if its autonomous system is in the path list to the destination if it is looping is involved and the
message is ignored
POLICY ROUTING When a router receives a messages it can check the path, if one of the autonomous system
listed in the path against its policy, it can ignore its path and destination it does not update its routing table with this
path or it does not send the messages to its neighbours.
 OPTIMUM PATH A path to a destination that is the best for the organization that runs the autonomous system
Internet Structure
The Internet has changed from a tree-like structure, with a single backbone,to a multi-backbone structure run by
different private corporations today. There are several backbones run by private communication companies that
provide global connectivity. These backbones are connected by some peering points that allow connectivity between
backbones. At a lower level, there are some provider networks that use the backbones for global connectivity but
provide services to Internet customers. Finally, there are some customer networks that use the services provided by
the provider networks. Any of these three entities (backbone, provider network, or customer network) can be called
an Internet Service Provider or ISP. They provide services, but at different levels. Hierarchical routing means
considering each ISP as an autonomous system (AS).Each AS can run a routing protocol that meets its needs, but
the global Internet runs a global protocol to glue all ASs together. The routing protocol run in each AS is referred to
as intra-AS routing protocol, intradomain routing protocol, or interior gateway protocol (IGP); the global routing
protocol is referred to as inter-AS routing protocol,interdomain routing protocol, or exterior gateway protocol
(EGP).

The autonomous systems,however, are not categorized according to their size; they are categorized according to the
way they are connected to other ASs. We have stub ASs, multihomed ASs, and transient ASs.
Stub AS. A stub AS has only one connection to another AS. The data traffic can be either initiated or terminated in a
stub AS; the data cannot pass through it. A good example of a stub AS is the customer network, which is either the
source or the sink of data.
Multihomed AS. A multihomed AS can have more than one connection to other ASs, but it does not allow data
traffic to pass through it. A good example of such an AS is some of the customer ASs that may use the services of
more than one provider
network, but their policy does not allow data to be passed through them.
Transient AS. A transient AS is connected to more than one other AS and also allows the traffic to pass through.
The provider networks and the backbone are good examples of transient ASs.

St. Joseph’s College of Engineering / St. Joseph’s Institute of Technology Page 19 of 25


CS8591 / Computer Networks Department of CSE & IT 2019 - 2020
Border Gateway Protocol Version 4 (BGP4)
The Border Gateway Protocol version 4 (BGP4) is the only interdomain routing protocol used in the Internet
today. BGP4 is based on the path-vector algorithm we described before, but it is tailored to provide information
about the reachability of networks in the Internet. BGP routing information is usually exchanged between competing
business entities in the form of internet service providers (ISPs) in an open, hostile environment -- the public
internet. BGP is very security-focused. For example, all adjacent routers have to be configured manually based on
routing policies. To permit the transfer of routing information between neighboring ISPs, BGP requires peering
agreements, which comprise the necessary terms and conditions for exchanging traffic. The protocol adheres to these
agreements, while also evaluating routing tables and information along multiple routes between ISPs. All other
routing protocols are concerned solely with finding the optimal path toward all known destinations. BGP can't take
this simplistic approach because the peering agreements between ISPs almost always result in complex routing
policies.
Messages
BGP uses four types of messages for communication between the BGP speakers across the ASs and inside an AS:
open, update, keepalive, and notification. All BGP packets share the same common header.
❑ Open Message. To create a neighborhood relationship, a router running BGP opens a TCP connection with a
neighbor and sends an open message.
❑ Update Message. The update message is the heart of the BGP protocol. It is used by a router to withdraw
destinations that have been advertised previously, to announce a route to a new destination, or both. Note that BGP
can withdraw several destinations that were advertised before, but it can only advertise one new destination (or
multiple destinations with the same path attributes) in a single update message.
❑ Keepalive Message. The BGP peers that are running exchange keepalive messages regularly (before their hold time
expires) to tell each other that they are alive.
❑ Notification. A notification message is sent by a router whenever an error condition is detected or a router wants to
close the session.

Multicast Routing
Multicasting
In multicasting,
there is one source
and a group of
destinations. The
relationship is one
to many. In this
type of
communication, the source address is a unicast address, but the destination address is a group address, a group of one
or more destination networks in which there is at least one member of the group that is interested in receiving the
multicast datagram. The group address defines the members of the group.
St. Joseph’s College of Engineering / St. Joseph’s Institute of Technology Page 20 of 25
CS8591 / Computer Networks Department of CSE & IT 2019 - 2020

Two Approaches to Multicasting


In multicast routing, as in unicast routing, we need to create routing trees to optimally route the packets from their
source to their destination.
Source-Based Tree Approach
In the source-based tree approach to multicasting, each router needs to create a separate tree for each source-group
combination. In other words, if there are m groups and n sources in the internet, a router needs to create (m * n)
routing trees. In each tree ,the corresponding source is the root, the members of the group are the leaves, and the
router itself is somewhere on the tree.
Group-Shared Tree Approach
In the group-shared tree approach, we designate a router to act as the phony source for each group. The designated
router, which is called the core router or the rendezvouspoint router, acts as the representative for the group. Any
source that has a packet to send to a member of that group sends it to the core center (unicast communication) and
the core center is responsible for multicasting. The core center creates one single routing tree with itself as the root
and any routers with active members in the group as the leaves. In this approach, there are m core routers (one for
each group) and each core router has a routing tree, for the total of m trees. This means that the number of routing
trees is reduced from (m * n) in the source-based tree approach to m in this approach.

Multicast Distance Vector (DVMRP)


The Distance Vector Multicast Routing Protocol (DVMRP) is the extension of the Routing Information Protocol
(RIP) which is used in unicast routing. It uses the sourcebased tree approach to multicasting. It is worth mentioning
that each router in this protocol that receives a multicast packet to be forwarded implicitly creates a source-based
multicast tree in three steps:
1.The router uses an algorithm called reverse path forwarding (RPF) to simulate creating part of the optimal source-
based tree between the source and itself.
2.The router uses an algorithm called reverse path broadcasting (RPB) to create a broadcast (spanning) tree whose
root is the router itself and whose leaves are all networks in the internet.
3. The router uses an algorithm called reverse path multicasting (RPM) to create a multicast tree by cutting some
branches of the tree that end in networks with no member in the group.
Reverse Path Forwarding (RPF)
The first algorithm, reverse path forwarding (RPF), forces the router to forward a multicast packet from one
specific interface: the one which has come through the shortest path from the source to the router. The router does
not know the shortest path from the source to itself, but it can find which is the next router in the shortest path from
itself to the source (reverse path). The router simply consults its unicast forwarding table, pretending that it wants to
send a packet to the source; the forwarding table gives the next router and the interface the message that the packet
should be sent out in this reverse direction. The router uses this information to accept a multicast packet only if it
arrives from this interface.
Reverse Path Broadcasting (RPB)
The RPF algorithm helps a router to forward only one copy received from a source and drop the rest. However,
when we think about broadcasting in the second step, we need to remember that destinations are all the networks
(LANs) in the internet. To be efficient, we need to prevent each network from receiving more than one copy of the
packet. If a network is connected to more than one router, it may receive a copy of the packet from each router.
Reverse path
broadcasting (RPB) actually creates a broadcast tree from the graph that has been created by the RPF algorithm.
RPB has cut those branches of the tree that cause cycles in the graph. If we use the shortest path criteria for choosing
the parent router, we have actually created a shortest-path broadcast tree.

St. Joseph’s College of Engineering / St. Joseph’s Institute of Technology Page 21 of 25


CS8591 / Computer Networks Department of CSE & IT 2019 - 2020

Reverse Path Multicasting (RPM)


RPB does not multicast the packet, it broadcasts it. This is not efficient. To increase efficiency, the multicast packet
must reach only those networks that have active members for that particular group. This is called reverse path
multicasting (RPM). To change the broadcast shortest-path tree to a multicast shortest-path tree, each router needs
to prune (make inactive) the interfaces that do not reach a network with active members corresponding to a
particular source-group combination. This step can be done bottom-up, from the leaves to the root.

Multicast Link State (MOSPF)


Multicast Open Shortest Path First (MOSPF) is the extension of the Open Shortest Path First (OSPF) protocol,
which is used in unicast routing. It also uses the sourcebased tree approach to multicasting.
Protocol Independent Multicast (PIM)
Protocol Independent Multicast (PIM) is the name given to a common protocol that needs a unicast routing
protocol for its operation, but the unicast protocol can be either a distance-vector protocol or a link-state protocol. In
other words, PIM needs to use the forwarding table of a unicast routing protocol to find the next router in a path to
the destination, but it does not matter how the forwarding table is created. PIM has another interesting feature: it can
work in two different modes: dense and sparse.
Protocol Independent Multicast-Dense Mode (PIM-DM)
When the number of routers with attached members is large relative to the number of routers in the internet, PIM
works in the dense mode and is called PIM-DM. In this mode, the protocol uses a source-based tree approach and is
similar to DVMRP, but simpler. PIM-DM uses only two strategies described in DVMRP: RPF and RPM. The idea
behind PIM-DM. The first packet is broadcast to all networks, which have or do not have members. After a prune
message arrives from a router with no member, the second packet is only multicast.

St. Joseph’s College of Engineering / St. Joseph’s Institute of Technology Page 22 of 25


CS8591 / Computer Networks Department of CSE & IT 2019 - 2020
Protocol Independent Multicast-Sparse Mode (PIM-SM)
When the number of routers with attached members is small relative to the number of routers in the internet, PIM
works in the sparse mode and is called PIM-SM. In this environment, the use of a protocol that broadcasts the
packets until the tree is pruned is not justified; PIM-SM uses a group-shared tree approach to multicasting. The core
router in PIM-SM is called the rendezvous point (RP). PIM-SM uses a complex algorithm to select one router among
all routers in the internet as the RP for a specific group. This means that if we have m active groups, we need m RPs,
although a router may serve more than one group.

The idea is that each router helps to create the tree. To create a multicast tree rooted at the RP, PIM-SM uses join
and prune messages. First, three networks join group G1 and form a multicast tree. Later, one of the networks leaves
the group and the tree is pruned.
The join message is used to add possible new branches to the tree; the prune message is used to cut branches that
are not needed.

IPv6 ADDRESSING
The main reason for migration from IPv4 to IPv6 is the small size of the address space in IPv4. An IPv6 address is
128 bits or 16 bytes (octets) long, four times the address length in IPv4. An IPv6 address is 128 bits or 16 bytes
(octets) long, four times the address length in IPv4.

Abbreviation

St. Joseph’s College of Engineering / St. Joseph’s Institute of Technology Page 23 of 25


CS8591 / Computer Networks Department of CSE & IT 2019 - 2020
Although an IPv6 address, even in hexadecimal format, is very long, many of the digits are zeros. In this case, we
can abbreviate the address. The leading zeros of a section can be omitted. Using this form of abbreviation, 0074 can
be written as 74, 000F as F, and 0000 as 0. Note that 3210 cannot be abbreviated. Further abbreviation, often called
zero compression, can be applied to colon hex notation if there are consecutive sections consisting of zeros only. We
can remove all the zeros and replace them with a double semicolon.

Address Space
The address space of IPv6 contains 2128 addresses. This address space is 296 times the IPv4 address—definitely
no
address depletion—as shown, the size of the space is
Address Space Allocation
Like the address space of IPv4, the address space of IPv6 is divided into several blocks of varying size and each
block is allocated for a special purpose. Most of the blocks are still unassigned and have been set aside for future
use.

Global Unicast Addresses


The block in the address space that is used for unicast (one-to-one) communication between two hosts in the Internet
is called the global unicast address block. CIDR for the block is 2000::/3, which means that the three leftmost bits
are the same for all addresses in this block (001). The size of this block is 2125 bits, which is more than enough for
Internet expansion for many years to come. An address in this block is divided into three parts: global routing prefix
(n bits), subnet identifier (m bits), and interface identifier (q bits)
Auto configuration
One of the interesting features of IPv6 addressing is the autoconfiguration of hosts. As we discussed in IPv4, the
host and routers are originally configured manually by the network manager. However, the Dynamic Host
Configuration Protocol, DHCP, can be used to allocate an IPv4 address to a host that joins the network. In IPv6,
DHCP protocol can still be used to allocate an IPv6 address to a host, but a host can also configure itself.

THE IPv6 PROTOCOL


The change of the IPv6 address size requires the change in the IPv4 packet format. The designer of IPv6 decided to
implement remedies for other shortcomings now that a change is inevitable. The following shows other changes
implemented in the protocol in addition to changing address size and format.
❑Better header format. IPv6 uses a new header format in which options are separated from the base header and
inserted, when needed, between the base header and the data. This simplifies and speeds up the routing process
because most of the options do not need to be checked by routers.
❑ New options. IPv6 has new options to allow for additional functionalities.
❑Allowance for extension. IPv6 is designed to allow the extension of the protocol if required by new technologies
or applications.
❑Support for resource allocation. In IPv6, the type-of-service field has been removed, but two new fields, traffic
class and flow label, have been added to enable the source to request special handling of the packet. This mechanism
can be used to support traffic such as real-time audio and video.
❑Support for more security. The encryption and authentication options in IPv6 provide confidentiality and integrity
of the packet.

Packet Format
Each packet is composed of a base header followed by the payload. The base header occupies 40 bytes, whereas
payload can be up to 65,535 bytes of information. The description of fields follows.

St. Joseph’s College of Engineering / St. Joseph’s Institute of Technology Page 24 of 25


CS8591 / Computer Networks Department of CSE & IT 2019 - 2020

Version. The 4-bit version field defines the version number of the IP. For IPv6, the value is 6.
❑Traffic class. The 8-bit traffic class field is used to distinguish different payloads with different delivery
requirements. It replaces the type-of-service field in IPv4.
❑Flow label. The flow label is a 20-bit field that is designed to provide special handling for a particular flow of
data. We will discuss this field later.
❑Payload length. The 2-byte payload length field defines the length of the IP datagram excluding the header. Note
that IPv4 defines two fields related to the length: header length and total length. In IPv6, the length of the base
header is fixed (40 bytes); only the length of the payload needs to be defined.
❑Next header. The next header is an 8-bit field defining the type of the first extension header (if present) or the
type of the data that follows the base header in the datagram. This field is similar to the protocol field in IPv4
❑ Hop limit. The 8-bit hop limit field serves the same purpose as the TTL field in IPv4.
❑Source and destination addresses. The source address field is a 16-byte (128-bit) Internet address that identifies
the original source of the datagram. The destination address field is a 16-byte (128-bit) Internet address that
identifies the destination of the datagram.
❑Payload. Compared to IPv4, the payload field in IPv6 has a different format and meaning, as shown in Figure
below.

St. Joseph’s College of Engineering / St. Joseph’s Institute of Technology Page 25 of 25

You might also like