0% found this document useful (0 votes)
15 views

CN Unit 3 ppt

The document discusses the network layer's role in packet delivery and routing in computer networks. It outlines the responsibilities of the network layer, including logical addressing, routing, and the implementation of connection-oriented and connectionless services. Additionally, it covers various routing algorithms, their classifications, and properties, emphasizing the importance of adaptive and non-adaptive routing methods.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

CN Unit 3 ppt

The document discusses the network layer's role in packet delivery and routing in computer networks. It outlines the responsibilities of the network layer, including logical addressing, routing, and the implementation of connection-oriented and connectionless services. Additionally, it covers various routing algorithms, their classifications, and properties, emphasizing the importance of adaptive and non-adaptive routing methods.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 150

UNIT 3

NETWORK LAYER
Need For Network Layer

F
LAN F LAN
F 2
1
1
WAN
F LAN
F 3 F
LAN F
2 1
2

There is no provision in the data link(or physical layer) to make


the routing decision as the frame does not carry any routing
information. To solve the problem of delivery through several
link, the network layer was designed. The network layer is
responsible for host to host delivery and for routing the packets
through routers and switches.
Network Layer
 Network layer is responsible for source to destination delivery of
the packets.
 The network layer must know the topology of the subnet and
choose appropriate paths through it.
 When source and destination are in different networks, the
network layer (IP) must deal with these differences.
 If two system are connected to the same link, there is usually no
need for a network layer
Network Layer Responsibilities
LOGICAL ADDRESSING
Logical addressing are necessary for universal communication
that are independent of underlying physical network.
The logical address in the Internet is a 32 bit address

ROUTING
When independent network or link are connected to create
internetwork or a large network, the connecting devices(router
or switch) routes the packet to their final destination.
Network layer functions
• transport packet from sending to
receiving hosts
application

• network layer protocols in every transpor


t
network
host, router data link
physical
networ
networ
k data networ
k data link k data

three important functions: link


physica
physica
l
networ
link
physica
l l
k data
 path determination: route taken by link
physica
networ
k data

packets from source to destination. l link


physica
networ l
Routing algorithms networ
k data
k data
link
link physical

• switching: move packets from physica


l data networapplicatio
link k n
router’s input to appropriate router physica
l
transport
network
output data link
physical

• call setup: some network


architectures require router call
setup along path before data flows
STORE-AND-FORWARD PACKET SWITCHING
Components of a computer network:
►Hosts (computers, handheld deveices etc.)
►Switches.

►Routers.

►Wireless access points.

Router ISP’s equipment


Process P1 P2

B
D

A E F

Host H1 LAN H2

C
Packet

FIGURE: The environment of the network layer


protocols.
Network service model

Q: What service model for


“channel” transporting The most
packets from sender to important
receiver? abstraction
provided by
• guaranteed bandwidth? network layer:
virtual

?? ?
• preservation of inter-packet circuit
or
timing (no jitter)? datagram
• loss-free delivery? ?
• in-order delivery?
• congestion feedback to
sender?
Virtual circuits
“source-to-dest path behaves much like telephone
circuit”
–performance-wise
–network actions along source-to-dest path

call setup, teardown for each call before data can flow
each packet carries VC identifier (not destination host ID)
every router on source-dest path maintains “state” for each
passing connection
–(in contrast, transport-layer connection only involved two end systems)
link, router resources (bandwidth, buffers) may be allocated to VC
–to get circuit-like performance
Virtual circuits: signaling protocols
• used to set up, maintain, and tear down
VC
• used in ATM, frame-relay, X.25
• not used in today’s Internet

application
6. Receive data
transport
5. Data flow begins
4. Call connected application
networ 3. Accept call transport
networ
k data 1. Initiate call 2. incoming
call k data
link
link
physica
physica
l
l
Datagram networks: the Internet
model
• no call setup at network layer
• routers: no state about end-to-end connections
– no network-level concept of “connection”
• packets typically routed using destination host ID
– packets between same source-dest pair may take
different paths

applicatio
applicatio
n
n
transport
1. Send 2. Receive transport
network
data data network
data link
data link
physical
physical
What’s in a Routing Table?

• The routing table at A, for example, lists at a minimum the


next hops for the different destinations

Des Next
t Hop
B
B B
C
C C A
D
D C
E
E E
F F F G

G F
IMPLEMENTATION OF
CONNECTIONLESS SERVICE
► Packets are injected into the network individually and routed
independently of each other.
► Any advance setup is not required.
► Packets are called datagrams in this context (in analogy with
telegrams).
► The network is called a datagram network.
FIGURE: Routing within a datagram
network.
IMPLEMENTATION OF CONNECTION-
ORIENTED SERVICE
► We require a virtual-circuit (VC) network.
► The idea behind VCs is to avoid having to choose a
new route for every packet sent.
► When a connection is established a route between
source and destination is chosen and stored within
the tables inside the routers.
► That route is used for all traffic flowing over the
connection.
► This is exactly similar to the telephone system.
► When the connection is released, VC is also
terminated.
► With connection-oriented service, each packet
carries an identifier telling which virtual circuit it
belongs to.
FIGURE: Routing within a virtual-circuit
network.
Routing
Routing
protocol
Goal: determine “good” 5
path (sequence of 3
routers) thru network B C 5
2
from source to dest. A 2
3
1 F
Graph abstraction for 1 2
D 1 E
routing algorithms:
• graph nodes are
• “good” path:
routers – typically means minimum cost
• graph edges are path
– other definitions possible
physical links
– link cost: delay, $ cost, or
congestion level
Routing Algorithm
• In order to transfer the packets from source to the destination,
the network layer must determine the best route through which
packets can be transmitted.
• Whether the network layer provides datagram service or virtual
circuit service, the main job of the network layer is to provide
the best route. The routing protocol provides this job.
• The routing protocol is a routing algorithm that provides the
best path from the source to the destination. The best path is
the path that has the "least-cost path" from source to the
destination.
• Routing is the process of forwarding the packets from source to
the destination but the best route to send the packets is
determined by the routing algorithm.
Desirable properties of a routing
algorithm:
1. Correctness
2. Simplicity
3. Robustness
4. Stability
5. Fairness
6. Efficiency.
Classification of a Routing algorithm
The Routing algorithm is divided into two categories:
Adaptive Routing algorithm
Non-adaptive Routing algorithm
Adaptive Routing algorithm
 An adaptive routing algorithm is also known as dynamic
routing algorithm.
 This algorithm makes the routing decisions based on the
topology and network traffic.
 The main parameters related to this algorithm are hop count,
distance and estimated transit time

Adaptive algorithms can be further divided in the following types


Centralized: a centralized node makes all routing decisions.
Specifically, the centralized node has access to global
information.
Isolated: each router makes its routing decisions using only the
local information it has on hand. Specifically, routers do not
even exchange information with their neighbors
Distributed: algorithms that use a combination of local and
global information.
Non Adaptive Routing Algorithm
 Non Adaptive routing algorithm is also known as a static routing
algorithm.
 When booting up the network, the routing information stores to
the routers.
 Non Adaptive routing algorithms do not take the routing
decision based on the network topology or network traffic.
The Non-Adaptive Routing algorithm is of two types:
• Flooding: In case of flooding, every incoming packet is sent to all
the outgoing links except the one from it has been reached. The
disadvantage of flooding is that node may contain several copies
of a particular packet.
• Random walks: In case of random walks, a packet sent by the
node to one of its neighbors randomly. An advantage of using
random walks is that it uses the alternative routes very
efficiently.
Optimality Principle

This simply 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 this same path.

This means we can form a sink tree as in the Figure.


Shortest Path Routing Non-Adaptive
Algorithms Algorithm

Often used because simple and easy to understand.


What if we `know' the complete topology of the network?
Can look at computing the optimal path.
What if we have the following network and we want to route a
packet from node A to node G. What is the shortest path (do not
initially show distance).
Use Dijkstra's algorithm (or variation). Basic idea is:
Choose the source, and put nodes connected to source in list
to consider.
From the list to consider choose the nearest node.
Shortest path Routing
Algorithms
Non-Adaptive
Flooding
Algorithm

Flooding is a form of isolated routing. Does not select a specific


route. When a router receives a packet, it sends a copy of the
packet out on each line (except the one on which it arrived):

To prevent packets from looping forever, each router


decrements a hop count contained in the packet header.
Whenever the hop count decrements to zero, the router discards
the packet.

To reduce looping even further:


1. Add a sequence number to each packet's header.
2. Each router maintains a private sequence number. When it sends
a new packet, it copies the sequence number into the packet,
and increments its private sequence number.
Flooding Non-Adaptive
Algorithm
3. For each source router S, a router:
a) Keeps track of the highest sequence number seen from S.
b) Whenever it receives a packet from S containing a sequence
number lower than the one stored in its table, it discards the
packet.
c) Otherwise, it updates the entry for S and forwards the packet
on
Flooding has several important uses:
1. In military applications, the network must remain robust in the
face of (extreme) hostility.
2. Theoretical-chooses all possible paths, so it chooses the shortest
one.
Non-Adaptive
Flow Based Routing
Algorithms Algorithm

Takes into account both the topology and the load (But still
static.)
Assumes:
1.Traffic flows remain constant over time.
2.We can estimate the flow between all pairs of routers.
3.We know the topology of the network and the capacity of each
link
4.Given the line capacity and the flow, we can determine the
delay. From that, we can calculate the delay for the whole subnet,
and between any two nodes.
Non-Adaptive
Flow Based Routing
Algorithms Algorithm

The traffic in packets/sec and the routing matrix

A subnet with line capacity


in kbps
Non-Adaptive
Flow based Routing
Algorithms Algorithm
Need to use the formula
1
for delay time:
T
= C - 

where is the mean packet size in bits,


1/ =
=mean number of arrivals in packets/sec
C = line capacity (bits/sec).
Routing Algorithms Adaptive
Algorith
In general, the methods are: m
1. Centralized - uses a routing control center (RCC).
Creates, modifies, and distributes routing tables to other
routers. Gathers information from the routers.
a)Good: adaptive routing, relieve burden on the routers of
computing tables.
b)Problems: Does not adapt quickly.
c)Quicker the adaptation, the more overhead it causes.
d)Synchronization of updates (some routers change, but
not others, so could have situation where two routers
send at each other).
e)If RCC crashes the network becomes stale.
f)Lines near the RCC are overloaded.
Routing Algorithms Adaptive
Algorith
m
2.Decentralized - Base decisions on local traffic and conditions.

Hot potato-choose output line with the shortest queue


Backward learning - each packet contains source address and
number of hops so far. Use this information to learn shortest
path to each source.
Will learn shortest path to all routers. Only deal with good
news, not bad. `Good' may no longer be good due to down
router or congestion.
Adaptive
Routing Algorithms
Algorith
m
3.Distributed - Routers work together.
1.Each router maintains a table (vector) giving the best known
distance to a destination and the line to use for sending there.
Tables are updated by exchanging information with neighbors.
2.Each router knows the distance (cost) of reaching its neighbors
(e.g. send echo requests).
3.Routers periodically exchange routing tables with each of their
neighbors.
4.Upon receipt of an update, for each destination in its table, a
router
-Compares the metric in its local table with the metric in the neighbor's
table plus the cost of reaching that neighbor.
-if the path via the neighbor has a lower cost, the router updates its local
table to forward packets to the neighbor
Adaptive
Distance Vector Routing
Algorithms Algorith
m
 This algorithm was used in the original ARPANET.
Unfortunately, it suffers from the problem: It travels quickly,
but travels slowly (count-to-infinity problem).

 The fundamental problem with the old Arpanet algorithm is


that it continues to use `old' information that is invalid, even
after newer information becomes available.
Adaptive
Distance Vector Routing
Algorithms Algorithm
Counting to infinity

• One of the important issue in Distance Vector Routing is


County of Infinity Problem.
• Counting to infinity is just another name for a routing loop.
• In distance vector routing, routing loops usually occur when
an interface goes down.
• It can also occur when two routers send updates to each
other at the same time.
Counting to infinity

• Imagine a network with a graph as shown above in figure


• In this graph, there is only one link between A and the other parts of the
network.
• Now imagine that the link between A and B is cut.
• At this time, B corrects its table.
• After a specific amount of time, routers exchange their tables, and so B
receives C's routing table.
Counting to infinity
• Since C doesn't know what has happened to the link between A and
B, it says that it has a link to A with the weight of 2 (1 for C to B, and
1 for B to A -- it doesn't know B has no link to A).
• B receives this table and thinks there is a separate link between C
and A, so it corrects its table and changes infinity to 3 (1 for B to C,
and 2 for C to A, as C said).
• Once again, routers exchange their tables.
• When C receives B's routing table, it sees that B has changed the
weight of its link to A from 1 to 3, so C updates its table and changes
the weight of the link to A to 4 (1 for C to B, and 3 for B to A, as B
said).
• This process loops until all nodes find out that the weight of link to A
is infinity.
Counting to infinity Problem
In this way, Distance Vector Algorithms have a slow convergence
rate.
Adaptive
Link State Routing
Algorithms Algorith
 m
The basic concept of link-state routing is that every node
constructs a map of the connectivity to the network, in the
form of a graph, showing which nodes are connected to
which other nodes. Each node then independently
calculates the next best logical path from it to every
possible destination in the network.
 It is a dynamic routing algorithm in which each router
shares knowledge of its neighbors with every other router
in the network.
 A router sends its information about its neighbors only to
all the routers through flooding.
 Information sharing takes place only whenever there is a
.
change.
Adaptive
Algorith
It makes use of Dijkastra’s Algorithm for making routing m
tables.
B 2 C Lin Stat Packet
A k
B C e D Es F
4 3 Seq. Seq. Seq. Seq. Seq. Seq.

A D Age Age Age Age Age Age


1 6 B 4 A 4 B 2 C 3 B 6
5 A 5
7 F 7
E 5 C 2 D 3 C 1 D 7
E 8 F F 6 E 1 F 8 E 8

(a) (b
)

FIGURE: ((a) A network. (b) The link state packets for this
network.
Adaptive
Hierarchical Routing
Algorithms Algorithm

One of the fundamental issues regarding routing is scaling.


a)As a network becomes larger, the amount of information that
must be propagated increases, and the routing calculation
becomes increasingly expensive.
b)Obviously, there are limits to how big a network can be.

Hierarchical routing is an approach that hides


information from far-away nodes, reducing the amount of
information a given router needs to perform routing:
Adaptive
Hierarchical Routing
Algorithms Algorithm

Divide the network into regions, with a router only knowing the
details of how to route to other routers in its region.
a) In particular, a router does not know about the internal
topology of other regions.
b) Gateway is a router that knows about other regions.

A node in each region is designated as an entry point, and


the entry point knows how to reach the entry points in all
the other regions.
Hierarchical routing can be extended to multi-levels.
Example: telephone system
FIGURE: Hierarchical routing
Adaptive
Broadcast Routing Algorithms
Algorithm
 In Some Application , the host has to send packets to many
or all other hosts.
 broadcast routing, packets are sent to all nodes even if they
do not want it. Routers create broadcast domains. But it can
be configured to forward broadcasts in some special cases.
 A broadcast message is destined to all network devices.
A router creates a data packet and then sends it to each
host one by one.
► When messages need to be sent to many or all other hosts.
► Simple Broadcast
► Flooding
► Multidestination routing.
► Explicit Use of Sink Tree
► Reverse path forwarding.
Adaptive
Algorith
m
Multicast Routing Adaptive
Algorithms Algorithm
 Some application requires that widely spread process work
together in graph.
 A process has to send a message to all other processes in
the graph. In small group it is possible send point to point
messages.
 But it is expensive if group is large.
 So we have to send message to a well defined group which
are small compared to network size.
 Sending message to such a group is called Multicasting &
routing algorithm used for it. It is Multicast Routing.
 Multicast require group management. Some way is needed
to create and destroy group and to allow process to join and
leave group.
Adaptive
Multicast Routing
Algorithms Algorith
m
 To do mulicasting each router computes a spanning tree
covering all other routers.

FIGURE: (a) A network. (b) A spanning tree for the leftmost router .
 When a process send a multicast packet to a group the first
router examine its spanning tree and remove all lines that
do not lead to host that are members of the group.
Multicast Routing Adaptive
Algorithms Algorithm

FIGURE: (c) A multicast tree for group 1. (d) A multicast tree for
group 2.

Disadvantages: It is not suitable for large network n groups. Each


has m members so total mn spanning tree create.
Other Routing

Mobile Hosts - machines that are not currently connected to


their home location. Must get traffic to base host. Need
intermediary agents.. Base host uses encapsulation
(tunneling) to send packet to mobile host.

The Areas have


Foreign Agents - keep track of mobile users visiting an area.
Home Agent - keep track of users whose home is in the area
but are away.

Foreign agents broadcast packet advertising their


existence; or mobile host can ask where there’s a Foreign
Agent. Mobile host registers with Foreign Agent
Foreign agent contacts
the Mobile Host’s
home agent, telling that
Home Agent that
messages for the
Mobile Host should be
sent to the Foreign
Agent

Home Agent checks


security
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.
 The Internet Protocol is responsible for addressing host
interfaces, encapsulating data into datagrams
(including fragmentation and reassembly) and routing
datagrams from a source host interface to a destination host
interface across one or more IP networks. For these purposes,
the Internet Protocol defines the format of packets and
provides an addressing system.
IPv4 Header
• IPV4 header format is 20 to 60 bytes in length. It contains
information need for routing and delivery. It consists of 13
fields such as Version, Header length, total distance,
identification, flags, checksum, source IP address,
destination IP address. It provides essential data need to
transmit the data.

• Following are various components/fields of IP packet header

• Version: The first IP header field is a 4-bit version indicator. In


IPv4, the value of its four bits is set to 0100, which indicates 4
in binary. However, if the router does not support the specified
version, this packet will be dropped
IPv4 Header
Internet Header Length: Internet header length, shortly
known as IHL, is 4 bits in size. It is also called HELEN
(Header Length). This IP component is used to show how
many 32-bit words are present in the header.
Type of Service: Type of Service is also called
Differentiated Services Code Point or DSCP. This field is
provided features related to the quality of service for data
streaming or VoIP calls. The first 3 bits are the priority bits.
It is also used for specifying how you can handle Datagram.
Total Length: The total length is measured in bytes. The
minimum size of an IP datagram is 20 bytes and the
maximum, it can be 65535 bytes . HELEN and Total length
can be used to calculate the dimension of the payload.
The hosts are required to be able to read 576-byte
datagrams. However, if a datagram is too large for the hosts
in the network, the fragmentation method is widely used.
Identification: Identification is a packet that is used to identify
fragments of an IP datagram uniquely. Some have recommended
using this field for other things like adding information for packet
tracing, etc.
IP Flags: Flag is a three-bit field that helps you to control and
identify fragments.The following can be their possible
configuration:
Bit 0: is reserved and has to be set to zero
Bit 1: means do not fragment
Bit 2: means more fragments.
Fragment Offset: Fragment Offset represents the number of Data
Bytes ahead of the particular fragment in the specific Datagram. It
is specified in terms of the number of 8 bytes, which has a
maximum value of 65,528 bytes.
Time to live: It is an 8-bit field that indicates the maximum time the
Datagram will be live in the internet system. The time duration is
measured in seconds, and when the value of TTL is zero, the Datagram
will be erased.
Protocol: This IPv4 header is reserved to denote that internet protocol
is used in the latter portion of the Datagram.
Header Checksum: The next component is a 16 bits header
checksum field, which is used to check the header for any
errors. The IP header is compared to the value of its checksum.
When the header checksum is not matching, then the packet
will be discarded.
Source Address: The source address is a 32-bit address of the
source used for the IPv4 packet.
Destination address: The destination address is also 32 bit in
size stores the address of the receiver
IP Options: It is an optional field of IPv4 header used when the
value of IHL (Internet Header Length) is set to greater than 5.
It contains values and settings related with security, record
route and time stamp, etc. You can see that list of options
component ends with an End of Options or EOL in most cases.
Data: This field stores the data from the protocol layer, which has
handed over the data to the IP layer.
IP ADDRESSES

• An IP address is a unique address that identifies a device on the


internet or a local network. IP stands for "Internet Protocol,"
which is the set of rules governing the format of data sent via the
internet or local network.
• Two versions of the Internet Protocol are in common use on the
Internet today. The original version of the Internet Protocol that
was first deployed in 1983 in the ARPANET, the predecessor of
the Internet, is Internet Protocol version 4 (IPv4).
• The rapid exhaustion of IPv4 address space available for
assignment to Internet service providers and end-user
organizations by the early and explore new technologies to
expand the addressing capability on the Internet.
IPv4 ADDRESSES

• The result was a redesign of the Internet Protocol which


became eventually known as Internet Protocol Version
6 (IPv6) in 1995. Today, these two versions of the Internet
Protocol are in simultaneous use.
• An 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.
• The IPv4 addresses are unique and universal.
• The address space of IPv4 is 232 or 4,294,967,296.

Dotted-decimal notation and binary notation for an IPv4 address


Classes of Address Space
• In classful addressing, the address space is divided into five
classes:
• A, B, C, D, and E.
Class Sizes
Way too big
Class Prefix Network Number of Classes Hosts per Class
Bits Bits
A 1 7 27 – 2 = 126 224 – 2 = 16,777,214
(0 and 127 are reserved) (All 0 and all 1 are reserved)
B 2 14 214 = 16,398 216 – 2 = 65,534
(All 0 and all 1 are reserved)
C 3 21 221 = 2,097,512 28 – 2 = 254
(All 0 and all 1 are reserved)
Total: 2,114,036
Too small to be useful
Too many network IDs

62
Reserved IP Network Numbers
Network number Subnet mask IP address range
10.0.0.0 255.0.0.0 10.0.0.1-10.255.255.255
172.16.0.0-172.31.0.0 255.255.0.0 172.16.0.1-172.31.255.255
192.168.0.0 255.255.255.0 192.168.0.1-192.168.255.255
Example
Find the class of each address.
a. 00000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
c. 14.23.120.8
d. 252.5.15.111

Solution
a. The first bit is 0. This is a class A address.
b. The first 2 bits are 1; the third bit is 0. This is a class C address
c. The first byte is 14; the class is A.
d. The first byte is 252; the class is E.
Subnet Mask

 A subnet mask is a 32-bit number created by setting host bits to all


0s and setting network bits to all 1s.
 An IP address has 2 parts:
 The Network identification/Address.
 The Host identification/Address.
 Frequently, the Network & Host portions of the address need to
be separately extracted.
 In most cases, if you know the address class, it’s easy to separate
the 2 portions.
 The “255” address is always assigned to a broadcast address, and
the “0” address is always assigned to a network address. Neither
can be assigned to hosts, as they are reserved for these special
purposesses.
When organizations need additional subnetworking,
subnetting divides the host element of the IP address further
into a subnet. The goal of subnet masks are simply to enable
the subnetting process. The phrase “mask” is applied
because the subnet mask essentially uses its own 32-bit
number to mask the IP address.
Default masks for classful addressing

Class D networks are reserved for multicasting, and Class E


networks not used on the internet because they are reserved
for research by the Internet Engineering Task Force ( IETF).
A Class A subnet mask reflects the network portion in the first
octet and leaves octets 2, 3, and 4 for the network manager to
divide into hosts and subnets as needed. Class A is for
networks with more than 16,77,216 hosts.
A Class B subnet mask claims the first two octets for the
network, leaving the remaining part of the address, the 16 bits
of octets 3 and 4, for the subnet and host part. Class B is for
networks with 256 to 65,534 hosts.
• In a Class C subnet mask, the network portion is the first
three octets with the hosts and subnets in just the
remaining 8 bits of octet 4. Class C is for smaller networks
with fewer than 254 hosts.
• Subnetting enables an organization to conceal network
complexity and reduce network traffic by adding subnets
without a new network number. When a single network
number must be used across many segments of a local area
network (LAN), subnetting is essential.

• The benefits of subnetting include:


 Reducing broadcast volume and thus network traffic
 Enabling work from home
 Allowing organizations to surpass LAN constraints such as
• maximum number of hosts
IP Subnet Rule
• An example of the process of getting the network ID and
host ID:
– IP address = 128.143.137.144
– Subnet mask = 255.255.0.0
– Network ID = (128.143.137.144 & 255.255.0.0) =>
128.143.0.0
– Host ID = 137.144 (of network 128.143.0.0)
This is just a simplified demonstration, in fact you need to convert the
decimal form to binary form, order to perform the ANDING operation
Network ID Host ID
128.143 137.144
IP
address
IP Subnet Rule
• Another example to determine what the network ID is,
for any given IP address
– you have to convert both octal addresses into binary, and
do a bitwise AND operation.
• An example using an IP address of 156.154.81.56 used
with a network mask of 255.255.255.240 follows:

• This translate to a network ID of 156.54.81.48


• Sometimes, network ID is also called network address or
subnet address
Example
A block of addresses is granted to a small organization.Let one of the
addresses is 205.16.37.39/28. What is the first address in the block?

Solution
The binary representation of the given address is
11001101 00010000 00100101 00100111
If we set 32−28 rightmost bits to 0, we get
11001101 00010000 00100101 0010000
or
205.16.37.32.

19.71
Figure A network configuration for the block
205.16.37.32/28
Example
What is the subnetwork address if the destination address is
200.45.34.56 and the subnet mask is 255.255.240.0?
Solution

11001000 00101101 00100010 00111000


11111111 11111111 11110000 00000000
11001000 00101101 00100000 00000000

The subnetwork address is 200.45.32.0.

19.73
Subnetwork
A subnetwork or subnet is a logical subdivision of an IP
network. The practice of dividing a network into two or
more networks is called subnetting.
Subnet Host Count
The number of subnetworks available and the number of
possible hosts in a network may be readily calculated. For
instance, the 192.168.5.0/24 network may be subdivided into
the following four /26 subnets. The highlighted two address
bits become part of the network number in this process.
Network Network (binary) Broadcast address

192.168.5.0/26 11000000.10101000.00000101.00000000 192.168.5.63

192.168.5.64/26 11000000.10101000.00000101.01000000 192.168.5.127

192.168.5.128/26 11000000.10101000.00000101.10000000 192.168.5.191

192.168.5.192/26 11000000.10101000.00000101.11000000 192.168.5.255


 Host IP Address: 138.101.114.250
 Network Mask: 255.255.0.0
 Subnet Mask: 255.255.255.192

Given the following Host IP Address, Network Mask and Subnet mask find
the following information:

 Major Network Information


 Major Network Address

 Major Network Broadcast Address

 Range of Hosts if not subnetted

 Subnet Information
 Subnet Address

 Range of Host Addresses (first host and last host)

 Broadcast Address
Subnetting – Example
 Other Subnet Information
 Total number of subnets

 Number of hosts per subnet

Major Network Information


 Host IP Address: 138.101.114.250
 Network Mask: 255.255.0.0
 Subnet Mask: 255.255.255.192

 Major Network Address: 138.101.0.0


 Major Network Broadcast Address: 138.101.255.255
 Range of Hosts if not Subnetted: 138.101.0.1 to 138.101.255.254
Step 1: Convert to Binary
128 64 32 16 8 4 2 1

138. 101. 114. 250


IP Address 10001010 01100101 01110010 11111010
Mask 11111111 11111111 11111111 11000000
255. 255. 255. 192
Step 1:
Translate Host IP Address and Subnet Mask into binary
notation
Step 2: Find the Subnet Address
138. 101. 114. 250
IP Address 10001010 01100101 01110010 11111010
Mask 11111111 11111111 11111111 11000000
Network 10001010 01100101 01110010 11000000
138 101 114 192

Step 2:
Determine the Network (or Subnet) where this Host
address lives:
1.Draw a line under the mask
2.Perform a bit-wise AND operation on the IP Address and the
Subnet
Mask
Note: 1 AND 1 results in a 1, 0 AND anything results in a 0
3.Express the result in Dotted Decimal Notation
4.The result is the Subnet Address of this Subnet or “Wire”
which is
138.101.114.192
Step 3: Subnet Range / Host Range
G.D. S.D.

IP Address 10001010 01100101 01110010 11111010


Mask 11111111 11111111 11111111 11 000000
Network 10001010 01100101 01110010 11 000000
 subnet   host 
counting range Counting
range

Step 3:
Determine which bits in the address contain Network
(subnet)
information and which contain Host information:
Use the Network Mask: 255.255.0.0 and divide (Great

Divide) the from the rest of the address.


Use Subnet Mask: 255.255.255.192 and divide (Small

Divide) the subnet from the hosts between the last “1” and the
first “0” in the subnet mask.
Step 4: First Host / Last Host
G.D. S.D.
11 111010
11 000000
IP Address 10001010 01100101 01110010 000000
11
Mask 11111111 11111111 11111111   host 
Network 10001010 01100101 01110010
countin g
 subnet
range
counting range
11 000001
First Host Last 193
10001010 01100101 01110010
11 111110
138 101 114
Host Broadcast 254
10001010 01100101 01110010
11 111111
138 101 114
255

10001010 01100101 01110010


138 101 114
Host Portion
Subnet Address: all 0’s

First Host: all 0’s and a

1
Last Host: all 1’s and a
0
Broadcast: all 1’s
Step 5: Total Number of Subnets
G.D. S.D.

IP Address 10001010 01100101 01110010 11 111010


Mask 11111111 11111111 11111111 11 000000
01110010 11
Network 10001010 01100101 000000

 host 
subnet 
counting

Total number of 101


subnets114
counting range
 First Host 10001010 01100101 01110010 11 000001
range
138 193

Number
Last Hostof subnet
10001010 bits01100101
10 01110010 11 111110
138 101 114 254

2 = 1,024
10
Broadcast 10001010 01100101 01110010 11 111111

1,024 total138subnets101 114 255

Subtract one “if” all-zeros subnet cannot
be used

Subtract

1,022one “if” all-ones subnet cannot
total
be used
subnets
Step 6: Total Number of Hosts per subnet
G.D. S.D.

01110010 11 111010
IP Address 10001010 01100101 11111111 11 000000
Mask 11111111 11111111 01110010 11
Network 10001010 01100101  000000
subnet   host 
counting range counting
First Host 10001010 01100101 01110010 11 000001
range
138 101 114 193
 Total number10001010
Last Host
of hosts 01100101
per subnet
01110010 11 111110

Number138of host bits 101 6 114 254

26Broadcast
= 64 10001010 01100101 01110010 11 111111
138 101 114 255

64 host per subnets

Subtract one for the subnet address

Subtract one for the broadcast address

62 hosts per subnet
Subnet Host Count
The remaining bits after the subnet bits are used for
addressing hosts within the subnet. In the above example,
the subnet mask consists of 26 bits, making it
255.255.255.192, leaving 6 bits for the host identifier. This
allows for 62 host combinations (26−2).

Each address in the block can be considered as


a two-level hierarchical structure:
the leftmost n bits (prefix) define the network;
the rightmost 32 − n bits define the host.
Example of Subnet Host Count

An ISP is granted a block of addresses starting with


190.100.0.0/16 (65,536 addresses). The ISP needs to distribute
these addresses to three groups of customers as follows:
a. The first group has 64 customers; each needs 256
addresses.
b. The second group has 128 customers; each needs 128
addresses.
c. The third group has 128 customers; each needs 64
addresses.
Design the subblocks and find out how many addresses are still
available after these allocations.

19.85
Solution
Group 1
For this group, each customer needs 256 addresses. This means
that 8 (log2 256) bits are needed to define each host. The prefix
length is then 32 − 8 = 24. The addresses are
Solution
Group 2
For this group, each customer needs 128 addresses. This means
that 7 (log2 128) bits are needed to define each host. The prefix
length is then 32 − 7 = 25. The addresses are
Solution
Group 3
For this group, each customer needs 64 addresses. This means
that 6 (log264) bits are needed to each host. The prefix length
is then 32 − 6 = 26. The addresses are

Number of granted addresses to the ISP: 65,536


Number of allocated addresses by the ISP: 40,960
Number of available addresses: 24,576
An example of address allocation and distribution by
an ISP
Example :
A company is granted the site address 211.80.64.0 .The
company needs eight subnets. Design the subnets?

Solution:
No. of subnet must be power of 2 therefore we design 8 subnets
No.of subnet bits=Log2(8)=3 bits

Ip address 211.80.64.0 is class c

Net Sub Host

24 Bit 3 Bit 5 Bit


IPv6 ADDRESSES
⚫ The next generation Internet Protocol (IPv6) is poised to
make a new wave in the coming decade.
⚫ There is some serious limitations of the current IP protocol,
or IPv4 to be precise.
⚫ IP version 6 or IPv6 (also known as IPng - ng for new/next
generation), provides 128-bit addressing (that's billions
upon billions of addresses).
⚫ And compatibility with IPv4 addresses, security and
authentication, quality of service (reserving bandwidth),
plug-and-play for network device configuration,
hierarchically structured routing and an ability to
seamlessly integrate with the current IP during the
transition stages.
IPv6 ADDRESSES
⚫ IPv6 is technology with a main focus on changing the
structure of current IP addresses, which will allow for
virtually unlimited IP addresses.
⚫ The current version, IPv4 is a growing concern with the
limited IP addresses, making it a fear that they will run out
in the future.
⚫ IPv6 will also have a goal to make the Internet a more
secure place for browsers, and with the rapid number of
identity theft victims, this is a key feature.
⚫ Efficient and hierarchical addressing and routing
infrastructure- based on the common occurrence of
multiple levels of Internet service providers.
IPv6 datagram header and payload
Challenges in Today’s Internet

⚫ QOS Issues
– Multiple methods available
– Non-uniformity across network boundaries
⚫ Security
– No uniformity, myriad methods
– Multitude of methods for “hackers” to attack networks
⚫ Mobility
– Increasing number of wireless/mobile devices
accessing Internet services
– Inadequate support for IP mobility in devices (moving
seamlessly from one network to another)
– 3G & 4G initiatives, 802.11x, Bluetooth, UWB moving
connectivity from wireline to wireless
Why is IPv6 Here :
⚫ IPv6 provides a platform for new Internet functionality
that will be needed in the immediate future, and
provide flexibility for further growth and expansion.

Features of IPv6 :
⚫ Addressing
⚫ Header
⚫ Security
⚫ Privacy
⚫ Auto configuration
⚫ Routing
⚫ Quality of Service
⚫ Cost savings
Continue
⚫ Expanded addressing and routing capabilities
– 128-bit addresses
– Multicast routing is now scalable with “scope” field
– Defined usage of “Any cast” addressing
⚫ Simplified header format
– Some IPv4 fields dropped or made optional
– IPv6 packet header only twice the size of v4 header, even though address is four
times a v4 address
⚫ Extension headers
– “Options” are now placed in separate headers
– “Options” are now any length
– Router doesn’t have to look at most “Options”*
⚫ Auto-configuration
– Self-configuring nodes for local links
– Auto-configuration for site links
– Stateless uses “Router Advertisement”
Continue
⚫ Centralized management
⚫ New “v6” features
⚫ Source Routing
–Support for Source Demand Routing Protocol (SDRP)
–Sender can specify packet route
–Destination can return packet via same route
⚫ Route Aggregation
–Address Hierarchy
–Deployed in “Groups”
IPv6 versus IPv4 :

⚫ No Broadcast in IPv6
– Replaced by Multicast
– Multicast scope provides flexibility
⚫ Uncontrolled fragmentation in IPv4
– Only a source node can fragment IPv6
– Limits packet size to minimum MTU in path
(Maximum Transmission Unit)
⚫ Other features inherent to IPv6
- Security encryption
- Header encryption
- Sender authentication
- Privacy
Congestion
►ifthe load on the network i.e.the number of packets sent to the
network is greater than the capacity of the network or the
number of packets a network can handle.
►Too many packets present in (a part of) the network causes
packet delay and loss that degrades performance.
►This situation is called congestion.
►The network and transport layers share the responsibility for
handling congestion.
►Since congestion occurs within the network, it is the network
layer that directly experiences it and must ultimately
determine what to do with the excess packets.
Congestion
►However, the most effective way to control congestion is to
reduce the load that the transport layer is placing on the
network.
►This requires the network and transport layers to work
together.
Causes of Congestion
• Congestion occurs when a router receives data faster
than it can send it
– Insufficient bandwidth
– Slow hosts
– Data simultaneously arriving from multiple lines
destined for the same outgoing line.
• The system is not balanced
– Correcting the problem at one router will probably
just move the bottleneck to another router.
Congestion Causes More Congestion
– Incoming messages must be placed in queues
• The queues have a finite size
– Overflowing queues will cause packets to be dropped
– Long queue delays will cause packets to be resent
– Dropped packets will cause packets to be resent
• Senders that are trying to transmit to a congested
destination also become congested
– They must continually resend packets that have been
dropped or that have timed-out
– They must continue to hold utgoing/unacknowledged
messages in memory.
Congestion Control
• Congestion control refers to techniques and mechanisms that
can either prevent congestion, before it happens, or remove
congestion, after it has happened.
Open-Loop Congestion Control
In open-loop congestion control, policies are applied to prevent
congestion before it happens. In these mechanisms, congestion
control is handled by either the source or the destination.
Retransmission Policy :
 Retransmission is sometimes unavoidable.
 If the sender feels that a sent packet is lost or corrupted, the
packet needs to be retransmitted. Retransmission in general may
increase congestion in the network.
 So good retransmission policy can prevent congestion. So the
retransmission policy and the retransmission timers must be
designed to optimize efficiency and at the same time prevent
congestion.
Window Policy :
 The type of window at the sender may also affect congestion.
 The Selective Repeat window is better than the Go-Back-N
window for congestion control.
 Acknowledge Policy :
 If the receiver does not acknowledge every packet it receives, it
may slow down the sender and help prevent congestion.
 A receiver may send an acknowledgment only if it has a packet
to be sent or a special timer expires.
 A receiver may decide to acknowledge only N packets at a time.
Window Policy :
 The type of window at the sender may also affect congestion.
 The Selective Repeat window is better than the Go-Back-N
window for congestion control.
 Acknowledge Policy :
 If the receiver does not acknowledge every packet it receives, it
may slow down the sender and help prevent congestion.
 A receiver may send an acknowledgment only if it has a packet
to be sent or a special timer expires.
 A receiver may decide to acknowledge only N packets at a time.
Closed-Loop Congestion Control
Closed-loop congestion control mechanisms try to alleviate
congestion after it happens. Several mechanisms have been
used by different protocols.
Backpressure :
 in which a congested node stops receiving data from the
immediate upstream node or nodes.
 This may cause the upstream node or nodes to become
congested, and they, in turn, reject data from their upstream
nodes or nodes.
Continue
 Node III in the figure has more input data than it can handle. It
drops some packets in its input buffer and informs node II to
slow down.
 Node II, in turn, may be congested because it is slowing down
the output flow of data. If node II is congested, it informs node
I to slow down, which in turn may create congestion.
 If so, node I inform the source of data to slow down. This, in
time, alleviates the congestion.
Choke Packet :
 A choke packet is a packet sent by a node to the source to
inform it of congestion.
 In the choke packet method, the warning is from the router,
which has encountered congestion, to the source station
directly.
Continue.
 Node III in the figure has more input data than it can handle. It
drops some packets in its input buffer and informs node II to slow
down.
 Node II, in turn, may be congested because it is slowing down the
output flow of data. If node II is congested, it informs node I to
slow down, which in turn may create congestion.
 If so, node I inform the source of data to slow down. This, in time,
alleviates the congestion.
Choke Packet :
 A choke packet is a packet sent by a node to the source to inform
it of congestion.
 In the choke packet method, the warning is from the router,
which has encountered congestion, to the source station directly.
Implicit Signaling :
 In implicit signaling, there is no communication between the
congested node or nodes and the source.
 The source guesses that there is congestion somewhere in the
network from other symptoms.
 For example, when a source sends several packets and there is
no acknowledgment for a while, one assumption is that the
network is congested so the source should slow down.
Exmplicit Signaling :
 The node that experiences congestion can explicitly send a
signal to the source or destination.
 The signal is included in the packets that carry data. Explicit
signaling, in Frame Relay congestion control, can occur in either
the forward or the backward direction.
• (i) Backward Signaling
A bit can be set in a packet moving in the direction opposite
to the congestion. This bit can warn the source that there is
congestion and that it needs to slow down to avoid the
discarding of packets.
(Ii) Forward Signaling
A bit can be set in a packet moving in the direction of the
congestion. This bit can warn the destination that there is
congestion. The receiver in this case can use policies, such as
slowing down the acknowledgments, to alleviate the
congestion.
Open-Loop Control
• Network performance is guaranteed to all traffic flows that
have been admitted into the network
• Initially for connection-oriented networks
• Key Mechanisms
– Admission Control
– Policing
– Traffic Shaping
– Traffic Scheduling
Admission Control
• Flows negotiate contract
with network
Peak rate • Specify requirements:
– Peak, Avg., Min Bit rate
– Maximum burst size
Average rate – Delay, Loss requirement
• Network computes
resources needed
– “Effective” bandwidth
• If flow accepted, network
allocates resources to
Time ensure QoS delivered as
Typical bit rate demanded by a long as source conforms to
variable bit rate information contract
source
Policing
• Network monitors traffic flows continuously to ensure they
meet their traffic contract
• When a packet violates the contract, network can discard or
tag the packet giving it lower priority
• If congestion occurs, tagged packets are discarded first
• Leaky Bucket Algorithm is the most commonly used policing
mechanism
– Bucket has specified leak rate for average contracted rate
– Bucket has specified depth to accommodate variations in arrival
rate
– Arriving packet is conforming if it does not result in overflow
Traffic Shaping
• Another method of congestion control is to “shape” the
traffic before it enters the network.
• Traffic shaping controls the rate at which packets are sent
(not just how many). Used in ATM and Integrated Services
networks.
• At connection set-up time, the sender and carrier negotiate
a traffic pattern (shape).
• Two traffic shaping algorithms are:
– Leaky Bucket
– Token Bucket

116
The Leaky Bucket Algorithm
• 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.
• The leaky bucket enforces a constant output rate (average
rate) regardless of the burstiness of the input. Does nothing
when input is idle.
• 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.

117
The Leaky Bucket Algorithm

(a) A leaky bucket with water. (b) a leaky bucket with packets.
118
• 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.

119
Leaky Bucket Traffic Shaper
Size
Incoming traffic N Shaped traffic
Ser
ver
Packet

•Buffer incoming packets


•Play out periodically to conform to parameters
•Surges in arrivals are buffered & smoothed out
•Possible packet loss due to buffer overflow
•Too restrictive, since conforming traffic does not need to be
completely smooth
Token Bucket Algorithm
• In contrast to the LB, the Token Bucket Algorithm, allows
the output rate to vary, depending on the size of the burst.
• In the TB algorithm, the bucket holds tokens. To transmit a
packet, the host must capture and destroy one token.
• Tokens are generated by a clock at the rate of one token
every t sec.
• Idle hosts can capture and save up tokens (up to the max.
size of the bucket) in order to send larger bursts later.

32
The Token Bucket Algorithm

5-
34

(a) Before. (b) After. 33


Token bucket
Token Bucket Traffic Shaper
Tokens
arrive
periodically
An incoming packet must
have sufficient tokens
before admission into the
network Size K
Toke
n

Size N Shaped traffic


Incoming traffic
Server

Packet
•Token rate regulates transfer of packets
•If sufficient tokens available, packets enter network without delay
•K determines how much burstiness allowed into the network
Leaky Bucket vs Token Bucket

• LB discards packets; TB does not. TB discards tokens.


• With TB, a packet can only be transmitted if there are
enough tokens to cover its length in bytes.
• LB sends packets at an average rate. TB allows for large
bursts to be sent faster by speeding up the output.
• TB allows saving up tokens (permissions) to send large
bursts. LB does not allow saving.

125
Load Shedding
• 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.
• For a file transfer, for, e.g. cannot discard older packets
since this will cause a gap in the received data.
•For real-time voice or video it is probably better to throw
away old data and keep new packets.
• Get the application to mark packets with discard priority.

126
IP Address
IP was designed as a best-effort delivery protocol, but it lacks
some features such as flow control and error control. It is a
host-to-host protocol using logical addressing.
To make IP more responsive to some requirements in today's
internetworking, we need the help of other protocols.
We need protocols to create a mapping between physical and
logical addresses.(ARP)
IP packets use logical (host-to-host) addresses. These packets,
however, need to be encapsulated in a frame, which needs
physical addresses (node-to-node).
sometimes need reverse mapping-mapping a physical address to
a logical address. (RARP) Lack of flow and error control in the
Internet Protocol has resulted in another protocol, ICMP, that
provides alerts. It reports congestion and some types of
errorsin the network or destination host.
Address Mapping
An internet is made of a combination of physical networks
connected by internetworking devices such as routers.
A packet starting from a source host may pass through several
different physical networks before finally reaching the
destination host.
The hosts and routers are recognized at the network level by
their logical (IP) addresses. However, packets pass through
physical networks to reach these hosts and routers. At the
physical level, the hosts and routers are recognized by their
physical addresses.
A physical address is a local address. Its jurisdiction is a local
network. It must be unique locally, but is not necessarily
unique universally. It is called a physical address because it is
implemented in hardware.
Address Mapping
The physical address and the logical address are two different identifiers. We need both.
Delivery of a packet to a host or a router requires two levels of addressing: logical and
physical. We need to be able to map a logical address to its corresponding physical
address and vice versa.
These can be done by using either static or dynamic mapping.
Static mapping involves in the creation of a table that associates a logical address with a
physical address. This table is stored in each machine on the network.
Each machine that knows, for example, the IP address of another machine but not its
physical address can look it up in the table.
Static mapping as several limitation as physical address may change due to change in
network card or physical network
To implement these changes, a static mapping table must be updated periodically. This
overhead could affect network performance.
Mapping Logical to Physical
Address: ARP
Anytime a host or a router has an IP datagram to send to another
host or router, it has the logical (IP) address of the receiver. The
logical (IP) address is obtained from the DNS if the sender is the
host or it is found in a routing table the sender is a router.
But the IP datagram must be encapsulated in a frame to be able
to pass through the physical network. This means that the
sender needs the physical address of the receiver. The host or
the router sends an ARP query packet.
The packet includes the physical and IP addresses of the sender
and the IP address of the receiver.
Because the sender does not know the physical address of the
receiver, the query is broadcast over the network.
ARP operation
Continue
Every host or router on the network receives and processes the
ARP query packet, but only the intended recipient recognizes
its IP address and sends back an ARP response packet.
The response packet contains the recipient's IP and physical
addresses. The packet is unicast directly to the inquirer by
using the physical address received in the query packet.
Cache Memory
Using ARP is inefficient if system A needs to broadcast an ARP
request for each IP packet it needs to send to system B. It
could have broadcast the IP packet itself.
ARP can be useful if the ARP reply is cached (kept in cache
memory for a while) because a system normally sends several
packets to the same destination. A system that receives an ARP
reply stores the mapping in the cache memory and keeps it for
20 to 30 minutes unless the space in the cache is exhausted.
Before sending an ARP request, the system first checks its
ARP packet
Continue
o Hardware type. This is a 16-bit field defining the type of the
network on which ARP is running. Each LAN has been assigned
an integer based on its type. For example, Ethernet is given
type 1. ARP can be used on any physical network.
o Protocol type. This is a 16-bit field defining the protocol. For
example, the value of this field for the IPv4 protocol is 080016,
ARP can be used with any higher-level protocol.
o Hardware length. This is an 8-bit field defining the length of the
physical address in bytes. For example, for Ethernet the value
is 6.
o Protocol length. This is an 8-bit field defining the length of the
Continue
o Sender hardware address. This is a variable-length field defining the
physical address of the sender.
For example, for Ethernet this field is 6 bytes long.
o Sender protocol address. This is a variable-length field defining the
logical (for example, IP) address of the sender. For the IP protocol, this
field is 4 bytes long.
o Target hardware address. This is a variable-length field defining the
physical address of the target. For example, for Ethernet this field is 6
bytes long. For an ARP request message, this field is alI 0s because the
sender does not know the physical address of the target.
o Target protocol address. This is a variable-length field defining the
logical (for example, IP) address of the target. For the IPv4 protocol,
this field is 4 bytes long.
Encapsulation
An ARP packet is encapsulated directly into a
data link frame.

Encapsulation of ARP packet


ARP Process
These are the steps involved in an ARP process:
1.The sender knows the IP address of the target.
2.IP asks ARP to create an ARP request message, filling in the sender physical
address, the sender IP address, and the target IP address. The target physical
address field is filled with 0s.
3.The message is passed to the data link layer where it is encapsulated in a
frame by using the physical address of the sender as the source address and the
physical broadcast address as the destination address.
4.Every host or router receives the frame. Because the frame contains a
broadcast destination address, all stations remove the message and pass it to
ARP. All machines except the one targeted drop the packet. The target
machine recognizes its IP address.
5.The target machine replies with an ARP reply message that contains its
physical address. The message is unicast.
Continue
6. The sender receives the reply message. It now knows the
physical address of the target machine.
7. The IP datagram, which carries data for the target machine, is
now encapsulated in a frame and is unicast to the destination.
The following are four different cases in which the services of ARP
can be used
1. The sender is a host and wants to send a packet to another host
on the same network. In this case, the logical address that must
be mapped to a physical address is the destination IP address in
the datagram header.
2. The sender is a host and wants to send a packet to another host
on another network. In this case, the host looks at its routing
table and finds the IP address of the next hop (router) for this
destination. If it does not have a routing table, it looks for the IP
address of the default router. The IP address of the router
becomes the logical address that must be mapped to a physical
ARP Process
3.The sender is a router that has received a datagram destined for a
host on another network. It checks its routing table and finds the IP
address of the next router. The IP address of the next router becomes
the logical address that must be mapped to a physical address.
4.The sender is a router that has received a datagram destined for a
host on the same network. The destination IP address of the datagram
becomes the logical address that must be mapped to a physical
address.
Four cases using ARP
Mapping Physical to Logical
Address
There are occasions in which a host knows its physical address, but
needs to know its logical address. This may happen in two cases:
1.A diskless station is just booted. The station can find its physical
address by checking its interface, but it does not know its IP address.
2.An organization does not have enough IP addresses to assign to each
station; it needs to assign IP addresses on demand. The station can
send its physical address and ask for a short time lease.
RARP
Reverse Address Resolution Protocol (RARP) finds the logical address for a
machine that knows only its physical address.
To create an IP datagram, a host or a router needs to know its own IP address.
A diskless machine just booted from ROM, has minimum booting information
and doesn’t include
the IP address because the IP addresses on a network are assigned by the
network administrator.
The machine can get its physical address (by reading its NIC) which is unique
locally. It can then use the physical address to get the logical address by using
the RARP protocol.
A RARP request is created and broadcast on the local network. Another machine
on the local
network that knows all the IP addresses will respond with a RARP reply.
The requesting machine must be running a RARP client program; the responding
machine must be running a RARP server program.
RARP
There is a serious problem with RARP: Broadcasting is done at the data
link layer. The physical broadcast address, as in the case of Ethernet,
does not pass the boundaries of a network.
This means that if an administrator has several networks or several
subnets, it needs to assign a RARP server for each network or subnet.
This is the reason that RARP is almost obsolete.
DHCP
• The Dynamic Host Configuration Protocol (DHCP) has been devised to provide
static and dynamic address allocation that can be manual or automatic.
• Static Address Allocation
• When a client requests its IP address, the DHCP server consults a table that
matches the physical address of the client with its IP address. This implies that
the binding between the physical address and the IP address of the client
already exists.
• A host running the DHCP client can request a static address from a DHCP
server. A DHCP server has a database that statically binds physical addresses
to IP addresses.
• Dynamic Address Allocation
• DHCP has a second database with a pool of available IP addresses. This
second database makes DHCP dynamic. When a DHCP client requests a
temporary IP address, the DHCP server goes to the pool of available (unused)
IP addresses and assigns an IP address for a negotiable period of time.
DHCP
When a DHCP client sends a request to a DHCP server, the server
first checks its static database. If an entry with the requested physical
address exists in the static database, the permanent IP address of
the client is returned.
On the other hand, if the entry does not exist in the static database,
the server selects an IP address from the available pool, assigns the
address to the client, and adds the entry to the dynamic database.
The dynamic aspect of DHCP is needed when a host moves from
network to network or is connected and disconnected from a network
(as is a subscriber to a service provider). DHCP provides temporary
IP addresses for a limited time.
The addresses assigned from the pool are temporary addresses. The
DHCP server issues a lease for a specific time. When the lease
expires, the client must either stop using the IP address or renew the
lease. The server has the option to agree or disagree with the
renewal. If the server disagrees, the client stops using the address.
ICMP
The IP protocol has no error-reporting or error-correcting mechanism.
What happens if something goes wrong?
What happens if a router must discard a datagram because it cannot find a
router to the final destination, or because the time-to-live field has a zero
value?
What happens if the final destination host must discard all fragments of a
datagram because it has not received all fragments within a predetermined
time limit?
These are examples of situations where an error has occurred and the IP
protocol has no built-in
mechanism to notify the original host.
The Internet Control Message Protocol (ICMP) has been designed to
compensate for the above deficiency. It is a companion to the IP
protoco1 that can notify the host or the router about the errors
occurred in the network.
ICMP
ICMP messages are divided into two broad categories:
Error-reporting messages,
Query messages.
The error-reporting messages report problems that a router or a host
(destination) may
encounter when it processes an IP packet.
The query messages, which occur in pairs, help a host or a network
manager get specific information from a router or another host.
For example, nodes can discover their neighbors. Also, hosts can discover
and learn about routers on their network, and routers can help a node
redirect its messages.
Error Reporting Messages
One of the main responsibilities of ICMP is to report errors. Although
technology has produced increasingly reliable transmission media,
errors still exist and must be handled.
As IP is connectionless protocol error checking and error control are
not a concern of IP. ICMP was designed, in part, to compensate for this
shortcoming.
ICMP does not correct errors-it simply reports them. Error correction
is left to the higher-level protocols.
Error messages are always sent to the original source because the only
information available in
the datagram about the route is the source and destination IP
addresses.
ICMP uses the source IP address to send the error message to the
source (originator) of the datagram.
Error Reporting Messages
Error Reporting Messages

You might also like