CN R20 Unit-3
CN R20 Unit-3
1. Routing Algorithms(Protocols)
The main function of the network layer is routing packets from the source machine
to the destination machine. The routing algorithm is that part of the network layer
software responsible for deciding which output line an incoming packet should be
transmitted on.
The set of optimal routes from all sources to a given destination form a tree rooted
at the destination. Such a tree is called a sink tree.
1
paths through a network that have a minimum of distance or other cost metric.
A technique to study routing algorithms: The idea is to build a graph of the sub
net, with each node of the graph representing a router and each arc of the graph
representing a communication line (often called a link).
To choose a route between a given pair of routers, the algorithm just finds the
shortest path between them on the graph.
Dijkstra's algorithm create the shortest path algorithm
ii) Flooding: When a routing algorithm is implemented, each router must make
decisions based on local knowledge, not the complete picture of the network. A
simple local technique is flooding, in which every incoming packet is sent out on
every outgoing line except the one it arrived on.
Flooding obviously generates vast numbers of duplicate packets, in fact, an infinite
number unless some measures are taken to damp the process.
Figure illustrates the operation of the DV algorithm for the simple three node
network shown at the top of the figure.
2
Fig: Distance-vector (DV) algorithm
RIP: The Routing Information Protocol (RIP) is an intra domain routing protocol used
inside an autonomous system. It is a very simple protocol based on distance vector
routing.
OSPF: The Open Shortest Path First or OSPF protocol is an intra domain routing
protocol based on link state routing. Its domain is also an autonomous system.
iii) Path Vector Routing: Path vector routing proved to be useful for inter domain
routing. The principle of path vector routing is similar to that of distance vector
routing. In path vector routing, we assume that there is one node in each
autonomous system that acts on behalf of the entire autonomous system.
Let us call it the speaker node. The speaker node in an AS creates a routing table
and advertises it to speaker nodes in the neighboring ASs. Only speaker nodes in
each AS can communicate with each other.
Initialization: At the beginning, each speaker node can know only the reachability of
nodes inside its autonomous system. Figure shows the initial tables for each
speaker node in a system made of four ASs.
Node Al is the speaker node for ASl, Bl for AS2, Cl for AS3, and Dl for AS4.
4
autonomous system shares its table with immediate neighbors.
BGP: Border Gateway Protocol (BGP) is an inter domain routing protocol using path
vector routing.
Fig: (a) A network. (b) A spanning tree for the leftmost router.
(c) A multicast tree for group 1. (d) A multicast tree for group 2.
2. Internetworking
5
We have implicitly assumed that there is a single homogeneous network, with
each machine using the same protocol in each layer. Unfortunately, this assumption
is wildly optimistic. Many different networks exist, including LANs, MANs, and WANs.
The issues that arise when two or more networks are connected to form an
internetwork, or more simply an internet.
We list some of the differences that can be exposed to the network layer.
1. We can build devices that translate or convert packets from each kind of network
into packets for each other network.
2. We can try to solve the problem by adding a layer of indirection and building a
common layer on top of the different networks.
An internet comprised of 802.11, MPLS, and Ethernet networks are shown in Fig.
Fig: (a) A packet crossing different networks. (b) Network and link layer protocol
processing.
Tunneling
The special case that is manageable even for different network protocols. This case
is where the source and destination hosts are on the same type of network, but there
is a different network in between. As an example, think of an international bank with
an IPv6 network in Paris, an IPv6 network in London and connectivity between the
offices via the IPv4 Internet. This situation is shown in Fig.
The solution to this problem is a technique called tunneling. The path through the
IPv4 Internet can be seen as a big tunnel extending from one multiprotocol router to
the other. The IPv6 packet just travels from one end of the tunnel to the other.
Internetwork Routing
A two-level routing algorithm. Within each network, an intradomain or interior
gateway protocol is used for routing. Across the networks that make up the internet,
an interdomain or exterior gateway protocol is used. The networks may all use
different intradomain protocols, but they must use the same interdomain protocol.
7
In the Internet, the interdomain routing protocol is called BGP (Border Gateway
Protocol).
Packet Fragmentation
Each network or link imposes some maximum size on its packets. These limits have
various causes, among them
1. Hardware (e.g., the size of an Ethernet frame).
2. Operating system (e.g., all buffers are 512 bytes).
3. Protocols (e.g., the number of bits in the packet length field).
4. Desire to reduce error-induced retransmissions to some level. 5. Desire to prevent
one packet from occupying the channel too long.
Solution:
i. The packet size is called the Path MTU (Path Maximum Transmission Unit).
Even if the source did know the path MTU, packets are routed independently in a
connectionless network such as the Internet.
ii. The alternative solution to the problem is to allow routers to break up packets
into fragments, sending each fragment as a separate network layer packet. However,
as every parent of a small child knows, converting a large object into small
fragments is considerably easier than the reverse process.
8
Fig: The IPv4 (Internet Protocol) header
Version Number. The 4-bit version number (VER) field defines the version of the
IPv4 protocol has the value of 4.
Header Length. The 4-bit header length (HLEN) field defines the total length of
the datagram header in 4-byte words. The IPv4 datagram has a variable-length
header.
This 4-bit field indicates the number of 4-byte words in the IP header. The length of
the header can be between 20 and 60 bytes. Therefore, the value of this field is
always between 5 (5 × 4 = 20) and 15 (15 × 4 = 60).
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. The IETF
redefined the field to provide differentiated services.
Precedence is a 3-bit subfield ranging from 0 (000 in binary) to 7 (111 in binary). The
precedence defines the priority of the datagram in issues such as congestion.
Identification. This 16-bit field identifies a datagram originating from the source
host. The combination of the identification and source IPv4 address must uniquely
define a datagram as it leaves the source host.
To guarantee uniqueness, the IPv4 protocol uses a counter to label the datagrams
and after every label assigning counter is incremented by 1. When datagram is
fragmented, all fragments have the same identification number of the original
datagram.
Fragmentation Offset. This 13-bit field shows the relative position of this
fragment with respect to the whole datagram.
Protocol. This 8-bit field defines the higher-level protocol that uses the services
of the IPv4 layer. An IPv4 datagram can encapsulate data from several higher-level
protocols such as TCP, UDP, ICMP, and IGMP. This field specifies the final
destination protocol to which the IPv4 datagram is delivered.
Header checksum. The checksum in the IPv4 packet covers only the header, not
the data.
The implementation of the checksum in the IPv4 packet follows as; first, the value of
the checksum field is set to 0. Then the entire header is divided into 16-bit sections
and added together. The result (sum) is complemented and inserted into the
checksum field.
Source address. This 32-bit field defines the IPv4 address of the source. This
field must remain unchanged during the time the IPv4 datagram travels from the
source host to the destination host.
Destination address. This 32-bit field defines the IPv4 address of the destination.
This field must remain unchanged during the time the IPv4 datagram travels from
the source host to the destination host
IPV4 Addresses
IPv4 address is a 32-bit address that uniquely and universally defines the connection
of a device (for example, a computer or a router) to the Internet.
Address space is the total number of addresses used by the protocol.IPv4 uses
32
32-bit addresses: The address space=2 =4,294,967,296 (more than 4 billion).
Notations: There are two notations to show an IPv4 address
Binary notation: Address is displayed as 32 bits. Each octet is often referred to as
byte.IPv4 address referred to as 32-bit address or 4-byte address
Dotted-decimal notation: More compact and easier to read, Written in decimal form
with a decimal point (dot) separating the bytes.
Example: Each decimal value range from 0 to 255
10
Fig: different notations in IPv4 addressing
Addresses in Classes A, B and C are unicast addresses. Addresses in Class D are for
multicast address and addresses in class E are reserved.
Classes and Blocks: One problem with classful addressing is that each class is
divided into a fixed number of blocks with each block having a fixed size as shown in
Table.
Mask: The length of the netid and hostid (in bits) is predetermined in classful
addressing, we can also use a mask (also called the default mask), a 32-bit
number made of contiguous 1s followed by contiguous 0s. The masks for classes A,
11
B, and C are shown in Table. The concept does not apply to classes D and E.
The last column of Table shows the mask in the form / n where n can be 8, 16, or 24
in classful addressing. This notation is also called slash notation or
Classless Inter domain Routing (CIDR) notation.
Address Depletion: The flaws in classful addressing scheme combined with the
fast growth of the Internet led to the near depletion of the available addresses. Yet
the number of devices on the Internet is much less than the 232 address space. We
have run out of class A and B addresses, and a class C block is too small for most
midsize organizations. One solution for the problem is the idea of classless
addressing.
Example: Figure shows a block of addresses granted to a small business that needs
16 addresses.
12
Figure: A block of 16 addresses granted to a small organization
We can see that the restrictions are applied to this block. The addresses are
contiguous. The number of addresses is a power of 2 (16 = 24), and the first address
is divisible by 16.
Mask: A better way to define a block of addresses is to select any address in the
block and the mask. A mask is a 32 bit number in which the n leftmost bits are 1s
and the 32 – n rightmost bits are 0s. However, in classless addressing the mask for
a block can take any value from 0 to 32.
First address: The first address in the block can be found by setting the
rightmost 32 – n bits to 0s.
Last address: The last address in the block can be found by setting the
rightmost 32 − n bits to 1s.
Number of addresses: The number of addresses in the block can be found by
using the formula 232−n
13
Three-Levels of Hierarchy: Subnetting: An organization that is granted a large block of
addresses may want to create clusters of networks (called subnets) and divide the
addresses between the different subnets.
IP Version 6
An IPv6 address is 128 bits or 16 bytes (octets) long, four times the address length
in IPv4. The IPV6 address is represented as colon hexadecimal notation (or colon
hex for short) divides the address into eight sections, each made of four
hexadecimal digits separated by colons.
Its major goals were:
1. Support billions of hosts.
2. Reduce the size of the routing tables.
3. Simplify the protocol, to allow routers to process packets faster.
4. Provide better security (authentication and privacy).
5. Pay more attention to the type of service, particularly for real-time data.
6. Aid multicasting by allowing scopes to be specified.
7. Make it possible for a host to roam without changing its address.
8. Allow the protocol to evolve in the future.
9. Better header format
The IPV6 Protocol: The IPv6 packet is shown in Figure. Each packet is composed
of a base header followed by the payload. The base header occupies 40 bytes,
whereas payload can be up to 65,535 bytes of information.
Version. The 4-bit version field defines the version number of the IP. For IPv6, the
value is 6.
Traffic class. The 8-bit traffic class field is used to distinguish different payloads
with different delivery requirements. It replaces the type-of-service field in IPv4.
Flow label. The flow label is a 20-bit field that is designed to provide special
14
handling for a particular flow of data.
Payload length. The 2-byte payload length field defines the length of the IP
datagram excluding the header In IPv6, the length of the base header is fixed (40
bytes); only the length of the payload needs to be defined.
Next header. The next header is an 8-bit field defining the type of the first
extension header (if present) or the type of the data that follows the base header in
the datagram.
Hop limit. The 8-bit hop limit field serves the same purpose as the TTL field in
IPv4. The Hop limit field is used to keep packets from living forever.
Source and destination addresses. The source address field is a 16-byte (128-bit)
Internet address that identifies the original source of the datagram. The destination
address field is a 16-byte (128-bit) Internet address that identifies the destination of
the datagram.
IPv6 Address
Despite all short-term solutions, address depletion is still a long-term problem for the
Internet. This and still a long-term problem for the Internet. This and other problems
in the IP protocol itself have been the motivation for IPv6.
Address Space: IPv6 has a much larger address space; 2128 addresses are
available. The designers of IPv6 divided the address into several categories.
ii) Internet Control Protocols
15
ICMP—The Internet Control Message Protocol
ICMP is used by hosts and routers to communicate network-layer information to
each other.
The most typical use of ICMP is for error reporting. The operation of the Internet is
monitored closely by the routers.
When something unexpected occurs during packet processing at a router, the event
is reported to the sender by the ICMP (Internet Control Message Protocol).
ICMP is often considered part of IP but architecturally it lies just above IP, as ICMP
messages are carried inside IP datagrams. Each ICMP message type is carried
encapsulated in an IP packet.
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.
The protocol that is used today for collecting information about group membership
is the Internet Group Management Protocol (IGMP). IGMP is a protocol defined at
the network layer; it is one of the auxiliary protocols, like ICMP, which is considered
part of the IP. IGMP messages are encapsulated in an IP datagram.
Messages There are only two types of messages in IGMP, query and report
messages, as shown in Figure.
A query message is periodically sent by a router to all hosts attached to it to ask
them to report their interests about membership in groups.
A report message is sent by a host as a response to a query message.
Query Message The query message is sent by a router to all hosts in each interface
to collect information about their membership. There are three versions of query
messages, as described below:
A general query message is sent about membership in any group. Note that all
routers attached to the same network receive this message to inform them that this
message is already sent and that they should refrain from resending it.
A group-specific query message is sent from a router to ask about the
membership related to a specific group.
This is sent when a router does not receive a response about a specific group in the
network.
The group identifier (multicast address) is mentioned in the message. The message
is encapsulated in a datagram with the destination address set to the corresponding
multicast address.
A source-and-group-specific query message is sent from a router to ask about
17
the membership related to a specific group when the message comes from a
specific source or sources.
Again the message is sent when the router does not hear about a specific group
related to a specific host or hosts.
OSPF is developed by Internet Engineering Task Force (IETF) as one of the Interior
Gateway Protocol (IGP), i.e, the protocol which aims at moving the packet within a
large autonomous system or routing domain. It is a network layer protocol which
works on the protocol number 89.
18
With OSPF, a router constructs a complete topological map (that is, a graph) of the
entire autonomous system. The router then locally runs Dijkstra’s shortest-path
algorithmto determine a shortest-path tree to all subnets, with itself as the root node.
With OSPF, a router broadcasts routing information to all other routers in the
autonomous system, not just to its neighboring routers. A router broadcasts link
state information whenever there is a change in a link’s state. It also broadcasts a
link’s state periodically (at least once every 30 minutes), even if the link’s state has
not changed.
• The TCP connection along with all the BGP messages sent over the
connection is called a BGP session. Furthermore, a BGP session that spans
two AS is called an external BGP (eBGP) session, and a BGP session between
routers in the same AS is called an internal BGP (iBGP) session.
19