1.CN DC Unit 3
1.CN DC Unit 3
proceeding:
This document is confidential and intended solely for the educational purpose of
RMK Group of Educational Institutions. If you have received this document through
email in error, please notify the system manager. This document contains proprietary
information and is intended only to the respective group / learning community as
intended. If you are not the addressee you should not disseminate, distribute or
copy through e-mail. Please notify the sender immediately by e-mail if you have
received this document by mistake and delete this document from your system. If
you are not the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this information is
strictly prohibited.
22EC503– Computer Networks
UNIT – 3
Network Layer
Page
S.No Contents
No
1 Course Objectives 8
3 Syllabus 12
4 Course Outcomes 14
5 CO - PO / PSO Mapping 16
3.1.1 PACKETIZING 24
3.1.2 ROUTING AND FORWARDING
TOTAL: 45 PERIODS
4. Course Outcomes
Course Outcomes for
22EC503– Computer Networks
Highest
# Course Outcomes Cognitive
Level
C304.4 Learn the network layer services and network layer protocols K2
Outcomes
Program
Specific
Level of CO
Program Outcomes
K3 K4 K4 K5 K6 A3 A2 A3 A3 A3 A3 A2 K5 K5 K3
PO- PO- PO- PO- PO- PO- PO- PO- PO- PO- PO- PO- PSO PSO PSO
1 2 3 4 5 6 7 8 9 10 11 12 -1 -2 -3
C304.1 K2 2 1 - - - - - - - - - - - - 2
C304.2 K2 2 1 - - - - - - - - - - - - 2
C304.3 K3 3 2 2 1 1 - - - - - - - - - 3
C304.4 K2 2 1 - - - - - - - - - - - - 2
C304.5 K2 2 1 1 1 - - - - - - - - - - 2
CO Avg
3 2 2 1 1 - - - - - - - - - 3
C304
Lecture Plan – Unit 3
Lecture Plan – Unit 3
Reason for
Taxonomy
Deviation
Mapping
Delivery
Planned
Mode of
Periods
Actual
No. of
Level
Date
Date
CO
No
Topics
S
Network layer
1 services - Packet 1 31.08.24 CO3 K2
Switching
Network Layer
3 1 03.09.24 CO3 K2
Protocols - IP
Interactive
5 Routing -Protocols 1 05.09.24 CO3 K2 Smart
Board,
chalk and
Building Network and talk
6 1 09.09.24 CO3 K2
its types
Overview of IPv6
8 1 11.09.24 CO3 K2
Addressing
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.
▪ The routers in the path are not allowed to decapsulate the packets they received unless
the packets need to be fragmented.
▪ The routers are not allowed to change source and destination addresses either.
▪ They just inspect the addresses for the purpose of forwarding the packet to the next
network on the path. However, if a packet is fragmented, the header needs to be copied
to all fragments and some changes are needed
The Routing and Forwarding are the important function of the Network Layer.
Routing:
In a network, there is more than one route from source host to reach the destination host.
The reponsibility of the network layer is to find the best route to reach the destination
among all possible routes.
The network layer needs to have some specific strategies for defining the best route. In the
Internet today, this is done by running some routing protocols to help the routers
coordinate their knowledge about the neighborhood and to come up with consistent tables
to be used when a packet arrives.
Forwarding:
If routing is applying strategies and running some routing protocols to create the decision-
making tables for each router, 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 table and sometimes the routing table.
NETWORK-LAYER PROTOCOLS
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).
To make this decision, the router uses a piece of information in the packet header,
which can be the destination address or a label, to find the corresponding output
interface number in the forwarding table.
Other Services
Error Control
▪ The designers of the network layer, have added a checksum field to the datagram
to control any corruption in the header, but not in the whole datagram.
▪ This checksum may prevent any changes or corruptions in the header of the
datagram.
▪ The network layer in the Internet does not directly provide error control, the
Internet uses an auxiliary protocol, ICMP, that provides some kind of error control
if the datagram is discarded or has some unknown information in the header.
Flow Control
▪ Flow control regulates the amount of data a source can send without
overwhelming the receiver.
▪ The network layer in the Internet, however, does not directly provide any flow
control.
NETWORK-LAYER PROTOCOLS
Congestion Control
▪ Congestion in the network layer is a situation in which too many datagrams are
present in an area of the Internet.
▪ In this situation, some routers may drop some of the datagrams. If the
congestion continues, sometimes a situation may reach a point where the system
collapses and no datagrams are delivered.
Quality of Service
The Internet has thrived by providing better quality of service to support these
applications. However, to keep the network layer untouched, these provisions are
mostly implemented in the upper layer.
Security
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.
A packet-switched network can use two different approaches to route the packets:
the datagram approach and the virtual circuit approach.
A connectionless service is the one in which the network-layer protocol treats each
packet independently, with each packet having no relationship to any other packet.
The idea was that the network layer is only responsible for delivery of packets from
the source to the destination. In this approach, the packets in a message may or
may not travel the same path to their destination.
▪ 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.
▪ 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 3.3 shows the forwarding process in a router in this case. We have used
symbolic addresses such as A and B.
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. Each packet is forwarded
based on the label in the packet.
▪ In this case, the forwarding decision is based on the value of the label, or virtual
circuit identifier.
▪ The source computer uses the label 14, which it has received from router R1 in
the setupphase.
▪ 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.
The identifier used in the IP layer of the TCP/IP protocol suite to identify the
connection of each device to the Internet is called the Internet address or IP
address.
An IPv4 address is a 32-bit address that uniquely and universally defines the
connection of a host or a router to the Internet.
The IP address is the address of the connection, not the host or the router, because
if the device is moved to another network, the IP address may be changed.
IPv4 addresses are unique in the sense that each address defines one, and only
one, connection to the Internet.
▪ IPv4 uses 32-bit addresses, which means that the address space is 232 or
4,294,967,296 (more than four billion).
Notation
▪ 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.
IPV4 ADDRESSES
▪ This means that a 32-bit address has 8 hexadecimal digits. This notation is often
used in network programming.
Hierarchy in Addressing
A 32-bit IPv4 address is hierarchical and it is 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.
▪ A prefix can be fixed length or variable length. The network identifier in the IPv4
was first designed as a fixed-length prefix. This scheme, which is now obsolete, is
referred to as 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
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.
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.
IPV4 ADDRESSES
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.
Although classful addressing had several problems and became obsolete, it had one
advantage: Given an address, we can easily find the class of the address and, since
the prefix length for each class is fixed, we can find the prefix length immediately.
IPV4 ADDRESSES
▪ 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 is that the number of addresses in a block needs to be a power of 2.
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.
IPV4 ADDRESSES
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.
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, as shown in Figure 2.63 a.
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.
IPV4 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 because it is the complement of (232 − 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.
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)].
Network Address
The first address, the network address, is particularly important because it is used in
routing a packet to its destination network.
IPV4 ADDRESSES
Block Allocation
The ultimate responsibility of block allocation is given to a global authority called the
Internet Corporation for Assigned Names and Numbers (ICANN). However, ICANN does not
normally allocate addresses to individual Internet users. It assigns a large block of
addresses to an ISP
Subnetting
An organization (or an ISP) that is granted a range of addresses may divide the range into
several subranges and assign each subrange to a subnetwork (or subnet).A subnetwork can
be divided into several sub-subnetworks.
Designing Subnets
The subnetworks in a network should be carefully designed to enable the routing of packets.
We assume the total number of addresses granted to the organization is N, the prefix length
is n, the assigned number of addresses to each subnetwork is Nsub, and the prefix length for
each subnetwork is nsub.
Then the following steps need to be carefully followed to guarantee the proper operation of
the subnetworks.
❑ The prefix length for each subnetwork should be found using the following formula:
The starting address in each subnetwork should be divisible by the number of addresses
in that subnetwork. This can be achieved if we first assign addresses to larger
subnetworks.
IPV4 ADDRESSES
Address Aggregation
▪ One of the advantages of the CIDR strategy is address aggregation (sometimes called
address summarization or route summarization). When blocks of addresses are combined
to create a larger block, routing can be done based on the prefix of the larger block.
▪ ICANN assigns a large block of addresses to an ISP. Each ISP in turn divides its assigned
block into smaller subblocks and grants the subblocks to its customers.
Special Addresses
This-host Address
▪ The only address in the block 0.0.0.0/32 is called the this-host address.
▪ It is used whenever a host needs to send an IP datagram but it does not know its own
address to use as the source address.
Limited-broadcast Address
▪ The only address in the block 255.255.255.255/32 is called the limited-broadcast address.
Loopback Address
▪ A packet with one of the addresses in this block as the destination address never leaves
the host; it will remain in the host.
Private Addresses
Multicast Addresses
DHCP Operation
1. The joining host creates a DHCPDISCOVER message in which only the transaction ID field
is set to a random number. This message is encapsulated in a UDP user datagram with the
source port set to 68 and the destination port set to 67. The user datagram is encapsulated
in an IP datagram with the source address set to 0.0.0.0 (“this host”) and the destination
address set to 255.255.255.255 (broadcast address). The reason is that the joining host
knows neither its own address nor the server address.
2. The DHCP server or servers (if more than one) responds with a DHCPOFFER message in
which the your address field defines the offered IP address for the joining host and the
server address field includes the IP address of the server.
3. The joining host receives one or more offers and selects the best of them. The
joining host then sends a DHCPREQUEST message to the server that has given the
best offer. The fields with known value are set. The user datagram is encapsulated
in an IP datagram with the source address set to the new client address, but the
destination address still is set to the broadcast address to let the other servers know
that their offer was not accepted.
4. Finally, the selected server responds with a DHCPACK message to the client if the
offered IP address is valid. If the server cannot keep its offer (for example, if the
address is offered to another host in between), the server sends a DHCPNACK
message and the client needs to repeat the process. This message is also broadcast
to let other servers know that the request is accepted or rejected.
A technology that can provide the mapping between the private and universal
addresses, and at the same time support virtual private networks, is Network
Address Translation (NAT).
The technology allows a site to use a set of private addresses for internal
communication and a set of global Internet addresses (at least one) for
communication with the rest of the world.
As the figure shows, the private network uses private addresses. The router that
connects the network to the global address uses one private address and one global
address. The private network is invisible to the rest of the Internet; the rest of the
Internet sees only the NAT router with the address 200.24.5.8.
Address Translation
All of the outgoing packets go through the NAT router, which replaces the source
address in the packet with the global NAT address.
All incoming packets also pass through the NAT router, which replaces the
destination address in the packet (the NAT router global address) with the
appropriate private address.
The network layer in version 4 can be thought of as one main protocol and three
auxiliary ones.
The Internet Control Message Protocol version 4 (ICMPv4) helps IPv4 to handle
some errors that may occur in the network-layer delivery.
The Address Resolution Protocol (ARP) is used to glue the network and data-link
layers in mapping network-layer addresses to link-layer addresses.
▪ The term best-effort means that IPv4 packets can be corrupted, be lost, arrive out
of order, or be delayed, and may create congestion for the network.
Fig 3.16: Position of IP and other network-layer protocols in TCP/IP protocol suite
Network-Layer Protocols
▪ 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.
▪ Again, IPv4 relies on a higher-level protocol to take care of all these problems.
Packets used by the IP are called datagrams. Figure 2.67a shows the IPv4 datagram
format. A datagram is a variable-length packet consisting of two parts:
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.
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.
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).
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: The time-to-live (TTL) field is used to control the maximum number
of hops (routers) visited by the datagram. 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.
Source and Destination Addresses: These 32-bit source and destination address
fields define the IP address of the source and destination respectively.
Network-Layer Protocols
Options:
A datagram header can have up to 40 bytes of options. Options can be used for
network testing and debugging.
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.
3.4.2 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.
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.
▪ The value of the MTU differs from one physical network protocol to another.
▪ 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.
▪ A datagram can be fragmented by the source host or any router in the path. The
reassembly of the datagram, however, is done only by the destination host,
because each fragment becomes an independent datagram.
Network-Layer Protocols
3.4.3 Options
The header of the IPv4 datagram is made of two parts: a fixed part and a variable
part.
▪ The fixed part is 20 bytes long and was discussed in the previous section. The
variable part comprises the options that can be a maximum of 40 bytes (in
multiples of 4-bytes) to preserve the boundary of the header.
▪ Options, as the name implies, are not required for a datagram. They can be used
for network testing and debugging.
Single-Byte Options
•No Operation
•End of Option
An end-of-option option is a 1-byte option used for padding at the end of the option
field. It, however, can only be used as the last option.
Multiple-Byte Options
• Record Route
A record route option is used to record the Internet routers that handle the
datagram.
A strict source route option is used by the source to predetermine a route for the
datagram as it travels through the Internet.
Network-Layer Protocols
A loose source route option is similar to the strict source route, but it is less rigid.
Timestamp
There are three security issues that are particularly applicable to the IP protocol:
packet sniffing, packet modification, and IP spoofing.
Packet Sniffing
An intruder may intercept an IP packet and make a copy of it. Packet sniffing is a
passive attack, in which the attacker does not change the contents of the packet.
This type of attack is very difficult to detect because the sender and the receiver
may never know that the packet has been copied.
Packet Modification
▪ The second type of attack is to modify the packet. The attacker intercepts the
packet, changes its contents, and sends the new packet to the receiver.
▪ The receiver believes that the packet is coming from the original sender.
▪ The receiver, before opening and using the contents of the message, can use this
mechanism to make sure that the packet has not been changed during the
transmission.
IP Spoofing
An attacker can masquerade as somebody else and create an IP packet that carries
the source address of another computer. An attacker can send an IP packet to a
bank pretending that it is coming from one of the customers. This type of attack can
be prevented using an origin authentication mechanism
Network-Layer Protocols
IPSec
The IP packets today can be protected from the previously mentioned attacks using
a protocol called IPSec (IP Security).
The two entities that want to create a secure channel between themselves can
agree on some available algorithms and keys to be used for security purposes.
❑ Data Integrity. Data integrity guarantees that the packet is not modified during
the transmission. If the received packet does not pass the data integrity test, it is
discarded. This prevents the second attack, packet modification, described above.
3.5 ICMPv4
▪ The IP protocol also lacks a mechanism for host and management queries.
▪ 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.
3.5.1 MESSAGES
ICMP messages are divided into two broad categories: error-reporting messages and
query messages.
The query messages, which occur in pairs, help a host or a network manager get
specific information from a router or another host.
▪ The data section in error messages carries information for finding the original packet that
had the error.
▪ In query messages, the data section carries extra information based on the type of query.
To make the error-reporting process simple, ICMP follows some rules in reporting messages.
▪ First, no error message will be generated for a datagram having a multicast address or
special address (such as this host or loopback).
▪ Third, no ICMP error message will be generated for a fragmented datagram that is not
the first fragment.
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.
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.
Network-Layer Protocols
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
▪ 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
▪ 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.
Deprecated Messages
1. Information request and replay messages are not used today because their duties
are done by the Address Resolution Protocol (ARP).
2. Address mask request and reply messages are not used today because their
duties are done by the Dynamic Host Configuration Protocol (DHCP)
3. Router solicitation and advertisement messages are not used today because their
duties are done by the Dynamic Host Configuration Protocol (DHCP)
Network-Layer Protocols
There are several tools that can be used in the Internet for debugging.
We introduce two tools that use ICMP for debugging: ping and traceroute.
Ping
We can use the ping program to find if a host is alive and responding. We use ping
here to see how it uses ICMP packets. The source host sends ICMP echo-request
messages; the destination, if alive, responds with ICMP echo-reply messages.
Traceroute or Tracert
The traceroute program in UNIX or tracert in Windows can be used to trace the path
of a packet from a source to the destination.
It can find the IP addresses of all the routers that are visited along the path. The
program is usually set to check for the maximum of 30 hops (routers) to be visited.
In ICMP the checksum is calculated over the entire message (header and data).
Section 3.6
ROUTING
3.6.1 General Idea
3.6.2 internet as a graph
3.6.3 Low cost routing and trees
3.6 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.
3.6.1 General Idea
In unicast routing, a packet is routed, hop by hop, from its source to its
destination by the help of forwarding tables. The source host needs no forwarding
table because it delivers its packet to the default router in its local network. The
destination host needs no forwarding table either because it receives the packet
from its default router in its local network. This means that only the routers that
glue together the networks in the internet need forwarding tables. With the above
explanation, routing a packet from its source to its destination means routing the
packet from a source router (the default router of the source host) to a destination
router (the router connected to the destination network).
3.6.2 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. An
internet is, in fact, modeled as a weighted graph, in which each edge is associated
with a cost. In routing, however, the cost of an edge has a different interpretation in
different routing protocols. If there is no edge between the nodes, the cost is
infinity.
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 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. In this way, we can have only one shortest-
path tree for each node; we have N least-cost trees for the whole internet.
The least-cost trees for a weighted graph can have several properties if they are
created using consistent criteria.
1. The least-cost route from X to Y in X’s tree is the inverse of the least-cost route
from Y to X in Y’s tree; the cost in both directions is the same.
2. Instead of travelling from X to Z using X’s tree, we can travel from X to Y using
X’s tree and continue from Y to Z using Y’s tree.
Section 3.7
UNICAST ROUTING
ALGORITHMS
3.7.1 Distance Vector Algorithms
3.7.2 Link State Algorithm
3.7.3 Path Vector Algorithm
3.7 ROUTING ALGORITHMS
We have different routing algorithms, The differences between these algorithms are
in the way they interpret the least cost and the way they create the least-cost tree
for each node.
3.7.1 Distance-Vector Routing
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).
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.
At the beginning, both nodes A and B know how to reach node X. But suddenly, the
link between A and X fails. Node A changes its table. If A can send its table to B
immediately, everything is fine. However, the system becomes unstable if B sends its
forwarding table to A before receiving A’s forwarding table. The cost of reaching X
increases gradually until it reaches infinity. At this moment, both A and B know that
X cannot be reached. However, during this time the system is not stable. Packets
bounce between A and B, creating a two-node loop problem. A few solutions have
been proposed for instability of this kind.
Split Horizon
One solution to instability is called split horizon. In this strategy, instead of
flooding the table through each interface, each node sends only part of its table
through each interface. If, according to its table, node B thinks that the optimum
route to reach X is via A, it does not need to advertise this piece of information to A;
the information has come from A (A already knows). Taking information from node
A, modifying it, and sending it back to node A is what creates the confusion. In our
scenario, node B eliminates the last line of its forwarding table before it sends it to
A. In this case, node A keeps the value of infinity as the distance to X. Later, when
node A sends its forwarding table to B, node B also corrects its forwarding table. The
system becomes stable after the first update: both node A and node B know that X
is not reachable.
Poison Reverse
Using the split-horizon strategy has one drawback. Normally, the
corresponding protocol uses a timer, and if there is no news about a route, the node
deletes the route from its table. When node B in the previous scenario eliminates
the route to X from its advertisement to A, node A cannot guess whether this is due
to the split-horizon strategy (the source of information was A) or because B has not
received any news about X recently. In the poison reverse strategy B can still
advertise the value for X, but if the source of information is A, it can replace the
distance with infinity as a warning: “Do not use this value; what I know about this
route comes from you.”
Three-Node Instability
The two-node instability can be avoided using split horizon combined with
poison reverse. However, if the instability is between three nodes, stability cannot be
guaranteed.
3.7.2 Link-State 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)
The collection of states for all links is called the link-state database (LSDB). There is
only one LSDB for the whole internet; each node needs to have a duplicate of it to
be able to create the least-cost tree.
Now the question is how each node can create this LSDB that contains information
about the whole internet. This can be done by a process called flooding. 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); the LSP is sent out
of each interface. When a node receives an LSP from one of its interfaces, it
compares the LSP with the copy it may already have. If the newly arrived LSP is
older than the one it has (found by checking the sequence number), it discards the
LSP. If it is newer or the first one received, the node discards the old LSP (if there is
one) and keeps the received one.
Forwarding Tables
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 Implementation
RIP is implemented as a process that uses the service of UDP on the well-
known port number 520. RIP is a daemon process (a process running in the
background), named routed (abbreviation for route daemon and pronounced route-
dee). This means that, although RIP is a routing protocol to help IP route its
datagrams through the AS, the RIP messages are encapsulated inside UDP user
datagrams, which in turn are encapsulated inside IP datagrams. In other words, RIP
runs at the application layer, but creates forwarding tables for IP at the network
later.
RIP Messages
Two RIP processes, a client and a server, like any other processes, need to
exchange messages. RIP-2 defines the format of the message, as shown in Figure.
Part of the message, which we call entry, can be repeated as needed in a message.
Each entry carries the information related to one line in the forwarding table of the
router that sends the message.
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 response (or update) message can be either solicited or unsolicited. A
solicited response message is sent only in answer to a request message. An
unsolicited response message, on the other hand, is sent periodically, every 30
seconds or when there is a change in the forwarding table.
RIP Algorithm
RIP implements the same algorithm as the distance-vector routing
algorithm. However, some changes need to be made to the algorithm to enable a
router to update its forwarding table:
❑ Instead of sending only distance vectors, a router needs to send the whole
contents of its forwarding table in a response message.
❑ The receiver adds one hop to each cost and changes the next router field to the
address of the sending router. We call each route in the modified forwarding table
the received route and each route in the old forwarding table the old route. The
received router selects the old routes as the new ones except in the following three
cases:
1. If the received route does not exist in the old forwarding table, it should be added
to the route.
2. If the cost of the received route is lower than the cost of the old one, the
received
route should be selected as the new one.
3. If the cost of the received route is higher than the cost of the old one, but the
value of the next router is the same in both routes, the received route should be
selected as the new one. This is the case where the route was actually advertised by
the same router in the past, but now the situation has been changed.
The new forwarding table needs to be sorted according to the destination route.
Timers in RIP
RIP uses three timers to support its operation. The periodic timer controls
the advertising of regular update messages. Each router has one periodic timer that
is randomly set to a number between 25 and 35 seconds (to prevent all routers
sending their messages at the same time and creating excess traffic). The timer
counts down; when zero is reached, the update message is sent, and the timer is
randomly set once again.
The expiration timer governs the validity of a route. When a router
receives update information for a route, the expiration timer is set to 180 seconds
for that particular route. Every time a new update for the route is received, the timer
is reset. If there is a problem on an internet and no update is received within the
allotted 180 seconds, the route is considered expired and the hop count of the route
is set to 16, which means the destination is unreachable. Every route has its own
expiration timer.
The garbage collection timer is used to purge a route from the forwarding
table. When the information about a route becomes invalid, the router does not
immediately purge that route from its table. Instead, it continues to advertise the
route with a metric value of 16. At the same time, a garbage collection timer is set
to 120 seconds for that route. When the count reaches zero, the route is purged
from the table. This timer allows neighbors to become aware of the invalidity of a
route prior to purging.
Performance
1. Update Messages. The update messages in RIP have a very simple format and
are sent only to neighbors; they are local.
2. Convergence of Forwarding Tables. RIP uses the distance-vector algorithm,
which can converge slowly if the domain is large, but, since RIP allows only 15 hops
in a domain (16 is considered as infinity), there is normally no problem in
convergence.
3. Robustness. The calculation of the forwarding table depends on information
received from immediate neighbors, which in turn receive their information from
their own neighbors. If there is a failure or corruption in one router, the problem will
be propagated to all routers and the forwarding in each router will be affected.
3.8.4 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 OSPF is an open protocol,
which means that the specification is a public document.
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 interesting point about the cost in OSPF is that different
service types (TOSs) can have different weights as the cost.
Forwarding Tables
Each OSPF router can create a forwarding table after finding the shortest-
path tree between itself and the destination using Dijkstra’s algorithm. Figure shows
the forwarding tables for the simple AS. Comparing the forwarding tables for the
OSPF and RIP in the same AS, we find that the only difference is the cost values.
Areas
Compared with RIP, which is normally used in small ASs, OSPF was
designed to be able to handle routing in a small or large autonomous system.
Although flooding may not create a problem in a small AS, it may have created a
huge volume of traffic in a large AS. To prevent this, the AS needs to be divided into
small sections called areas. Each area acts as a small independent domain for
flooding LSPs. In other words, OSPF uses another level of hierarchy in routing: the
first level is the autonomous system, the second is the area.
One of the areas in the AS is designated as the backbone area,
responsible for gluing the areas together. The routers in the backbone area are
responsible for passing the information collected by each area to all other areas. In
this way, a router in an area can receive all LSPs generated in other areas. For the
purpose of communication, each area has an area identification. The area
identification of the backbone is zero.
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.
we need different types of advertisements, each capable of advertising different
situations. We can have five types of link-state advertisements: router link, network
link, summary link to network, summary link to AS border router, and external link.
Router link- A router link advertises the existence of a router as a node. A transient
link announces a link to a transient network, a network that is connected to the rest
of the networks by one or more routers. This type of advertisement should define
the address of the transient network and the cost of the link. A stub link advertises a
link to a stub network, a network that is not a through network. Again, the
advertisement should define the address of the network and the cost. A point-to-
point link should define the address of the router at the end of the point-to-point
line and the cost to get there.
Network link-A network link advertises the network as a node. However, since a
network cannot do announcements itself (it is a passive entity), one of the routers is
assigned as the designated router and does the advertising.
Summary link to network-This is done by an area border router; it advertises the
summary of links collected by the backbone to an area or the summary of links
collected by the area to the backbone
Summary link to AS-This is done by an AS router that advertises the summary links
from other ASs to the backbone area of the current AS, information which
later can be disseminated to the areas so that they will know about the networks in
other ASs.
External link. This is also done by an AS router to announce the existence of a single
network outside the AS to the backbone area to be disseminated into the areas.
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.
The hello message (type 1) is used by a router to introduce itself to the neighbors
and announce all neighbors that it already knows. The database description
message (type 2) is normally sent in response to the hello message to allow a newly
joined router to acquire the full LSDB. The linkstate request message (type 3) is sent
by a router that needs information about a specific LS. The link-state update
message (type 4) is the main OSPF message used for building the LSDB. The link-
state acknowledgment message (type 5) is used to create reliability in OSPF; each
router that receives a link-state update message needs to acknowledge it.
OSPF Algorithm
OSPF implements the link-state routing algorithm we discussed in the
previous section. However, some changes and augmentations need to be added to
the algorithm:
❑ After each router has created the shortest-path tree, the algorithm needs to use it
to create the corresponding routing algorithm.
❑ The algorithm needs to be augmented to handle sending and receiving all five
types of messages.
Performance
Update Messages. The link-state messages in OSPF have a somewhat complex
format. They also are flooded to the whole area. If the area is large, these
messages may create heavy traffic and use a lot of bandwidth.
❑ Convergence of Forwarding Tables. When the flooding of LSPs is completed,
each router can create its own shortest-path tree and forwarding table; convergence
is fairly quick. However, each router needs to run Dijkstra’s algorithm, which may
take some time.
OSPF MESSAGE FORMAT
3.8.5 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.
A variation of BGP4, called external BGP (eBGP), on each border router (the one at
the edge of each AS which is connected to a router at another AS). We then install
the second variation of BGP, called internal BGP (iBGP), on all routers. This means
that the border routers will be running three routing protocols (intradomain, eBGP,
and iBGP), but other routers are running two protocols (intradomain and iBGP). We
discuss the effect of each BGP variation separately.
Operation of External BGP (eBGP)
We can say that BGP is a kind of point-to-point protocol. When the
software is installed on two routers, they try to create a TCP connection using the
well-known port 179. The two routers that run the BGP processes are called BGP
peers or BGP speakers
The eBGP variation of BGP allows two physically connected border routers
in two different ASs to form pairs of eBGP speakers and exchange messages. The
routers that are eligible in our example in Figure form three pairs: R1-R5, R2-R6,
and R4- R9. The connection between these pairs is established over three physical
WANs (N5, N6, and N7). Each logical connection in BGP parlance is referred to as a
session. This means that we need three sessions in our example, For example,
message number 1 is sent by router R1 and tells router R5 that N1, N2, N3, and N4
can be reached through router R1 (R1 gets this information from the corresponding
intradomain forwarding table). Router R5 can now add these pieces of information
at the end of its forwarding table. When R5 receives any packet destined for these
four networks, it can use its forwarding table and find that the next router is R1.
There are two problems that need to be addressed:
1. Some border routers do not know how to route a packet destined for nonneighbor
ASs. For example, R5 does not know how to route packets destined for networks in
AS3 and AS4. Routers R6 and R9 are in the same situation as R5: R6 does not know
about networks in AS2 and AS4; R9 does not know about networks in AS2 and AS3.
2. None of the nonborder routers know how to route a packet destined for any
networks in other ASs.
To address the above two problems, we need to allow all pairs of routers (border or
nonborder) to run the second variation of the BGP protocol, iBGP.
Operation of Internal BGP (iBGP)
The iBGP protocol is similar to the eBGP protocol in that it uses the service
of TCP on the well-known port 179, but it creates a session between any possible
pair of routers inside an autonomous system. First, if an AS has only one router,
there cannot be an iBGP session. For example, we cannot create an iBGP session
inside AS2 or AS4 in our internet. Second, if there are n routers in an autonomous
system, there should be [n × (n − 1) / 2] iBGP sessions in that autonomous system
(a fully connected mesh) to prevent loops in the system.
The first message (numbered 1) is sent by R1 announcing that networks
N8 and N9 are reachable through the path AS1-AS2, but the next router is R1. This
message is sent, through separate sessions, to R2, R3, and R4. Routers R2, R4, and
R6 do the same thing but send different messages to different destinations. The
interesting point is that, at this stage, R3, R7, and R8 create sessions with their
peers, but they actually have no message to send. The updating process does not
stop here. For example, after R1 receives the update message from R2, it combines
the reachability information about AS3 with the reachability information it already
knows about AS1 and sends a new update message to R5. Now R5 knows how to
reach networks in AS1 and AS3. The process continues when R1 receives the update
message from R4.
Finalized BGP path tables
Forwarding tables after injection from BGP
Path Attributes
In both intradomain routing protocols (RIP or OSPF), a destination is
normally associated with two pieces of information: next hop and cost. The first one
shows the address of the next router to deliver the packet; the second defines the
cost to the final destination. Interdomain routing is more involved and naturally
needs more information about how to reach the final destination. In BGP these
pieces are called path attributes. BGP allows a destination to be associated with up
to seven path attributes. Path attributes are divided into two broad categories: well-
known and optional. A well-known attribute must be recognized by all routers; an
optional attribute need not be.
ORIGIN (type 1) .
AS-PATH (type 2).
NEXT-HOP (type 3).
MULT-EXIT-DISC (type 4).
LOCAL-PREF (type 5).
ATOMIC-AGGREGATE (type 6).
AGGREGATOR (type 7).
Route Selection
A route in BGP has some attributes attached to it and it may come from
an eBGP session or an iBGP session. Figure shows the flow diagram as used by
common implementations. The router extracts the routes which meet the criteria in
each step. If only one route is extracted, it is selected and the process stops;
otherwise, the process continues with the next step. Note that the first choice is
related to the LOCAL-PREF attribute, which reflects the policy imposed by the
administration on the route.
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.
❑ 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.
Section 3.9
MULTICAST ROUTING
3.9.1 Concepts of Unicast, Multicast, Broadcast
3.9.2 Applications of Multicast
3.9.3 Optimal Routing Protocols
3.9.4 Multicast Routing Protocols
3.9.4.1 MOSPF
3.9.4.2 DVMRP
3.9.4.3 CBT
3.9.4.4 PIM
3.9 MULTICAST ROUTING PROTOCOLS
3.9.1 Concepts of unicast, multicast, or broadcast
A message can be unicast, multicast, or broadcast.
Unicasting
In unicast communication, there is one source and one destination. The
relationship between the source and the destination is one-to-one.
In this type of communication, both the source and destination addresses,
in the IP datagram, are the unicast addresses assigned to the hosts (or host
interfaces, to be more exact). In Figure, a unicast packet starts from the source S1
and passes through routers to reach the destination D1.
Multicasting starts with one single packet from the source that is duplicated by the
routers. The destination address in each packet is the same for all duplicates. Note
that only one single copy of the packet travels between any two routers.
In multiple unicasting, several packets start from the source. If there are five
destinations, for example, the source sends five packets, each with a different
unicast destination address.
There may be multiple copies traveling between two routers. For example, when a
person sends an e-mail message to a group of people, this is multiple unicasting.
The e-mail software creates replicas of the message, each with a different
destination address and sends them one by one. This is not multicasting; it is
multiple unicasting.
3.9.2 Applications
Multicasting has many applications such as access to distributed databases,
information dissemination, teleconferencing, and distance learning.
(i) Access to Distributed Databases
Most of the large databases are distributed. That is, the information is stored in
more than one location, usually at the time of production. The user who needs to
access the database does not know the location of the information. A user's request
is multicast to all the database locations, and the location that has the information
responds.
(ii) Information Dissemination
Businesses often need to send information to their customers. If the nature of the
information is the same for each customer, it can be multicast. In this way a
business can send one message that can reach many customers. For example, a
software update can be sent to all purchasers of a particular software package.
(iii) Dissemination of News
News can be easily disseminated through multicasting. One single message can be
sent to those interested in a particular topic. For example, the statistics of the
championship high school basketball tournament can be sent to the sports editors of
many newspapers.
(iv) Teleconferencing
Teleconferencing involves multicasting. The individuals attending a teleconference all
need to receive the same information at the same time. Temporary or permanent
groups can be formed for this purpose. For example, an engineering group that
holds meetings every Monday morning could have a permanent group while the
group that plans the holiday party could form a temporary group.
Formation of the Tree: After the rendezvous point is selected; every router is
informed of the unicast address of the selected router. Each router then sends a
unicast join message (similar to a grafting message) to show that it wants to join
the group. This message passes through all routers that are located between the
sender and the rendezvous router. Each intermediate router extracts the necessary
information from the message, such as the unicast address of the sender and the
interface through which the packet has arrived, and forwards the message to the
next router in the path. When the rendezvous router has received all join messages
from every member of the group, the tree is formed. Now every router knows its
upstream router (the router that leads to the root) and the downstream router (the
router that leads to the leaf).
If a router wants to leave the group, it sends a leave message to its upstream
router. The upstream router removes the link to that router from the tree and
forwards the message to its upstream router and so on. Figure shows a group-
shared tree with its rendezvous router.
There are two differences between DVMRP and MOSPF, on one hand, and CBT, on
the other. First, the tree for the first two is made from the root up; the tree for CBT
is formed from the leaves down. Second, in DVMRP, the tree is first made
(broadcasting) and then pruned; in CBT, there is no tree at the beginning; the
joining (grafting) gradually makes the tree.
Sending Multicast Packets: After formation of the tree, any source (belonging to
the group or not) can send a multicast packet to all members of the group. It simply
sends the packet to the rendezvous router, using the unicast address of the
rendezvous router; the rendezvous router distributes the packet to all members of
the group. Figure shows how a host can send a multicast packet to all members of
the group. The source host can be any of the hosts inside the shared tree or any
host outside the shared tree.
3.9.4.4 Protocol Independent Multicast: PIM
Protocol Independent Multicast (PIM) is the name given to two independent
multicast routing protocols: Protocol Independent Multicast, Dense Mode (PIM-DM)
and Protocol Independent Multicast, Sparse Mode (PIM-SM). Both protocols are
unicast protocol- dependent.
PIM-DM: PIM-DM is used when there is a possibility that each router is involved in
multicasting (dense mode). In this environment, the use of a protocol that
broadcasts the packet is justified because almost all routers are involved in the
process.
PIM-DM is a source-based tree routing protocol that uses RPF and pruning and
grafting strategies for multicasting. Its operation is like that of DVMRP; however,
unlike DVMRP, it does not depend on a specific unicasting protocol. It assumes that
the autonomous system is using a unicast protocol and each router has a table that
can find the outgoing interface that has an optimal path to a destination. This
unicast protocol can be a distance vector protocol (RIP) or link state protocol
(OSPF).
PIM-SM: PIM-SM is used when there is a slight possibility that each router is
involved in multicasting (sparse mode). In this environment, the use of a protocol
that broadcasts the packet is not justified; a protocol such as CBT that uses a group-
shared tree is more appropriate.
PIM-SM is a group-shared tree routing protocol that has a rendezvous point (RP) as
the source of the tree. Its operation is like CBT; however, it is simpler because it
does not require acknowledgment from a join message. In addition, it creates a
backup set of RPs for each region to cover RP failures. One of the characteristics of
PIM-SM is that it can switch from a group- shared tree strategy to a source-based
tree strategy when necessary. This can happen if there is a dense area of activity far
from the RP. That area can be more efficiently handled with a source- based tree
strategy instead of a group-shared tree strategy.
Multicast Backbone :MBONE
Multimedia and real-time communications have increased the need for multicasting
in the Internet. However, only a small fraction of Internet routers are multicast
routers. In other words, a multicast router may not find another multicast router in
the neighborhood to forward the multicast packet.
A logical tunnel is established by encapsulating the multicast packet inside a unicast
packet. The multicast packet becomes the payload (data) of the unicast packet. The
intermediate (non multicast) routers forward the packet as unicast routers and
deliver the packet from one island to another. It's as if the unicast routers do not
exist and the two multicast routers are neighbors. Figure shows the concept. So far
the only protocol that supports MBONE and tunneling is DVMRP.
MBONE
Section 3.10
IPv6 ADDRESS
3.10.1 Representation of IPv6
3.10.2 Address Space
3.10.3 Auto Configuration
3.10.4 Renumbering
3.10 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.
3.10.1 Representation
A computer normally stores the address in binary, but it is clear that 128 bits cannot
easily be 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.
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. Note that this type of abbreviation is
allowed only once per address. If there is more than one run of zero sections, only
one of them can be compressed.
Mixed Notation
Sometimes we see a mixed representation of an IPv6 address: colon hex
and dotted decimal notation. This is appropriate during the transition period in which
an IPv4 address is embedded in an IPv6 address (as the rightmost 32 bits). We can
use the colon hex notation for the leftmost six sections and four-byte dotted-decimal
notation instead of the rightmost two sections. However, this happens when all or
most of the leftmost sections of the IPv6 address are 0s. For example, the address
(::130.24.24.18) is a legitimate address in IPv6, in which the zero compression
shows that all 96 leftmost bits of the address are zeros.
CIDR Notation
IPv6 uses hierarchical addressing. For this reason, IPv6 allows slash or
CIDR notation. For example, the following shows how we can define a prefix of 60
bits using CIDR.
Address Space
The address space of IPv6 contains 2128 addresses. This address space is
296 times the IPv4 address—definitely no address depletion. The size of the space is
Each person can have 288 addresses to use. Address depletion in this version is
impossible.
Three Address Types
In IPv6, a destination address can belong to one of three categories:
unicast, anycast, and multicast.
Unicast Address
A unicast address defines a single interface (computer or router). The
packet sent to a unicast address will be routed to the intended recipient.
Anycast Address
An anycast address defines a group of computers that all share a single
address. A packet with an anycast address is delivered to only one member of the
group, the most reachable one. An anycast communication is used, for example,
when there are several servers that can respond to an inquiry. The request is sent to
the one that is most reachable. The hardware and software generate only one copy
of the request; the copy reaches only one of the servers. IPv6 does not designate a
block for anycasting; the addresses are assigned from the unicast block.
Multicast Address
A multicast address also defines a group of computers. However, there is a
difference between anycasting and multicasting. In anycasting, only one copy of the
packet is sent to one of the members of the group; in multicasting each member of
the group receives a copy. IPv6 has designated a block for multicasting from which
the same address is assigned to the members of the group. It is interesting that
IPv6 does not define broadcasting, even in a limited version. IPv6 considers
broadcasting as a special case of multicasting.
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. Table
shows only the assigned blocks. In this table, the last column shows the fraction
each block occupies in the whole address space.
Example
Using the format we defined for Ethernet addresses, find the interface
identifier if the Ethernet physical address is (F5-A9-23-14-7A-D2)16.
Solution
We only need to change the seventh bit of the first octet from 0 to 1,
insert two octets FFFE16 and change the format to colon hex notation. The result is
F7A9:23FF:FE14:7AD2 in colon hex.
Example
An organization is assigned the block 2000:1456:2474/48. What is the IPv6 address
of an interface in the third subnet if the IEEE physical address of the computer is
(F5-A9-23-14-7A-D2)16?
Solution
The interface identifier for this interface is F7A9:23FF:FE14:7AD2 . If we
append this identifier to the global prefix and the subnet identifier, we get
2000:1456:2474:0003:F7A9:23FF:FE14:7AD2/128
Special Addresses
The unspecified address is a sub block containing only one address, which is used
during bootstrap when a host does not know its own address and wants to send an
inquiry to find it. The loopback address also consists of one address. A compatible
address is an address of 96 bits of zero followed by 32 bits of IPv4 address. It is
used when a computer using IPv6 wants to send a message to another computer
using IPv6. A mapped address is used when a computer already migrated to version
6 wants to send an address to a computer still using version 4.
Other Assigned Blocks
A sub block in a unique local unicast block can be privately created and
used by a site. The packet carrying this type of address as the destination address is
not expected to be routed. This type of address has the identifier 1111 110, the next
bit can be 0 or 1 to define how the address is selected (locally or by an authority).
The next 40 bits are selected by the site using a randomly generated number of
length 40 bits. This means that the total of 48 bits defines a subblock that looks like
a global unicast address.
The second block, designed for private addresses, is the link local block. A subblock
in this block can be used as a private address in a network. Multicast addresses are
used to define a group of hosts instead of just one. In IPv6 a large block of
addresses are assigned for multicasting. All these addresses use the prefix
11111111. The second field is a flag that defines the group address as either
permanent or transient. A permanent group address is defined by the Internet
authorities and can be accessed at all times. A transient group address, on the other
hand, is used only temporarily.
3.10.3 Autoconfiguration
One of the interesting features of IPv6 addressing is the autoconfiguration of hosts.
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.
When a host in IPv6 joins a network, it can configure itself using the following
process:
1. The host first creates a link local address for itself. This is done by taking the 10-
bit link local prefix (1111 1110 10), adding 54 zeros, and adding the 64-bit interface
identifier, which any host knows how to generate from its interface card. The result
is a 128-bit link local address.
2. The host then tests to see if this link local address is unique and not used by
other hosts. Since the 64-bit interface identifier is supposed to be unique, the link
local address generated is unique with a high probability. However, to be sure, the
host sends a neighbor solicitation message and waits for a neighbor advertisement
message. If any host in the subnet is using this link local address, the process fails
and the host cannot autoconfigure itself; it needs to use other means such as DHCP
for this purpose.
3. If the uniqueness of the link local address is passed, the host stores this address
as its link local address (for private communication), but it still needs a global
unicast address. The host then sends a router solicitation message to a local router.
If there is a router running on the network, the host receives a router advertisement
message that includes the global unicast prefix and the subnet prefix that the host
needs to add to its interface identifier to generate its global unicast address. If the
router cannot help the host with the configuration, it informs the host in the router
advertisement message (by setting a flag). The host then needs to use other means
for configuration.
Example
Assume a host with Ethernet address (F5-A9-23-11-9B-E2)16 has joined
the network. What would be its global unicast address if the global unicast prefix of
the organization is
3A21:1216:2165 and the subnet identifier is A245:1232?
Solution
The host first creates its interface identifier as F7A9:23FF:FE11:9BE2 using
the Ethernet address read from its card. The host then creates its link local address
as:
FE80::F7A9:23FF:FE11:9BE2
Assuming that this address is unique, the host sends a router solicitation message
and receives the router advertisement message that announces the combination of
global unicast prefix and the subnet identifier as 3A21:1216:2165:A245:1232. The
host then appends its interface identifier to this prefix to find and store its global
unicast address as:
3A21:1216:2165:A245:1232:F7A9:23FF:FE11:9BE2
3.10.4 Renumbering
To allow sites to change the service provider, renumbering of the address
prefix (n) was built into IPv6 addressing. Each site is given a prefix by the service
provider to which it is connected. If the site changes the provider, the address prefix
needs to be changed. A router to which the site is connected can advertise a new
prefix and let the site use the old prefix for a short time before disabling it. In other
words, during the transition period, a site has two prefixes. The main problem in
using the renumbering mechanism is the support of the DNS, which needs to
propagate the new addressing associated with a domain name. A new protocol for
DNS, called Next Generation DNS, is under study to provide support for this
mechanism.
Section 3.11
TRANSITION FROM
IPv4 TO IPv6
3.11 TRANSITION FROM IPv4 TO IPv6
Although we have a new version of the IP protocol, how can we make the transition
to stop using IPv4 and start using IPv6? The first solution that comes to mind is to
define a transition day on which every host or router should stop using the old
version and start using the new version. However, this is not practical; because of
the huge number of systems in the Internet, the transition from IPv4 to IPv6 cannot
happen suddenly. It will take a considerable amount of time before every system in
the Internet can move from IPv4 to IPv6. The transition must be smooth to prevent
any problems between IPv4 and IPv6 systems.
Strategies
Three strategies have been devised for transition: dual stack, tunneling,
and header translation. One or all of these three strategies can be implemented
during the transition period.
Dual Stack
It is recommended that all hosts, before migrating completely to version
6, have a dual stack of protocols during the transition. In other words, a station
must run IPv4 and IPv6 simultaneously until all the Internet uses IPv6. See Figure
for the layout of a dual-stack configuration. To determine which version to use when
sending a packet to a destination, the source host queries the DNS. If the DNS
returns an IPv4 address, the source host sends an IPv4 packet. If the DNS returns
an IPv6 address, the source host sends an IPv6 packet.
Tunneling
Tunneling is a strategy used when two computers using IPv6 want to
communicate with each other and the packet must pass through a region that uses
IPv4. To pass through this region, the packet must have an IPv4 address. So the
IPv6 packet is encapsulated in an IPv4 packet when it enters the region, and it
leaves its capsule when it exits the region. It seems as if the IPv6 packet enters a
tunnel at one end and emerges at the other end. To make it clear that the IPv4
packet is carrying an IPv6 packet as data, the protocol value is set to 41. Tunneling
is shown in Figure.
Header Translation
Header translation is necessary when the majority of the Internet has
moved to IPv6 but some systems still use IPv4. The sender wants to use IPv6, but
the receiver does not understand IPv6. Tunneling does not work in this situation
because the packet must be in the IPv4 format to be understood by the receiver. In
this case, the header format must be totally changed through header translation.
The header of the IPv6 packet is converted to an IPv4 header.
During the transition a host may need to use two addresses, IPv4 and IPv6. When
the transition is complete, IPv4 addresses should disappear. The DNS servers need
to be ready to map a host name to either address type during the transition, but the
IPv4 directory will disappear after all hosts in the world have migrated toIPv6.
Links for online Lecture Videos and
Lecture PPTs
LINKS FOR ONLINE LECTURE VIDEOS AND LECTURE
SLIDES
Group I Group II
i) 128.96.171.92 a) Interface 0
iii) 128.96.163.151 c) R2
iv) 128.96.165.121 d) R3
e) R4
Q.N Question Course K-Level
o Outcome
5. Consider a network with 6 routers R1 to R6 connected
with links having weights as shown in the following
diagram. All the routers use the distance vector based
routing algorithm to update their routing tables. Each CO3 K5
router starts with its routing table initialized to contain an
entry for each neighbour with the weight of the respective
connecting link. After all the routing tables stabilize,
which of the links in the network will never be used for
carrying any data? (13)
Part A Q & A (With K - Level and CO)
Part-A Questions & Answers
6 Explain about IPv6? Compare IPv4 and IPv6. (May/June 2016) K3 CO3
learning.
inference.
Content Beyond Syllabus
Content Beyond Syllabus
2 First internal
Assessment Test 23.08.24
4 Second Internal
Assessment Test 04.10.24
PROJECT 2
Create a wireless network with Arduino Uno Board with required shields and create a
network to monitor the health signals of soldier in warfield.
DESCRIPTION:
Sensors in a kind of wearable which constantly updates the health signals of the
soldiers in the war field.
PROJECT 3
One of your clients wants to automate his entire home with smart IoT devices and
you were asked to submit the model of his future smart home. Simulate an
automated home with smart IoT devices such as electrical appliances operated over
phone, automatic door open and close mechanisms, and fire or smoke detection
alarm system. Make sure all the network nodes are communicating each other with
wireless connection.
PROJECT 4
An organization has totally 16,384 addresses starting from 120.14.64.0. It decides
to distribute these addresses to four of its headquarters A, B, C and D, each with
4096 addresses. The headquarters A and D have the following address
allocations.
(a) The headquarters A distributes the addresses to eight of its branch offices,
each with 512 addresses. Further, each of these branch offices allocates addresses
to 128 customers, each with 4 addresses.
(b) The headquarters D assigns the addresses to its sixteen branches, each with
256 addresses.
Give the starting and ending address allocation for all the hierarchical levels
(Organization, Head Quarters, Branch and customer), along with subnet mask
• PROJECT 5
• Multi-View Video Transmission over the Internet
• DESCRIPTION:
3D television using multiple views rendering is receiving increasing interest. In this
technology a number of video sequences are transmitted simultaneously and
provides a larger view of the scene or stereoscopic viewing experience. With two
views stereoscopic rendition is possible. Nowadays 3D displays are available that are
capable of displaying several views simultaneously and the user is able to see
different views by moving his head.
Thank you
Disclaimer:
This document is confidential and intended solely for the educational purpose of RMK Group
of Educational Institutions. If you have received this document through email in error,
please notify the system manager. This document contains proprietary information and is
intended only to the respective group / learning community as intended. If you are not the
addressee you should not disseminate, distribute or copy through e-mail. Please notify the
sender immediately by e-mail if you have received this document by mistake and delete this
document from your system. If you are not the intended recipient you are notified that
disclosing, copying, distributing or taking any action in reliance on the contents of this
information is strictly prohibited.