UNIT-III Network Layer

Download as pdf or txt
Download as pdf or txt
You are on page 1of 118

COMPUTER NETWORKS

UNIT-III
NETWORK LAYER

FACULITY:
SREENU BANOTH
ASSISTANT PROFESSOR ,
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING,
IIMT COLLEGE OF ENGINEERING,GREATER NOIDA-201308
Syllabus:
Network Layer: Point-to-point networks, Logical addressing, Basic
internetworking (IP, CIDR, ARP, RARP, DHCP, ICMP), Routing, forwarding
and delivery, Static and dynamic routing, Routing algorithms and protocols,
Congestion control algorithms, IPv6
Network Layer
• Network Layer is layer 3 of the OSI reference model. The network layer controls the operation of the
subnet.
• The main aim of this layer is to deliver packets from source to destination across multiple links
(networks).
• It routes the signal through different channels to the other end and acts as a network controller.
• As the data link layer oversees the delivery of the packets between two systems on the same network;
the network layer mainly ensures that each packet gets from its point of origin to the final destination.
• It also divides the outgoing messages into packets and to assemble incoming packets into messages
for higher levels.
• In broadcast networks, the routing problem is simple, so the network layer is often thin or even non-
existent.
• If two computers (system) are connected on the same link, then there is no need for a
network layer.
• But in case if two systems ate attached to different networks(links) with connecting devices
between the networks(links), then there is a need for the network layer in order to
accomplish the source-to-destination delivery.
The main responsibility of the network layer is to deliver individual packets from the source host to the destination host.

Responsibilities/Functions of Network Layer

Given below are some other responsibilities of the Network layer.

• The network layer breaks the larger packets into small packets.

• Connection services are provided including network layer flow control, network layer error control, and packet sequence
control.

• Logical Addressing Physical addressing implemented by the data link layer handles the problem of addressing locally. A
header is added by the Network layer to the packet coming from the upper layer that also includes logical addresses of the
sender and the receiver.

• Routing At the time when independent networks or links are connected together in order to create internetworks/large
network, then the routing devices(router or switches) route the packets to their final destination. This is one of the main
functions of the network layer.
Services provided by the Network Layer
1. Guaranteed delivery of Packets The network layer guarantees that the packet will reach its destination.

2. Guaranteed delivery with the bounded delay It is another service provided by the network layer and it
guarantees that the packet will surely be delivered within a specified host-to-host delay bound.

3. Transfer of packets in Order According to this service, it is ensured that packets arrive at the destination in
the same order in which they are sent by the sender.

4. Security Security is provided by the network layer by using a session key between the source host and the
destination host.
Advantages of Network Layer Services
Given below are some benefits of services provided by the network layer:

• By forwarding service of the network layer, the data packets are transferred from one place to another in the network.

• In order to reduce the traffic, the routers in the network layer create collisions and broadcast the domains.

• Failure in the data communication system gets eliminated by packetization.

Disadvantages of Network layer Services

• In the design of the network layer, there is a lack of flow control

• In the network layer, there is a lack of proper error control mechanisms; due to the presence of fragmented data packets
the implementation of error control mechanism becomes difficult.

• Due to the presence of too many datagrams there happens occurrence of congestion.
In this figure, the network layer at the A node sends the packet
to the network layer at the B node. When the packet arrives at
router B then the router makes the decision of the path based on
the final destination that is the F node of the packet transmitted.
Router B makes use of its routing table for finding the next hop
that is router E. The Network layer at node B sends the packet
to the network layer at E which then sends the packet to the
network layer at F.
Network Layer Design Issues
1. Store-and-forward packet switching
2. Services provided to transport layer
3. Implementation of connectionless service
4. Implementation of connection-oriented service
5. Comparison of virtual-circuit and datagram networks
1 .Store-and-forward packet switching

• A host with a packet to send transmits it to the nearest router, either on its own LAN or over a point-to-point
link to the ISP.
• The packet is stored there until it has fully arrived and the link has finished its processing by verifying the
checksum.
• Then it is forwarded to the next router along the path until it reaches the destination host, where it is
delivered.
• This mechanism is store-and-forward packet switching.
2 Services provided to transport layer
The network layer provides services to the transport layer at the network layer/transport layer
interface. The services need to be carefully designed with the following goals in mind:

1. Services independent of router technology.

2. Transport layer shielded from number, type, topology of routers.

3. Network addresses available to transport layer use uniform numbering plan

– even across LANs and WANs


3. Implementation of connectionless service
• If connectionless service is offered, packets are injected into the network individually and
routed independently of each other.
• No advance setup is needed. In this context, the packets are frequently called datagrams (in
analogy with telegrams) and the network is called a datagram network.
A’s table (initially) A’s table ( later) C’s Table E’s Table

• Let us assume for this example that the message is four times longer than the maximum packet size, so the
network layer has to break it into four packets, 1, 2, 3, and 4, and send each of them in turn to router A.
• Every router has an internal table telling it where to send packets for each of the possible destinations. Each
table entry is a pair(destination and the outgoing line). Only directly connected lines can be used.
• A ’s initial routing table is shown in the figure under the label ‘‘initially.’’ At A, packets 1, 2, and
3 are stored briefly, having arrived on the incoming link. Then each packet is forwarded
according to A ’s table, onto the outgoing link to C within a new frame.

• Packet 1 is then forwarded to E and then to F.

• However, something different happens to packet 4. When it gets to A it is sent to router B, even
though it is also destined for F.

• For some reason (traffic jam along ACE path), A decided to send packet 4 via a different route
than that of the first three packets. Router A updated its routing table, as shown under the label
‘‘later.’’

• The algorithm that manages the tables and makes the routing decisions is called the routing
algorithm.
4. Implementation of Connection Oriented service:
• To use a connection-oriented service, first we establishes a connection, use it and then release it.

• In connection-oriented services, the data packets are delivered to the receiver in the same order in which they
have been sent by the sender.

It can be done in either two ways :

• Circuit Switched Connection – A dedicated physical path or a circuit is established between the
communicating nodes and then data stream is transferred.

• Virtual Circuit Switched Connection – The data stream is transferred over a packet switched network, in
such a way that it seems to the user that there is a dedicated path from the sender to the receiver. A virtual path
is established here. While, other connections may also be using the same path.

• When the connection is released, the virtual circuit is also terminated. With connection- oriented service, each
packet carries an identifier telling which virtual circuit it belongs to.
• As an example, consider the situation of Fig..
• Here, host H1 has established connection 1 with host H2. It is remembered as the first entry in each of the
routing tables.
• The first line of A's table says that if a packet bearing connection identifier 1 comes in from H1, it is to be sent
to router C and given connection identifier 1.
• Similarly, the first entry at C routes the packet to E, also with connection identifier 1.
• Now let us consider what happens if H3 also wants to establish a connection to H2.

• It chooses connection identifier 1 (because it is initiating the connection and this is its only connection) and tells
the subnet to establish the virtual circuit.

• This leads to the second row in the tables. Note that we have a conflict here because although A can easily
distinguish connection 1 packets from H1 from connection 1 packets from H3, C cannot do this.

• For this reason, A assigns a different connection identifier to the outgoing traffic for the second connection.
Avoiding conflicts of this kind is why routers need the ability to replace connection identifiers in outgoing
packets. In some contexts, this is called label switching.
5. Comparison of Virtual-Circuit And Datagram Subnets:
Logical addressing

• A logical address is the address at which an item (memory cell, storage element, network host) appears

to reside from the perspective of an executing application program.

• A logical address may be different from the physical address due to the operation of an address translator or

mapping function.

✓ Network layer is responsible for host-to-host delivery and for routing mechanism.

✓ It adds a logical address that is source and destination address as a part of IP header to the segment coming
from above Transport Layer.
Logical Addressing:
The logical addresses added by Network layer are known as IP address, it can be either IPv4 or IPv6.

IPv4 Addresses:

• An IPv4 address is a 32-bit address that uniquely and universally defines the connection of a device. These
addresses are unique in the sense that each address defines one, and only one, connection to the internet.

Address Space:

• It defines the range of addresses used by the protocol. Each networking devices will get a address from this
address space.

• Since IPv4 address is a 32 bit in size, hence the total number of address possible is: 2^32 = 4,294,967,296.
This means theoretically 4 billion devices can be connected to internet, but practically this number is way less
because of some restrictions.
Representation of IP address: An IP address can be represented in two formats:
• Dotted-Decimal Notation:
In this format, an IP address is represented as 4 octets, each octet of 8 bits (1 bytes) and are separated with a
decimal point(dot).
• Example:
192.168.0.1
• Binary Notation:
In this IP address is represented as 32 bits.
Example:
Dotted decimal : 192. 168.0.1
Binary Notation: 1110101 10101000 00000000 00000001
Classful Addressing:
• Classful Addressing, the address space is divided into five classes: A, B, C, D and E. Each class has has some
part of the address space.
• Class A, B, C are mostly used for unicast communication whereas class D is for multicast communication and
class E is reserved.
Range of each class of IP address:
Range of each class is depicted in the below diagram:
• Host ID and Network ID: In classful addressing, IP address can be divided into two
portions, one is called Host ID, which identifies the host in the network and other is called
network Id which identifies the network.
Subnet Mask:

• It is also 32-bit address which is used to distinguish the host part and network part of an IP address.
• In classful addressing each class has a default subnet mask:

Class A: 255.0.0.0
Class B: 255.255.0.0
Class C: 255.255.255.0
Class D: 255.255.255.255
Basic Internetworking (IP, CIDR, ARP, BOOTP DHCP, ICMP)
• Internetworking is a collection of individual networks, connected by intermediate networking devices, that functions as a
single large network.
• It refers to the industry, products, and procedures that meet the challenge of creating and administering internetworks.

• Internetworking is the practice of interconnecting multiple computer networks, such that any pair of hosts in the
connected networks can exchange messages irrespective of their hardware-level networking technology.
Challenges faced by internetworking are:
• Connectivity
• Reliability
• Network Management
• Flexibility
Protocols present in Internetworking:
IP(Internet Protocol)
• The Internet Protocol (IP) is a protocol, or set of rules, for routing and addressing packets of data so that they
can travel across networks and arrive at the correct destination.

• Data traversing the Internet is divided into smaller pieces, called packets.

• IP information is attached to each packet, and this information helps routers to send packets to the right place.

• Every device or domain that connects to the Internet is assigned an IP address, and as packets are directed to
the IP address attached to them, data arrives where it is needed.
Working of IP:
• An IP address is a unique identifier assigned to a device or domain that connects to the Internet.

• Each IP address is a series of characters, such as '192.168.1.1'. Via DNS resolvers, which translate human-
readable domain names into IP addresses, users are able to access websites without memorizing this complex
series of characters.

• Each IP packet will contain both the IP address of the device or domain sending the packet and the IP address
of the intended recipient, much like how both the destination address and the return address are included on a
piece of mail.
CIDR(ClassLess Inter-Domain Routing)
• CIDR, which stands for Classless Inter-Domain Routing, is an IP addressing scheme that improves the allocation of IP
addresses.

• It replaces the old system based on classes A, B, and C.

• This scheme also helped greatly extend the life of IPv4 as well as slow the growth of routing tables.
Working of CIDR:
• CIDR is based on variable-length subnet masking (VLSM). This allows it to define prefixes of arbitrary lengths making it
much more efficient than the old system.

• CIDR IP addresses are composed of two sets of numbers. The network address is written as a prefix, like you would see a
normal IP address (e.g. 192.255.255.255).

• The second part is the suffix which indicates how many bits are in the entire address (e.g. /12). Putting it together, a CIDR
IP address would look like the following:

192.255.255.255/12
ARP(Address Resolution Protocol)
Address Resolution Protocol(ARP)
• The purpose of Address Resolution Protocol (ARP) is to resolve an IPv4 address (32 bit Logical Address) to
the corresponding physical address (48 bit MAC Address). Network Applications at the Application Layer use
IPv4 Address to communicate with another device.

• Aim: To find out the MAC address of the destination that allows us to communicate with other devices. In this
case, the ARP is actually required as it converts the IP address to a physical address.

Working of ARP:
• Arping probes hosts on the examined network link by sending Link Layer frames using the Address
Resolution Protocol (ARP) request method addressed to a host identified by its MAC address of the network
interface.
RARP(Reverse Address Resolution Protocol)
• Reverse ARP (RARP) is a networking protocol used by the client system in a local area network (LAN) to
request its IPv4 address from the ARP gateway router table. A table is created by the network administrator in
the gateway-router that is used to find out the MAC address to the corresponding IP address.

Working of RARP:
• The RARP is on the Network Access Layer and is employed to send data between two points in a very
network.The client broadcasts a RARP request with an Ethernet broadcast address and with its own physical
address. The server responds by informing the client its IP address.
DHCP(Dynamic Host Configuration Protocol)
• Dynamic Host Configuration Protocol (DHCP) is a standardized network protocol used on Internet
Protocol (IP) networks.

• The DHCP is controlled by a DHCP server that dynamically distributes network configuration parameters for
interfaces and services. Networks ranging in size from small home networks to campus networks frequently use DHCP.

Working of DHCP:
• A DHCP server dynamically assigns an IP address and other network configuration parameters to each device
on a network so they can communicate with other IP networks. DHCP is an enhancement of an older protocol
called BOOTP.

• With respect to the DHCP protocol, the DHCP server goes through an initializing, selecting, requesting,
binding, renewal, rebinding, and expiration cycle when negotiating for an IP address, as shown in the below
diagram. The process is basically as follows:
1. The client just added or relocated on the network requests an IP address by broadcasting a DHCPDISCOVER message to
the local subnet over the well-known BOOTP server port. (The client can also go through a BOOTP router or relay agent to
forward the DHCPDISCOVER to additional remote DHCP servers.) This is the initializing state.

2. The participating DHCP servers respond with a DHCPOFFER message if they have a valid configuration for the client.
The client may get many of these messages, which contain the IP address and configuration data. (The servers make sure to
reserve the addresses so as not to accidentally offer them to another client.) At this point the client enters the selecting state.

3. After selecting an address, the client broadcasts the selected address and name of the "winning" server (Server 1) using a
DHCPREQUEST message. This is the requesting state. All the other servers can now safely unreserve their addresses.

4. Server 1 sends the client a DHCPACK (acknowledgment) message with the negotiated IP address, the lease, and the
network configuration parameters. The client now enters the binding state and can fully use the assigned IP address.
5. About halfway through the lease, the client sends Server 1 another DHCPREQUEST for a lease renewal and
enters the renewal state. If the server deems the lease renewable, it sends back another DHCPACK to update the
lease (including any new parameters). The client now returns to the binding state, as in Step 4.

6. If the client cannot renew the lease (such as if Server 1 is down), the client waits until about 87.5% of the way
through the lease and broadcasts another DHCPREQUEST to all DHCP servers. Any server can now return a
DHCPACK containing the extended lease and updated parameters. This is the rebinding state.

7. When the lease reaches 100% expired, or a server sends back a DHCPNAK negative acknowledgment
message, the client must give up the IP address. It then returns to the initializing state and must start the address
negotiation over again.

DHCP is defined in RFC 2131 and RFC 2132. Refer to them for more information.
Two DHCP servers are recommended for a network. The benefit of having more than one server is if one fails
another is available to continue processing requests, ensuring that all hosts (old and new) are serviced
continuously.
ICMP(Internet Control Message Protocol)
• The Internet Control Message Protocol (ICMP) is a protocol that devices within a network use to communicate
problems with data transmission. In this ICMP definition, one of the primary ways in which ICMP is used is to
determine if data is getting to its destination and at the right time. This makes ICMP an important aspect of the error
reporting process and testing to see how well a network is transmitting data.

Working of ICMP:
• ICMP will take source IP from the discarded packet and inform the source by sending a source quench message.

• Then the source will reduce the speed of transmission so that the router will free itself from congestion.

• Since IP does not have an inbuilt mechanism for sending error and control messages. It depends on Internet Control
Message Protocol(ICMP) to provide an error control. It is used for reporting errors and management queries. It is a
supporting protocol and is used by networks devices like routers for sending error messages and operations
information., e.g. the requested service is not available or that a host or router could not be reached.
ICMPv4 Packet Format :

BOOTP: Bootstrap Protocol


Knowledge of its IP address, can determine its IP address using RARP when it is bootstrapped. There are two
problems with RARP: (1) the only thing returned is the IP address, and (2) since RARP uses a link-layer
broadcast, RARP requests are not forwarded by routers (necessitating an RARP server on every physical
network). This chapter describes an alternative method for a diskless system to bootstrap itself, called the
Bootstrap Protocol, or BOOTP.
BOOTP Packet Format
• BOOTP requests and replies are encapsulated in UDP datagrams, as shown in Figure

Figure : Encapsulation of BOOTP requests and replies within a UDP datagram.


Format of the 300-byte BOOTP request and reply.

Figure : Format of BOOTP request and reply.


Routing:
ROUTING TABLE:
How Router Share Information:
Routing Vs Forwarding
Delivery:
The Network layer supervises the handling of the packets by the underlying physical networks. We define this
handling as delivery of packet.

Direct Versus Indirect Delivery


Routing Algorithms
• The routing algorithm is that part of the network layer software responsible for deciding which output line an
incoming packet should be transmitted. If the subnet uses datagrams internally, this decision must be made anew for
every arriving data packet since the best route may have changed since last time.

• If the subnet uses virtual circuits internally, routing decisions are made only when a new virtual circuit is being set
up. Thereafter, data packets just follow the already established route.
• The latter case is sometimes called session routing because a route remains in force for an entire session (e.g., a
login session at a terminal or a file transfer).
Properties of a routing Algorithms:
1. Correctness
2. Simplicity
3. Robustness
4. Stability
5. Fairness
6. Optimality
• Correctness and simplicity hardly require comment, but the need for robustness may be less obvious at first.

• Once a major network comes on the air, it may be expected to run continuously for years without system-wide
failures.

• Hosts, routers, and lines will fail repeatedly, and the topology will change many times.

• The routing algorithm should be able to cope with changes in the topology and traffic without requiring all jobs
in all hosts to be aborted.

• Stability is also an important goal for the routing algorithm.

• There exist routing algorithms that never converge to a fixed set of paths, no matter how long they run.

• A stable algorithm reaches equilibrium and stays there.


• Fairness and efficiency may sound obvious surely no reasonable person would oppose them but as it turns
out, they are often contradictory goals. Suppose that there is enough traffic between A and A′, between B and
B′, and between C and C′ to saturate the horizontal links. To maximize the total flow, the X to X′ traffic
should be shut off altogether.

Figure: Network with a conflict between fairness and efficiency


The Optimality Principle
• One can make a general statement about optimal routes without regard to network topology or traffic. This statement is
known as the optimality principle (Bellman,1957).

• It states that if router J is on the optimal path from router I to router K, then the optimal path from J to K also falls along
the same route.

Figure (a) A network. (b) A sink tree for router B.


• 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.

• where the distance metric is the number of hops. The goal of all routing algorithms is to discover and use the
sink trees for all routers.

• The sink tree is not necessarily unique; other trees with the same path lengths may exist. If we allow all of the
possible paths to be chosen, the tree becomes a more general structure called a DAG (Directed Acyclic
Graph). DAGs have no loops.

• Since a sink tree is indeed a tree, it does not contain any loops, so each packet will be delivered within a finite
and bounded number of hops.
Types of routing Algorithms
Routing algorithms can be divided into two groups.

1. Non adaptive algorithms

2. Adaptive algorithms

Nonadaptive algorithms:
For this type of algorithms, the routing decision is not based on the measurement or estimation of current traffic
and topology. This is called as a static routing.

Adaptive algorithms:
For this type of algorithms, the routing decision can be changed if there age any changes in topology or traffic etc.
This is called as dynamic routing.
Shortest Path Algorithm
• This algorithm is based on the simplest and most widely used principle.

• The idea is to build a graph of the network, with each node of the graph representing a router and each edge of the
graph representing a communication line, or link. To choose a route between a given pair of routers, the algorithm
just finds the shortest path between them on the graph.

How to decide the Shortest Path


• One way of measuring path length is the number of hops. Another metric is the geographic distance in kilometers.
Some other metrics besides hops and physical distance are also possible. For example, we can label each arc(link)
with the mean queueing and transmission delay and obtain the shortest path as the fastest path.

Labels on the Arcs(Edges)


• The labels on the edges could be computed as a function of the distance, bandwidth, average traffic, communication
cost, measured delay, and other factors. By changing the weighting function, the algorithm would then compute the
‘‘shortest’’ path measured according to any one of a number of criteria or to a combination of criteria.
• Several algorithms for computing the shortest path between two nodes of a graph are known.

• This one is due to Dijkstra (1959) and finds the shortest paths between a source and all destinations in the
network.

• Each node is labeled (in parentheses) with its distance from the source node along the best known path.

• The distances must be non-negative, as they will be if they are based on real quantities like bandwidth and
delay. Initially, no paths are known, so all nodes are labeled with infinity.

• As the algorithm proceeds and paths are found, the labels may change, reflecting better paths.

• A label may be either tentative or permanent.

• Initially, all labels are tentative.

• When it is discovered that a label represents the shortest possible path from the source to that node, it is made
permanent and never changed thereafter.
Figure . The first six steps used in computing the shortest path from A to D. The arrows indicate the working node.
• We want to find the shortest path from A to D. We start out by marking node A as permanent, indicated by a filled-in
circle.

• Then we examine, in turn, each of the nodes adjacent to A (the working node), relabeling each one with the distance
to A. Whenever a node is relabeled, we also label it with the node from which the probe was made so that we can
reconstruct the final path later.

• Having examined each of the nodes adjacent to A, we examine all the tentatively labeled nodes in the whole graph
and make the one with the smallest label permanent, This one becomes the new working node.

• We now start at B and examine all nodes adjacent to it. If the sum of the label on B and the distance from B to the
node being considered is less than the label on that node, we have a shorter path, so the node is relabeled.

• After all the nodes adjacent to the working node have been inspected and the tentative labels changed if possible, the
entire graph is searched for the tentatively labeled node with the smallest value.

• This node is made permanent and becomes the working node for the next round. At this point we have just made E
permanent. Suppose that there were a shorter path than ABE
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.
Distance Vector Routing:
• A distance vector routing algorithm operates by having each router maintain a table (i.e., a vector) giving the
best known distance to each destination and which link to use to get there.

• These tables are updated by exchanging information with the neighbors.

• Neighboring routers periodically exchange information from their routing tables.

• Routers replace routes in their own routing tables anytime that neighbors have found better routes.

• Information provided from neighbors

-Outgoing line used for destination

-Estimate of time or distance

• Can be number of hops, time delay, packet queue length, etc.


Figure . (a) A network. (b) Input from A, I, H, K, and the new routing table for J.
• The first four columns of part (b) show the delay vectors received from the neighbors of router J. A claims to
have a 12-msec delay to B, a 25-msec delay to C, a 40- msec delay to D, etc. Suppose that J has measured or
estimated its delay to its neighbors, A, I, H, and K, as 8, 10, 12, and 6 msec, respectively.

• Consider how J computes its new route to router G. It knows that it can get to A in 8 msec, and furthermore A
claims to be able to get to G in 18 msec, so J knows it can count on a delay of 26 msec to G if it forwards
packets bound for G to A.

• Similarly, it computes the delay to G via I, H, and K as 41 (31 + 10), 18 (6 + 12), and 37 (31 + 6) msec,
respectively.

• The best of these values is 18,

• so it makes an entry in its routing table that the delay to G is 18 msec and that the route to use is via H.

• The same calculation is performed for all the other destinations, with the new routing table shown in the last
column of the figure.
The Count-to-Infinity Problem

Figure . The count-to-infinity problem.


Distance Vector Routing-The Count to infinity Problem
• Distance vector routing works in theory but has a serious drawback in practice: It reacts rapidly to good news,
but leisurely to bad news.

• To see how fast good news propagates, consider the five-node (linear) network of Fig. (a), where the delay
metric is the number of hops. Suppose A is down initially and all the other routers know this. In other words,
they have all recorded the delay to A as infinity.

• When A comes up, the other routers learn about it via the vector exchanges.

• At the time of the first exchange,

• B learns that its left-hand neighbor has zero delay to A. B now makes an entry in its routing table indicating
that A is one hop away to the left. All the other routers still think that A is down.
Link State Routing
• Distance vector routing was used in the ARPANET until 1979, when it was replaced by link state routing.

• The idea behind link state routing is fairly simple and can be stated as five parts. Each router must do the
following things to make it work:

1. Discover its neighbors and learn their network addresses.

2. Set the distance or cost metric to each of its neighbors.

3. Construct a packet telling all it has just learned.

4. Send this packet to and receive packets from all other routers.

5. Compute the shortest path to every other router.


1. Discover its neighbors and learn their network addresses.
a) Send “Hello” packet on each point-to-pint line. Destination node replies with its address.
• When two or more routers are connected by a broadcast link (e.g., a switch, ring, or classic Ethernet), the
situation is slightly more complicated.
• Fig.(a) illustrates a broadcast LAN to which three routers, A, C, and F, are directly connected.
• Each of these routers is connected to one or more additional routers, as shown.

Figure (a) Nine routers and a broadcast LAN. (b) A graph model of (a).
Assignment 2:
Building Link State Packets
• Once the information needed for the exchange has been collected, the next step is for each router to build a
packet containing all the data.
• The packet starts with the identity of the sender, followed by a sequence number and age and a list of
neighbors.
• The cost to each neighbor is also given. An example network is presented in Fig. (a) with costs shown as
labels on the lines.
• The corresponding link state packets for all six routers are shown in Fig.(b).

Figure (a) A network. (b) The link state packets for this network.
Distributing the Link State Packets
Figure . The packet buffer for router B in Fig.(a).

• The link state packet from A arrives directly, so it must be sent to C and F and acknowledged to A, as indicated by the
flag bits. Similarly, the packet from F has to be forwarded to A and C and acknowledged to F.

• For example, if a copy of C’s state arrives from F before the fourth entry in the table has been forwarded, the six bits will
be changed to 100011 to indicate that the packet must be acknowledged to F but not sent there.
Computing the New Routes
• Once a router has accumulated a full set of link state packets, it can construct the entire network graph because
every link is represented.

• Every link is, in fact, represented twice, once for each direction. The different directions may even have
different costs.

• The shortest-path computations may then find different paths from router A to B than from router B to A.

• Now Dijkstra’s algorithm can be run locally to construct the shortest paths to all possible destinations. The
results of this algorithm tell the router which link to use to reach each destination.

• Compared to distance vector routing, link state routing requires more memory and computation.

• For a network with n routers, each of which has k neighbors, the memory required to store the input data is
proportional to kn, which is at least as large as a routing table listing all the destinations.
Hierarchical Routing
Figure . Hierarchical routing.
Broadcast Routing
• Sending a packet to all destinations simultaneously is called broadcasting.
• Many methods are there
1. Source to simply send a packet to each destination.
2. Flooding is another method.
• It generates too many packets and consumes too much space.
Multi destination routing:
• which each packet contains either a list of destinations or a bit map indicating the desired destinations. When a
packet arrives at a router, the router checks all the destinations to determine the set of output lines that will be
needed.

• The router generates a new copy of the packet for each output line to be used and includes in each packet only
those destinations that are to use the line.
• The idea for reverse path forwarding is elegant and remarkably simple once it has been pointed out (Dalal and Metcalfe,
1978). When a broadcast packet arrives at a router, the router checks to see if the packet arrived on the link that is normally
used for sending packets toward the source of the broadcast.

Figure . Reverse path forwarding. (a) A network. (b) A sink tree. (c) The tree built by reverse path forwarding.
Routing for Mobile Hosts
• Millions of people use computers while on the go, from truly mobile situations with wireless devices in
moving cars, to nomadic situations in which laptop computers are used in a series of different locations.

• We will use the term mobile hosts to mean either category, as distinct from stationary hosts that never move.

• These mobile hosts introduce a new complication: to route a packet to a mobile host, the network first has to
find it.

Assumed Model:
• The model of the world that we will consider is one in which all hosts are assumed to have a permanent home
location that never changes.

• Each hosts also has a permanent home address that can be used to determine its home location.

• Like the telephone number 1-212-5551212 indicates the United States (country code 1) and Manhattan (212).
Features:
• The basic idea used for mobile routing in the Internet and cellular networks is for the mobile
host to tell a host at the home location.

• This host, which acts on behalf of the mobile host, is called the home agent.

• Once it knows where the mobile host is currently located, it can forward packets so that they
are delivered. The Figure shows mobile routing in action.

• The local address called core of address.

• Once it has this address it can tell as home agent where it is now. It does this by sending
registration message to home agent with care of address
Routing for Mobile Hosts

Figure . Packet routing for mobile hosts.


Description of Diagram
• The message is shown with a dashed line in the figure indicates that it is a control message not a
data message.

• The sender sends a data packet to the mobile host using its permanent address.

• The packet is routed by the network to the host home location because the home addresses belongs
there.

• It encapsulates the packet with a new header and sends this bundle to the care of address.

• This mechanism is called tunnelling.

• It is very important on the internet, so we will look at it in more detail later.


Description of Diagram
• When the encapsulated packet arrives at the care of address, the mobile host unwraps it and retrieves
the packet from the sender.

• The overall router is called triangle routing because it way is circuitous if the remote location is far
from home location.

• As per of the step , 4 senders learns the current care of address.

• Sub sequent packets can be routed directly to the mobile host by tunnelling them to the care of
address(step 5) bypassing the home location.

• If connectivity lost for any reason as the mobile moves, the home address can always be used to
reach the mobile.
Routing in Ad Hoc Networks
Challenges

- Dynamic topology

- Unreliable links

- Limited resources(battery, processing power)

- Low link bandwidth

- Security

- No default router available

No physical links:

- Wireless links created and destroyed as nodes move

- Frequent disconnections and partitions


Congestion Control algorithms
Congestion Control algorithms…..
General Principles of congestion control
1.Monitor the system
-Detect when and where congestion occurs
2.Pass information to where action can be taken.
3. Adjust system operation to correct the problem.
Approaches to Congestion Control
Two solutions possible:
1. Increase resources
2. Decrease load
Two categories of congestion control

• Open loop solutions

-Attempt to prevent problems rather than correct them.

-does not utilize runtime feedback from the system.

. Closed loop solutions

-Uses feedback(measurements of system performance) to make corrections at runtime.

Open loop: Prevent congestion before it happens

Closed loop: Remove congestion after it happens


Open-loop approach

- Problem is solved at the design cycle.

- Once the system is running midcourse correction are NOT made.

- Tools for doing open-loop control:

• Deciding when to accept new traffic

• Deciding when to disregard packets and which ones

• Making scheduling decision at various points in the network

• Note that all those decisions are made without regard to the current state of the network.
Closed loop approach

-It is based on the principle of feedback-loop. The approach has three parts when applied to congestion
control:
1. Monitor the system to detect when and where congestion occurs,
2. Pass this information tot places where action can be taken
3. Adjust system operation to correct the problem.
Retransmission Policy:

• Packet can be transmit to the source again

Window Policy:

• Selective-reject window method

Acknowledgement policy:

• Receiver sends the acknowledgement.

Discarding Policy:

• Router discards less sensitive packets when congestion likely to happened.

Admission Policy:

• Quality of service mechanisms


Warning Bit/Backpressure
• A special bit (warning bit) in the packet header is set by the router to warn the source when
congestion is detected.
• The bit is copied and piggy-backed on the ACK and sent to the sender.
• The sender monitors the number of ACK packets it receives with the warning bit set and adjusts its
transmission rate accordingly.
• Algorithm at source
-As long as warning bits arrive: reduce traffic
-Less warning bits: increase traffic
-Used in DecNet and Frame relay
Choke Packets:
• A more direct way of telling the source to slow down.
• A choke packet is a control packet generated at a congested node and transmitted to restrict traffic
flow.
• The source, on receiving the choke packet must reduce its transmission rate by a certain percentage.
– Host receiving choke packet
• reduces traffic to the specified destination
• ignores choke packets for a fixed interval
• new choke packets during next listening interval?
– Yes: reduce traffic
-No: increase traffic
Hop-by-hop choke packets
• Over long distances or at high speeds choke packets are not very effective.
• A more efficient method is to send to choke packets hop-by-hop.
• This requires each hop to reduce its transmission even before the choke packet arrive at the source.
Load shedding
• When routers are being inundated (swamped) by packets that they cannot handle, they just throw
them away.

• When buffers become full, routers simply discard packets.

• Which packet is chosen to be the victim depends on the application and on the error strategy used in
the data link layer.

• File transfer - cannot discard older packets

• It will cause a gap in the received data.

• Real-time voice or video - throw away old data and keep new packets.

• Intelligent discard policy

• Applications must mark their packets in priority classes to indicate how important they are.
Random Early Discard (RED)
• This is an approach in which the router discards one or more packets before the buffer becomes completely
full.

• Each time a packet arrives, the RED algorithm computes the average queue length, avg.

• If avg is lower than some lower threshold, congestion is assumed to be minimal or non-existent and the packet
is queued.

• If avg is greater than some upper threshold, congestion is assumed to be serious and the packet is discarded.

• If avg is between the two thresholds, this might indicate the onset (beginning) of congestion. The probability
of congestion is then calculated.
Jitter control
• The variation in the packet arrival times is called jitter.
• Important for audio and video applications.
Example
• Having some packets taking 20 msec and others taking 30 msec to arrive will give an uneven quality to the
sound or movie.
• • The jitter can be bounded by computing the expected transit time for each hop along the path.
• When a packet arrives at a router, the router checks to see how much the packet is behind or ahead of its
schedule.
• This information is stored in the packet and updated at each hop.
• If the packet is ahead of schedule, it is held just long enough to get it back on schedule.
• If it is behind schedule, the router tries to get it out the door quickly.
• In video on demand, jitter is eliminated, by buffering at the receiver and then fetching data for display from
the buffer and not from the network in real time.
• In applications require real-time interaction (Internet telephony and videoconferencing),the delay inherent in
buffering is not acceptable
Traffic Shaping
1. Another method of congestion control is to “shape” the traffic before it enters the network.

2. Traffic shaping controls the rate at which packets are sent (not just how many). Used in ATM and
Integrated Services networks.

3. At connection set-up time, the sender and carrier negotiate a traffic pattern (shape).

Two traffic shaping algorithms are:

• Leaky Bucket

• Token Bucket

The Leaky Bucket Algorithm used to control rate in a network. It is implemented as a single server
queue with constant service time. If the bucket (buffer) overflows then packets are discarded.
(a) A leaky bucket with water. (b) a leaky bucket with packets.

1. The leaky bucket enforces a constant output rate (average rate) regardless of the burstiness of the input. Does nothing when
input is idle.
2. The host injects one packet per clock tick onto the network. This results in a uniform flow of packets, smoothing out bursts
and reducing congestion.
3. When packets are the same size (as in ATM cells), the one packet per tick is okay. For variable length packets though, it is
better to allow a fixed number of bytes per tick. E.g. 1024 bytes per tick will allow one 1024-byte packet or two 512-byte
packets or four 256-byte packets on 1 tick
Token Bucket Algorithm
1. In contrast to the LB, the Token Bucket Algorithm, allows the output rate to vary, depending on the
size of the burst.
2. In the TB algorithm, the bucket holds tokens. To transmit a packet, the host must capture and destroy
one token.
3. Tokens are generated by a clock at the rate of one token every t sec.
4. Idle hosts can capture and save up tokens (up to the max. size of the bucket) in order to send larger
bursts later.

(a) Before. (b) After.


Leaky Bucket vs. Token Bucket
1. LB discards packets; TB does not. TB discards tokens.

2. With TB, a packet can only be transmitted if there are enough tokens to cover its length in bytes.

3. LB sends packets at an average rate. TB allows for large bursts to be sent faster by speeding up the
output.

4. TB allows saving up tokens (permissions) to send large bursts. LB does not allow saving.
IPV6 Addressing
• An address space is the total number of addresses used by the protocol. For N bits, 2N bits address space can be
used, because each bit can have two different values (0 or 1).
• An IPv6 address is 128 bits or 16 bytes (octets) long, four times the address length in IPv4.
Representation
• An IPV6 addresses are of 128 bits long or 16 bytes. To make 128 bit form shorter and easier to read, IPV6 addresses
are usually written in hexadecimal form with colon separating the 2bytes called as hexadecimal colon notation or
Dotted quad notation.
• The colon hexadecimal notation (or colon hex for short) divides the address into eight sections, each made of four
hexadecimal digits separated by colons.
Abbreviation
• In hexadecimal form, even the IP address is very long, in that many of the digits are found to be zero.
• Therefore we can go for abbreviation in order to reduce the size. Only the leading zeros can be omitted no the
trailing zeros. The abbreviated address for the above mentioned IPV6 address is given as,
If there are consecutive sections of zeros only, we can remove
the zeros altogether and replace them with a double semicolon.
This type of abbreviation is allowed only once per address
If there are two runs of zero sections only one of them can be abbreviated
Address space
• The address space of IPv6 contains 2128 addresses. This address space is 296 times the
IPv4 address
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.
Multicast Address
• A multicast address also defines a group of computers.
• However, there is a difference between any casting and multicasting.
• In any casting, 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.
Address Space Allocation
• 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 : Prefixes for assigned IPv6 addresses

Global Unicast Addresses


The block in the address space that is used for unicast (one-to-one) communication between two hosts in the Internet is
called the global unicast address block. CIDR for the block is 2000::/3, which means that the three leftmost bits are the
same for all addresses in this block (001). The size of this block is 2125 bits, which is more than enough for Internet
expansion for many years to come. An address in this block is divided into three parts: global routing prefix (n bits), subnet
identifier (m bits), and interface identifier (q bits), as shown in Figure 3.44 The figure also shows the recommended length
for each part.
Global unicast address

IPV6 PROTOCOL
The change of the IPv6 address size requires the change in the IPv4 packet format. The following
shows other changes implemented in the protocol in addition to changing address size and format.
▪ Better header format
▪ New options
▪ Allowance for extension
▪ Support for resource allocation
▪ Support for more security
Version. The 4-bit version field defines the version number of the IP. For IPv6, the value
is 6.
Traffic class. The 8-bit traffic class field is used to distinguish different payloads with different
delivery requirements. It replaces the type-of-service field in IPv4.
Flow label. The flow label is a 20-bit field that is designed to provide special handling for a particular
flow of data
Payload length. The 2-byte payload length field defines the length of the IP datagram excluding the
header
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.
Source and destination addresses. The source address field is a 16-byte (128-bit) Internet address that
identifies the original source of the datagram. The destination address field is a 16-byte (128-bit)
Internet address that identifies the destination of the datagram.
Payload. Compared to IPv4, the payload field in IPv6 has a different format and meaning
Extension Header
The length of the base header is fixed at 40 bytes. However, to give more functionality to
the IP datagram, the base header can be followed by up to six extension headers.

Hop-by-Hop Option
The hop-by-hop option is used when the source needs to pass information to all routers visited by the
datagram.
Destination Option
The destination option is used when the source needs to pass information to the destination only.
Intermediate routers are not permitted access to this information.
Source Routing
The source routing extension header combines the concepts of the strict source route and the loose
source route options of IPv4.
Fragmentation
The concept of fragmentation in IPv6 is the same as that in IPv4. In IPv4, the source or a router is
required to fragment if the size of the datagram is larger than the MTU of the network over which the
datagram travels. In IPv6, only the original source can fragment. A source must use a Path MTU
Discovery technique to find the smallest MTU supported by any network on the path. The source then
fragments using this knowledge.
Authentication
The authentication extension header has a dual purpose: it validates the message sender and ensures the
integrity of data.
Encrypted Security Payload
The encrypted security payload (ESP) is an extension that provides confidentiality and guards against
eavesdropping.
Comparison of Options between IPv4 and IPv6
The following shows a quick comparison between the options used in IPv4 and the options used in
IPv6 (as extension headers).
❑ The no-operation and end-of-option options in IPv4 are replaced by Pad1 and PadN options in
IPv6.
❑ The record route option is not implemented in IPv6 because it was not used.
❑ The timestamp option is not implemented because it was not used.
❑ The source route option is called the source route extension header in IPv6.
❑ The fragmentation fields in the base header section of IPv4 have moved to the fragmentation
extension header in IPv6.
❑ The authentication extension header is new in IPv6.
❑ The encrypted security payload extension header is new in IPv6.

You might also like