EC3401 NS Unit - 2
EC3401 NS Unit - 2
2
They can also be highly dynamic, being determined anew for each packet, to reflect the current
network load.
If too many packets are present in the subnet at the same time, they will get into one another's way,
forming bottlenecks. The control of such congestion also belongs to the network layer.
Moreover, the quality of service provided (delay, transmit time, jitter, etc) is also a network layer
issue.
When a packet has to travel from one network to another to get to its destination, many problems
can arise such as:
o The addressing used by the second network may be different from the first one.
o The second one may not accept the packet at all because it is too large.
o The protocols may differ, and so on.
It is up to the network layer to overcome all these problems to allow heterogeneous networks to be
interconnected.
Packet Switching
Packet switching is a method for sending data whereby the data is divided in packets.
Each packet is given a header containing information of the destination.
Each packet is forwarded through the network to the destination using this information.
At the destination the data has to be reassembled from the received packages.
There are two common packet switching methods in use:
Datagram Approach: Connectionless Service
o Each packet is forwarded independently based on the destination address.
o Routing decisions are made dynamically, so each packet may follow a different route and
thus the packages may arrive out of order.
3
Figure: A virtual-circuit packet-switched network
****************************************************************************
IPV4 Address
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.
An address space is the total number of addresses used by the protocol.
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).
Figure below shows the prefix and suffix of a 32-bit IPv4 address.
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 classfull addressing.
The new scheme, which is referred to as classless addressing, uses a variable-length network prefix.
4
Classfull Addressing
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 the
Figure.
This scheme is referred to as classfull addressing.
Advantages of Subnetting
Minimizes the network traffic through decreasing the volume of broadcasts.
Increases addressing flexibility.
5
Disadvantages of Subnetting
However, it is quite expensive.
It requires trained administrator to perform subnetting.
Supernetting
Supernetting is the method used for combining the smaller ranges of addresses into larger space.
It was devised to make the routing process more convenient.
Additionally, it reduces the size of routing table information so that it could consume less space in
the router’s memory.
It is inverse process of subnetting, in which several networks are merged into a single network.
While performing supernetting, the mask bits are moved toward the left of the default mask.
The supernetting is also known as router summarization and aggregation.
It results in the creation of more host addresses at the expense of network addresses, where basically
the network bits are converted into host bits.
The supernetting is performed by internet service provider rather than the normal users, to achieve
the most efficient IP address allocation.
CIDR (Classless Inter-Domain Routing) is scheme used to route the network traffic across the
internet.
CIDR is a supernetting technique where the several subnets are combined together for the network
routing.
In simpler words, CIDR allows the IP addresses to be organized in the subnetworks independent of
the value of the addresses.
Advantages of Supernetting
The size of the router memory table is minimized.
It also increases the speed of routing table lookup.
Provision for the router to isolate the topology changes from the other routers.
7
The next issue in classless addressing is block allocation.
The ultimate responsibility of block allocation is given to a global authority called the Internet
Corporation for Assigned Names and Numbers (ICANN).
It assigns a large block of addresses to an ISP (or a larger organization that is considered an ISP in
this case).
For the proper operation of the CIDR, two restrictions need to be applied to the allocated block.
o The number of requested addresses, N, needs to be a power of 2. The reason is that N = 232 - n
or n = 32 - log2N. If N is not a power of 2, we cannot have an integer value for n.
o The requested block needs to be allocated where there are an adequate number of contiguous
addresses available in the address space. However, there is a restriction on choosing the first
address in the block. The first address needs to be divisible by the number of addresses in the
block. The reason is that the first address needs to be the prefix followed by (32 − n) number
of 0s. The decimal value of the first address is then,
first address = (prefix in decimal) x 232 - n = (prefix in decimal) x N.
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
The five special addresses that are used for special purposes: this-host address, limited-broadcast
address, loopback address, private addresses, and multicast 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
8
The only address in the block 255.255.255.255/32 is called the limited-broadcast address.
It is used whenever a router or a host needs to send a datagram to all devices in a network.
Loopback Address
The block 127.0.0.0/8 is called the 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
Four blocks are assigned as private addresses: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, and
169.254.0.0/16.
Multicast Addresses
The block 224.0.0.0/4 is reserved for multicast addresses.
********************************************************************************
9
Figure: A simple internetwork where H represents hosts and R represents routers
Datagram Delivery
Best-effort, connectionless service is used by IP to deliver a datagram
Packets can be lost or corrupted. It can also be delivered out of order.
IP provides neither error control nor flow control. It is an unreliable service.
Datagram Format
Packets used by the IP are called datagrams.
A datagram is a variable-length packet consisting of two parts: header and payload (data).
The header is 20 to 60 bytes in length and contains information essential to routing and delivery.
Minimum packet length is 20 bytes and maximum 65,535 bytes.
11
There are three fields in an IP datagram are related to fragmentation: identification, flags, and
fragmentation offset.
The 16-bit identification field identifies a datagram originating from the source host.
The 3-bit flags field defines three flags.
o The leftmost bit is reserved (not used).
o 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 its value is 0, the datagram can be fragmented if necessary.
o 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.
********************************************************************
12
ICMP 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.
Destination Unreachable―When a router cannot route a datagram, the datagram is discarded and
sends a destination unreachable message to source host.
13
Destination-unreachable messages include four basic types: They are,
o Network Unreachable
o Host Unreachable
o Protocol Unreachable
o Port Unreachable
Network-Unreachable
It indicates that the router cannot find the destination network (does not exist or has failed) or
has no route to this network.
Host-Unreachable
It alerts the sending host that the destination host requested cannot be found.
Protocol-Unreachable
It indicates that the Transport layer protocol (UDP or TCP) is not available.
Port-Unreachable
It indicates that the process or application in the source host is attempting to establish a
connection which is not active on the destination host.
Source Quench ― It informs the sender that the network has encountered congestion and the
datagram has been dropped; the source needs to slow down sending more datagrams.
Time Exceeded ― Router discards a datagram when TTL field becomes 0 and a time exceeded
message is sent to the source host.
Parameter Problem ― If a router discovers ambiguous or missing value in any field of the
datagram, it discards the datagram and sends parameter problem message to source.
Redirection ― 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.
Query Messages
Query messages are used to diagnose some network problems.
Echo Request & Reply ― The echo request (type 8) and the echo reply (type 0) pair of messages is
used by a host or a router to test the liveliness of another host or router.
Timestamp Request & Reply ― The timestamp request (type 13) and the timestamp reply (type 14)
pair of messages is used to find the round-trip time between two devices or to check whether the
clocks in two devices are synchronized.
Address Mask Request & Reply
14
o If the host knows the address of the router; it sends the request directly to the router.
o If it does not know, it broadcasts the message.
o The router receiving the address mask request message responds with an address mask reply
message, providing the necessary mask for the host.
Router Advertisement & Solicitation
o A host that wants to send data to a host on another network needs to know the address of
routers connected to its own network.
o A host broadcasts a router solicitation message to know about the router.
o Router broadcasts its routing information with router advertisement message.
********************************************************************
Mobile IP
Mobile IP (or MIP) is an Internet Engineering Task Force (IETF) standard communications protocol
that is designed to allow mobile device users to move from one network to another while maintaining
a permanent IP address.
Stationary Hosts
A host in the Internet does not have an address that it can carry with itself from one place to another.
The address is valid only when the host is attached to the network.
If the network changes, the address is no longer valid.
This scheme works perfectly with stationary hosts.
“The IP addresses are designed to work with stationary hosts because part of the address defines the
network to which the host is attached.”
Mobile Hosts
When a host moves from one network to another, the IP addressing structure needs to be modified.
Changing the Address
One simple solution is to let the mobile host change its address as it goes to the new network.
The host can use DHCP to obtain a new address to associate it with the new network.
Two Addresses
Mobile IP has two addresses for a mobile host: one home address and one care-of address.
The home address is permanent;
The care-of address changes as the mobile host moves from one network to another.
Foreign Agent
The foreign agent is usually a router attached to the foreign network.
The foreign agent receives and delivers packets sent by the home agent to the mobile host.
The mobile host can also act as a foreign agent. In other words, the mobile host and the foreign agent
can be the same.
However, to do this, a mobile host must be able to receive a care-of address by itself, which can be
done through the use of DHCP.
When the mobile host acts as a foreign agent, the care-of address is called a collocated care-of
address.
When the mobile host and the foreign agent are the same, the care-of address is called a
collocated care-of address.
Three Phases
To communicate with a remote host, a mobile host goes through three phases: agent discovery,
registration, and data transfer.
16
Figure: Remote Host and Mobile Host Communication
The first phase, agent discovery, involves the mobile host, the foreign agent, and the home agent.
The second phase, registration, also involves the mobile host and the two agents.
Finally, in the third phase, the remote host is also involved.
Agent Discovery
The first phase in mobile communication, agent discovery, consists of two subphases.
A mobile host must discover (learn the address of) a home agent before it leaves its home network.
A mobile host must also discover a foreign agent after it has moved to a foreign network.
This discovery consists of learning the care-of address as well as the foreign agent’s address.
The discovery involves two types of messages: advertisement and solicitation.
Agent Advertisement
When a router advertises its presence on a network using an ICMP router advertisement, it can
append an agent advertisement to the packet if it acts as an agent.
17
o Sequence number - The 16-bit sequence number field holds the message number. The
recipient can use the sequence number to determine if a message is lost.
o Lifetime - The lifetime field defines the number of seconds that the agent will accept
requests. If the value is a string of 1s, the lifetime is infinite.
o Code - The code field is an 8-bit flag in which each bit is set (1) or unset (0).
o Care-of Addresses - This field contains a list of addresses available for use as care of
addresses.
The mobile host can choose one of these addresses.
The selection of this care-of address is announced in the registration request. Note that this field is
used only by a foreign agent.
Agent Solicitation
When a mobile host has moved to a new network and has not received agent advertisements, it can
initiate an agent solicitation.
It can use the ICMP solicitation message to inform an agent that it needs assistance.
Mobile IP does not use a new packet type for agent solicitation; it uses the router solicitation packet
of ICMP.
Registration
The second phase in mobile communication is registration.
After a mobile host has moved to a foreign network and discovered the foreign agent, it must
register.
There are four aspects of registration:
o The mobile host must register itself with the foreign agent.
o The mobile host must register itself with its home agent. This is normally done by the foreign
agent on behalf of the mobile host.
o The mobile host must renew registration if it has expired.
o The mobile host must cancel its registration (deregistration) when it returns home.
Request and Reply
To register with the foreign agent and the home agent, the mobile host uses a registration request
and a registration reply as shown in the above Figure.
Registration Request
A registration request is sent from the mobile host to the foreign agent to register its care-of address
and also to announce its home address and home agent address.
The foreign agent, after receiving and registering the request, relays the message to the home agent.
Note that the home agent now knows the address of the foreign agent because the IP packet that is
used for relaying has the IP address of the foreign agent as the source address.
18
Figure: Registration Request Format
The field descriptions are as follows:
o Type - The 8-bit type field defines the type of message. For a request message the value of
this field is 1.
o Flag - The 8-bit flag field defines forwarding information. The value of each bit can be set or
unset.
o Lifetime - This field defines the number of seconds the registration is valid. If the field is a
string of 0s, the request message is asking for deregistration. If the field is a string of 1s, the
lifetime is infinite.
o Home Address - This field contains the permanent (first) address of the mobile host.
o Home Agent Address - This field contains the address of the home agent.
o Care-of Address - This field is the temporary (second) address of the mobile host.
o Identification - This field contains a 64-bit number that is inserted into the request by the
mobile host and repeated in the reply message. It matches a request with a reply.
o Extensions - Variable length extensions are used for authentication. They allow a home agent
to authenticate the mobile agent.
Registration Reply
A registration reply is sent from the home agent to the foreign agent and then relayed to the mobile
host. The reply confirms or denies the registration request.
Figure below shows the format of the registration reply.
The fields are similar to those of the registration request with the following exceptions.
The value of the type field is 3.
The code field replaces the flag field and shows the result of the registration request (acceptance or
denial).
The care-of address field is not needed.
19
Registration messages are encapsulated in a UDP user datagram. An agent uses the well-known port
434; a mobile host uses an ephemeral port.
Data Transfer
After agent discovery and registration, a mobile host can communicate with a remote host.
From Remote Host to Home Agent
When a remote host wants to send a packet to the mobile host, it uses its address as the source
address and the home address of the mobile host as the destination address.
In other words, the remote host sends a packet as though the mobile host is at its home network.
The packet, however, is intercepted by the home agent, which pretends it is the mobile host.
This is done using the proxy ARP technique.
Path 1 of the Figure shows this step.
From Home Agent to Foreign Agent
After receiving the packet, the home agent sends the packet to the foreign agent, using the tunneling
concept.
The home agent encapsulates the whole IP packet inside another IP packet using its address as the
source and the foreign agent’s address as the destination. Path 2 of the Figure shows this step.
From Foreign Agent to Mobile Host
When the foreign agent receives the packet, it removes the original packet.
However, since the destination address is the home address of the mobile host, the foreign agent
consults a registry table to find the care-of address of the mobile host. (Otherwise, the packet would
just be sent back to the home network.)
The packet is then sent to the care-of address. Path 3 of the Figure shows this step.
Routing
20
It is a process of forwarding packets by finding the shortest path (Minimum Number of Hops) from
the source node to destination node in the network.
Forwarding and Routing
Forwarding
Forwarding consists of taking a packet, looking at its destination address, consulting a table, and
sending the packet in a direction determined by that table.
It is a relatively simple and well-defined process performed locally at a node.
A forwarding table contains mapping between network number and an outgoing interface as well as
physical address of the next hop.
The forwarding table is used when a packet is being forwarded and so must contain enough
information to accomplish the task.
Routing
Routing is the process by which the forwarding tables are built.
It depends on complex distributed algorithms that have continued to evolve.
A routing table contains mapping between network number and logical address of next hop.
It is built by the routing algorithm as an ancestor to the forwarding table.
There are reasons for implementing these tables as separate data structures:
The forwarding table needs to be structured to optimize the process of looking up an address when
forwarding a packet.
The routing table needs to be optimized for the purpose of calculating changes in topology.
The forwarding table may even be implemented in specialized hardware.
Network as a Graph
The basic problem of routing is to find the lowest-cost path between any two nodes.
Where the cost of a path equals the sum of the costs of all the edges that make up the path.
Properties of Routing
Some of the desirable properties of routing are,
21
o Correctness
o Simplicity
o Robustness
o Stability
o Optimality & Efficiency
Types of Routing
Static Routing (Non-Adaptive Routing)
It manually sets up the optimal paths between the source and destination node.
It is suitable for very small networks.
Dynamic Routing (Adaptive Routing)
It uses dynamic protocols to update the routing table and to find the optimal path between the source
and destination node.
It is used for larger networks.
Some of the dynamic routing protocols are,
Intra-domain Routing
Routing the information within an autonomous system is called as intra-domain routing.
ie., collection of routers are under a single administrative control.
It is also called Interior Gateway Protocol (IGP).
Some of the Intra-domain routing protocols are,
o Distance Vector Routing – Eg: RIP
o Link State Routing – Eg: OSPF
Inter-domain Routing
Routing the information between the autonomous systems is called as inter-domain routing.
It is also called Exterior Gateway Protocol (EGP).
Some of the Inter-domain routing protocols are,
o Path Vector Routing – Eg: BGP
22
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.
Distance Vector Routing
Distance vector routing is a distributed routing algorithm that runs on all nodes.
It is a dynamic routing algorithm based on Bellman – Ford algorithm.
It has knowledge about only its immediate neighbor node in the network.
Each node constructs a one dimensional array (a vector) containing the “distances” (costs) to all other
nodes and distributes that vector to its immediate neighbors.
Starting assumption is that each node knows the cost of the link to each of its directly connected
neighbors.
Every T seconds each router sends its table to its neighbor each router then updates its table based on
the new information.
Network as a Graph
23
The next step in distance-vector routing is that every node sends a message to its directly connected
neighbors containing its personal list of distances.
24
Each node automatically sends an update message every so often, even if nothing has
changed. This serves to let the other nodes know that this node is still running.
o Triggered Update
Whenever a node notices a link failure or receives an update from one of its neighbors
that causes it to change one of the routes in its routing table.
Whenever a node’s routing table changes, it sends an update to its neighbors, which
may lead to a change in their tables, causing them to send an update to their
neighbors.
What happens when a link or node fails?
o The nodes, that notice the failure, send a new list of distances to their neighbors and tables
are updated.
How does a node detect a failure?
o Nodes test links by sending control packets and wait for an acknowledgement.
o Nodes determine a link is down when it does not receive a periodic update.
Count to Infinity Problem (Loop Instability Problem)
The Bellman–Ford algorithm does not prevent routing loops from happening and suffers from the
count to infinity problem.
The core of the count to infinity problem is that if A tells B that it has a path somewhere, there is no
way for B to know if the path has B as a part of it.
Sometimes the network does not stabilize.
Each node advertises an unreachable link and the hop count increases on each router table in a cycle.
Partial solution is to use some relatively small number as an approximation to infinity.
One technique to improve the time to stabilize routing is called split horizon.
The idea is that when a node sends a routing update to its neighbors, it does not send those routes it
learned from each neighbor back to that neighbor.
---------------------------------------------------------------------------------------------------------------
Routing Information Protocol (RIP)
It is one of the more widely used routing protocols in IP networks.
It is an intra-domain routing protocol based on distance-vector algorithm.
RIP (Routing Information Protocol) dynamically builds a routing table using the distance vector
routing algorithm.
The idea behind the distance vector algorithm is that each node constructs a one dimensional array
(vector) containing the distances (costs) to all other nodes and distributes that vector to its immediate
neighbors.
Each node knows the cost of its directly connected neighbors.
A link that is down is assigned an infinite cost.
25
Figure: Example Network running RIP
In an internetwork, the goal of the routers is to learn how to forward packets to various networks.
Instead of advertising the cost of reaching other routers, the routers advertise the cost of reaching
networks.
The cost for reaching each link is 1 hop.
For example, router C advertises to A that it can reach network 2, 3 at cost 0 (directly connected),
networks 5, 6 at cost 1 and network 4 at cost 2.
Each router updates cost and next hop for each network number.
RIP prevents routing loops by implementing limit on the number of hops allowed in a path from
source to destination.
The maximum number of hops allowed for RIP is 15, which limits the size of networks that RIP can
support.
A hop count of 16 is considered an infinite distance and the route is considered unreachable.
RIP implements the split horizon, route poisoning and hold down mechanisms to prevent incorrect
routing information from being propagated.
Therefore RIP can be implemented only on small-sized networks.
Routers running RIP send their advertisements for every 30 seconds.
RIP Versions
There are three versions of the Routing Information Protocol. They are,
o RIPv1
o RIPv2
o RIPng
RIP Message Format
26
o Request Message
Sent by a router that has just come up or has some time-out entries
Can ask specific entries or all entries
o Response Message
A response can be either solicited or unsolicited.
Solicited Response - sent only in answer to a request
Contains information about the destination specified in the request.
Unsolicited Response - sent periodically
Every 30s
Contains information about the entire routing table.
All the neighboring routers which receive the Request message respond back with the Response
Message containing their routing table.
RIP Packet Format
RIP (version 2) packet format contains (network address, distance) pairs.
A router also sends an update message whenever an update from another router causes it to change
its routing table.
It supports multiple address families, not just IP—that is the reason for the Family part of the
advertisements.
Figure: Flooding of Link-State Packets. (a) LSP arrives at node X; (b) X floods LSP to A and C; (c) A
and C flood LSP to B (but not X); (d) Flooding is Complete
The above figure shows an LSP being flooded in a small network. Each node becomes shaded as it
stores the new LSP.
In Figure (a) the LSP arrives at node X, which sends it to neighbors A and C in Figure (b). A and C
do not send it back to X, but send it on to B.
Since B receives two identical copies of the LSP, it will accept whichever arrived first and ignore the
second as a duplicate.
It then passes the LSP onto D, which has no neighbors to flood it to, and the process is complete.
One of the important design goals of a link-state protocol’s flooding mechanism is,
o The newest information must be flooded to all nodes as quickly as possible.
o The old information must be removed from the network and not allowed to circulate.
o In addition, it is clearly desirable to minimize the total amount of routing traffic that is sent
around the network.
One easy way to reduce overhead is to avoid generating LSPs unless absolutely necessary.
Route Calculation
Each node knows the entire topology, once it has LSP from every other node.
Forward search algorithm is used to compute routing table from the received LSPs.
Each node maintains two lists, namely Tentative and Confirmed with entries of the form
(Destination, Cost, NextHop).
Forward Search Algorithm (Dijkstra’s Algorithm – Finding Shortest Path)
1. Initialize the Confirmed list with an entry for the Node (Cost = 0).
2. Node just added to Confirmed list is called Next. Its LSP is examined.
3. For each neighbor of Next, calculate cost to reach each neighbor as Cost (Node to Next) + Cost
(Next to Neighbor).
If Neighbor is neither in Confirmed nor in tentative list, then add (Neighbor, Cost, NextHop)
to Tentative list.
If Neighbor is in tentative list, and Cost is less than existing cost, then replace the entry with
(Neighbor, Cost, NextHop).
4. If tentative list is empty then Stop, otherwise move least cost entry from tentative list to Confirmed
list and return to Step 2.
30
Figure: Link-State Routing: An Example Network
Table: The steps for building the routing table for node D
Advantages
It has been proven to stabilize quickly.
It does not generate much traffic.
It responds rapidly to topology changes or node failures.
Disadvantages
On the downside, the amount of information stored at each node can be quite large.
---------------------------------------------------------------------------------------------------------------------------
Open Shortest Path First (OSPF)
Open Shortest Path First (OSPF) is a routing protocol for Internet Protocol (IP) networks.
It falls into the group of interior routing protocols, operating within a single autonomous system
(AS).
Features of OSPF
Authentication of Routing Messages ―Malicious host can collapse a network by advertising to reach
every host with cost 0. Such disasters are averted by authenticating routing updates.
Additional Hierarchy―Domain is partitioned into areas, i.e., OSPF is more scalable.
Load Balancing―Multiple routes to the same place are assigned same cost. Thus traffic is
distributed evenly.
OSPF Header Format
31
Figure: OSPF Header Format
Version ― represents the current version, i.e., 2.
Type ― represents the type (1–5) of OSPF message.
Message Length - Specifies the length of OSPF packet in bytes.
SourceAddr ― identifies the sender of the message.
AreaId ― A 32-bit identifier of the area in which the node is located
Checksum ― A 16-bit internet checksum protects the entire packet except the authentication data.
Authentication Type ― this field is 0 if no authentication is used; otherwise 1for simple password
and 2 for cryptographic authentication.
Authentication― It contains the password or cryptographic checksum.
OSPF Message Types
There are five different message types, for various types of communication: They are,
o Hello
o Database Description
o Link – State Request
o Link – State Send / Update
o Link - State Acknowledgement
32
The basic building block of link-state messages in OSPF is the link-state advertisement (LSA). One
message may contain many LSAs.
Type 1 LSAs advertise the cost of links between routers.
Type 2 LSAs are used to advertise networks to which the advertising router is connected, while other
types are used to support additional hierarchy.
34
o 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.
In addition to the address of the designated router, this type of LSP announces the IP address of all
routers, but no cost is advertised because each router announces the cost to the network when it sends
a router link advertisement.
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.
-------------------------------------------------------------------------------------------------------------------
Compare Distance Vector Routing and Link State Routing
Multicast Routing
Explain multicast routing in detail with neat sketches.
35
IP multicast is a method of sending Internet Protocol (IP) datagram’s to a group of interested
receivers in a single transmission.
It is a form of point-to-multipoint communication often employed for streaming media applications
on the Internet and private networks.
Multicast Addresses
Write short notes on multicast address.
A multicast address is a logical identifier for a group of hosts in a computer network, that are
available to process datagrams or frames intended to be multicast for a designated network service.
Multicast addressing can be used in the Link Layer (Layer 2 in the OSI model), such as Ethernet
multicast, and at the Internet Layer (Layer 3 for OSI) for Internet Protocol Version 4 (IPv4) or
Version 6 (IPv6) multicast.
IPv4 allocate class D address for multicast operation. Ipv6 also support for multicast addressing.
Address range is 224.0.0.0 to 239.255.255.255.
Out of 32 bits, only 28 bit is used for multicast address in Ipv4. The 4-bit is prefix for all multicast
address.
Ethernet uses 23-bit for multicast addressing and remaining bit for shared prefix.
In Ethernet, multicasting, mapping of 28 bit of IP address with 23 bit Ethernet address. It ignores 5
bit of higher order bits.
It increases overhead and multicast source there must be two piece of information: source IP address
and group address.
Multicast Routing Techniques
Optimal Routing: Shortest Path Trees
The process of optimal inter-domain routing eventually results in the finding of the shortest path
tree.
The root of the tree is the source, and the leaves are the potential destinations.
The path from the root to each destination is the shortest path.
Multicast Routing
When a router receives a multicast packet, the situation is different from when it receives a unicast
packet.
A multicast packet may have destinations in more than one network. Forwarding of a single packet
to members of a group requires a shortest path tree.
Two approaches have been used to solve the problem:
o Source-Based Tree Approach
o Group-Shared Tree Approach
Source-Based Tree
In the source-based tree approach to multicasting, each router needs to create a separate tree for
each source-group combination.
ie., each router needs to have one shortest path tree for each group.
36
The shortest path tree for a group defines the next hop for each network that has loyal member(s) for
that group.
37
Figure: Taxonomy of Multicast Routing Protocols
Multicast Open Shortest Path First (MOSPF)
This protocol is an extension of the OSPF protocol that uses multicast link state routing to create
source-based trees.
The protocol requires a new link state update packet to associate the unicast address of a host with
the group address or addresses the host is sponsoring.
This packet is called the group-membership LSA.
In this way, we can include in the tree only the hosts (using their unicast addresses) that belong to a
particular group.
Multicast Distance Vector Routing (DVMRP)
DVMRP (Distance Vector Multicast Routing Protocol) is a multicast routing protocol that
provides an efficient mechanism for connectionless datagram delivery to a group of hosts across an
internetwork.
It is a distributed protocol that dynamically generates IP multicast delivery trees using a technique
called Reverse Path Multicasting.
It is the oldest routing protocol that has been used to support multicast data transmission over
networks.
The protocol sends multicast data in the form of unicast packets that are reassembled into multicast
data at the destination.
Multicast distance vector routing uses source-based trees, but the router never actually makes a
routing table.
When a router receives a multicast packet, it forwards the packet as though it is consulting a routing
table. We can say that the shortest path tree is evanescent. After its use (after a packet is forwarded)
the table is destroyed.
To accomplish this, the multicast distance vector algorithm uses a process based on four decision-
making strategies. Each strategy is built on its predecessor.
DVMRP is one of several multicast routing protocols described as flood-and-prune protocols.
Multicasting is added to distance-vector routing in two stages.
o Reverse Path Broadcast floods packets to all networks
o Reverse Path Multicasting prunes end networks that do not have hosts belonging to a
multicast group.
So, DVMRP is also known as flood-and-prune protocol.
38
Flooding
A router receives a packet and, without even looking at the destination group address, sends it out
from every interlace except the one from which it was received.
This is a broadcast, not a multicast. There is another problem: it creates loops.
A packet that has left the router may come back again from another interlace or the same interlace
and be forwarded again.
Some flooding protocols keep a copy of the packet for a while and discard any duplicates to avoid
loops.
Reverse Path Forwarding (RPF)
RPF is a modified flooding strategy.
To prevent loops, only one copy is forwarded; the other copies are dropped.
In RPF, a router forwards only the copy that has traveled the shortest path from the source to the
router.
To find this copy, RPF uses the unicast routing table. The router receives a packet and extracts the
source address (a unicast address).
It consults its unicast routing table as though it wants to send a packet to the source address. The
routing table tells the router the next hop.
If the multicast packet has just come from the hop defined in the table, the packet has traveled the
shortest path from the source to the router because the shortest path is reciprocal in unicast distance
vector routing protocols.
This strategy prevents loops because there is always one shortest path from the source to the router.
If a packet leaves the router and comes back again, it has not traveled the shortest path.
39
However, RPF does not guarantee that each network receives only one copy; a network may receive
two or more copies.
The reason is that RPF is not based on the destination address (a group address); forwarding is based
on the source address.
RPM adds pruning and grafting to RPB to create a multicast shortest path tree that supports dynamic
membership changes.
DVMRP Message Header
40
The fields for the DVMRP message are as follows:
Type is the IGMP type number, which is set to 0x13 for all DVMRP messages. The actual
DVMRPv3 version is specified in the Major Version field.
Checksum is a standard IP-style checksum, using a 16-bit one's complement of the one's
complement of the DVMRP message.
Minor Version and Major Version are set to 0xFF and 0x03, respectively, for all DVMRPv3
messages.
Code specifies the DVMRPv3 message type. The possible values of the code field and the
corresponding message types.
41
o It explicitly builds unidirectional shared trees rooted at a rendezvous point (RP) per group,
and optionally creates shortest-path trees per source.
o It is a group-shared tree routing protocol that has a rendezvous point (RP) as the source of the
tree.
o 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.
o PIM-SM generally scales fairly well for wide-area usage.
o PIM-SM is commonly used in IPTV systems for routing multicast streams
between VLANs, Subnets or local area networks.
PIM Dense Mode (PIM-DM)
o It uses dense multicast routing.
o It is a source-based tree routing protocol that uses RPF pruning and grafting strategies for
multicasting.
o PIM-DM is straightforward to implement but generally has poor scaling properties.
o The first multicast routing protocol, DVMRP used dense-mode multicast routing.
Bidirectional PIM
o It explicitly builds shared bi-directional trees.
o It never builds a shortest path tree, so may have longer end-to-end delays than PIM-SM, but
scales well because it needs no source-specific state.
PIM Source-Specific Multicast (PIM-SSM)
o It builds trees that are rooted in just one source, offering a more secure and scalable model for
a limited amount of applications.
o In SSM, an IP datagram is transmitted by a source S to an SSM destination address G, and
receivers can receive this datagram by subscribing to channel (S,G).
o 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.
PIM Operation
PIM divides multicast routing problem into sparse and dense mode.
PIM sparse mode (PIM-SM) is widely used. PIM does not rely on any type of unicast routing
protocol, hence protocol independent.
PIM-SM assigns to each group a special router known as the rendezvous point.
Rendezvous Point Tree: a group shared tree method in which there is one tree for each group.
Rendezvous Router: A router which is the core or center for each multicast group is called as
rendezvous router; it becomes the root of the tree.
PIM-SM allows two types of trees to be constructed: a shared tree, which may be used by all
senders, and a source-specific tree, which may be used only by a specific sending host.
Routers explicitly join and leave multicast group using Join and Prune messages.
42
Shared Tree
When a router sends Join message for group G to RP, it goes through a set of routers.
o Join message is wildcarded (*), i.e., it is applicable to all senders.
o Routers create an entry (*, G) in its forwarding table for the shared tree.
o Interface on which the Join arrived is marked to forward packets for that group.
o Forwards Join towards rendezvous router RP.
Eventually, the message arrives at RP. Thus a shared tree with RP as root is formed.
Example
Consider the below figure (a) and (b) for Shared Tree
Router R4 sends Join message for group G to rendezvous router RP.
Join message is received by router R2. It makes an entry (*, G) in its table and forwards the message
to RP.
When R5 sends Join message for group G, R2 does not forwards the Join. It adds an outgoing
interface to the forwarding table created for that group.
As routers send Join message for a group, branches are added to the tree, i.e., shared.
Multicast packets sent from hosts are forwarded to designated router RP.
Suppose router R1, receives a message to group G.
o R1 has no state for group G.
o Encapsulates the multicast packet in a Register message.
o Multicast packet is tunneled along the way to RP.
RP decapsulates the packet and sends multicast packet onto the shared tree, towards R2.
R2 forwards the multicast packet to routers R4 and R5 that have members for group G.
Source-Specific Tree
RP can force routers to know about group G, by sending Join message to the sending host, so that
tunneling can be avoided.
Intermediary routers create sender-specific entry (S, G) in their tables. Thus a sources specific route
from R1 to RP is formed.
If there is high rate of packets sent from a sender to a group G, then shared-tree is replaced by
source-specific tree with sender as root.
Example
Consider the below figure (c) and (d) for Source-Specific Tree
Rendezvous router RP sends a Join message to the host router R1.
Router R3 learns about group G through the message sent by RP.
Router R4 send a source-specific Join due to high rate of packets from sender.
Router R2 learns about group G through the message sent by R4.
Eventually a source-specific tree is formed with R1 as root.
43
Figure: (a) R4 sends Join to RP and joins shared tree; (b) R5 joins shared tree; (c) RP builds source-
specific tree to R1 by sending Join to R1; (d) R4 and R5 build source-specific tree to R1 by sending
Joins to R1.
***************************************************************************
Overview of IPv6 Addressing
Ipv6
IPv6 stands for Internet Protocol version 6.
The motivation for a new version of IP is simple: to deal with exhaustion of the IP address space.
CIDR helped to contain the rate at which the Internet address space is being consumed and also
helped to control the growth of routing table information needed in the Internet’s routers.
CIDR and subnetting could not solve address space exhaustion faced by IPv4.
IPv6 was evolved to solve address space problem and offers rich set of services.
Historical Perspective
The IETF began looking at the problem of expanding the IP address space in 1991, and several
alternatives were proposed.
Since the IP address is carried in the header of every IP packet, increasing the size of the address
dictates a change in the packet header.
The effort to define a new version of IP was known as IP Next Generation or IPng.
An official IP version number was assigned, so IPng is now known as IPv6.
The significance of changing to a new version of IP caused a snowball effect.
Features of IPv6
44
In addition to the need to accommodate scalable routing and addressing, some of the other features
for IPng includes:
o Support for real-time services
o Security support
o Auto-configuration (i.e., the ability of hosts to automatically configure themselves with such
information as their own IP address and domain name)
o Enhanced routing functionality, including support for mobile hosts.
Addresses and Routing
• IPv6 provides 128 bit address space, instead of the 32 bit address of IPv4.
• IPv6 can potentially address 3.4 x 1028 nodes or approximately 1500 addresses per square foot of the
earth’s surface (which should be sufficient even when toasters on Venus have IP addresses!)
Address Space Allocation
IPv6 addresses do not have classes, but the address space is still divided based on the leading bits.
45
Address Notation
Standard representation of IPv6 address is x : x : x : x : x : x : x : x where x is a 16-bit hexadecimal
address separated by colon (:).
For example, 47CD : 1234 : 4422 : ACO2 : 0022 : 1234 : A456 : 0124
IPv6 address with contiguous 0 bytes can be written compactly.
For example, 47CD : 0000 : 0000 : 0000 : 0000 : 0000 : A456 : 0124 47CD : : A456 : 0124
IPv4 address is mapped to a IPv6 address by prefixing the 32-bit IPv4 address with 2 bytes of 1s and
then zero-extending the result to 128 bits.
For example, 128. 96.33.81 : : FFFF : 128.96.33.81
Address Aggregation
IPv6 provides aggregation of routing information to reduce the burden on routers.
Aggregation is done by assigning prefixes at continental level.
For example, if all addresses in Europe have a common prefix, then routers in other continents would
need one routing table entry for all networks in Europe.
Format for provider-based unicast address aggregation is:
Version — The 4-bit field defines the version number of the IP. i.e., 6.
TrafficClass — The 8-bit field is used to distinguish different payloads with different delivery
requirements. It replaces the type-of-service field in IPv4.
46
FlowLabel — The flow label is a 20-bit field that is designed to provide special handling for a
particular flow of data.
PayloadLen — It is 2-byte field defines the length of the IP datagram excluding the header.
NextHeader — It is an 8-bit field defining the type of the first extension header or the type of the
data that follows the base header in the datagram.
HopLimit — It serves the same purpose as TTL field in IPv4.
SourceAddress / DestinationAddress — 16-byte addresses of source and destination host
Extension Headers
Extension header provides greater functionality to IPv6.
Base header may be followed by six extension headers.
Each extension header contains a NextHeader field to identify the header following it.
*****************************************************************************************************************************
49