Professional Documents
Culture Documents
Network Layer
FLOODING
Hop Counter
Sequence Number
Selective Flooding
Hop Counter
Sequence Number
Selective Flooding
Note –
From time-to-time, each node sends its own distance vector estimate to
neighbors.
When a node x receives new DVR estimate from any neighbor v, it saves v’s
distance vector and it updates its own DV using B-F equation:
Link state routing is a technique in which each router shares the knowledge
of its neighborhood with every other router in the internetwork.
Route Calculation
Each node uses Dijkstra's algorithm on the graph to calculate the optimal
routes to all nodes.
The Link state routing algorithm is also known as Dijkstra's algorithm which
is used to find the shortest path from one node to every other node in the
network.
The Dijkstra's algorithm is an iterative, and it has the property that after
kth iteration of the algorithm, the least cost paths are well known for k
destination nodes.
c( i , j): Link cost from node i to node j. If i and j nodes are not directly
linked, then c(i , j) = ∞.
D(v): It defines the cost of the path from source code to destination v that
has the least cost currently.
P(v): It defines the previous node (neighbor of v) along with current least cost
path from source to v.
Example:
First, we have to consider any vertex as a source vertex. Suppose we
consider vertex 0 as a source vertex.
Here we assume that 0 as a source vertex, and distance to all the
other vertices is infinity. Initially, we do not know the distances. First,
we will find out the vertices which are directly connected to the vertex
0. As we can observe in the above graph that two vertices are directly
connected to vertex 0.
Let's assume that the vertex 0 is represented by 'x' and the vertex 1 is
represented by 'y'. The distance between the vertices can be calculated by
using the below formula:
= (0 + 4) < ∞
=4<∞
Therefore, we come to the conclusion that the formula for calculating the
distance between the vertices:
= (0 + 8) < ∞
=8<∞
= (4 + 8) < ∞
= 12 < ∞
Now, we calculate the distance between the vertex 1 and vertex 4. Consider
the vertex 1 as 'x' and the vertex 4 as 'y'.
= (4 + 11) < 8
= 15 < 8
Since 15 is not less than 8, we will not update the value d(4) from 8 to 12.
Till now, two nodes have been selected, i.e., 0 and 1. Now we have to
compare the nodes except the node 0 and 1. The node 4 has the minimum
distance, i.e., 8. Therefore, vertex 4 is selected.
Since vertex 4 is selected, so we will consider all the direct paths from the
vertex 4. The direct paths from vertex 4 are 4 to 0, 4 to 1, 4 to 8, and 4 to 5.
Since the vertices 0 and 1 have already been selected so we will not consider
the vertices 0 and 1. We will consider only two vertices, i.e., 8 and 5.
First, we consider the vertex 8. First, we calculate the distance between the
vertex 4 and 8. Consider the vertex 4 as 'x', and the vertex 8 as 'y'.
= (8 + 7) < ∞
= 15 < ∞
Since 15 is less than the infinity so we update d(8) from infinity to 15.
Now, we consider the vertex 5. First, we calculate the distance between the
vertex 4 and 5. Consider the vertex 4 as 'x', and the vertex 5 as 'y'.
= (8 + 1) < ∞
=9<∞
Till now, three nodes have been selected, i.e., 0, 1, and 4. Now we have to
compare the nodes except the nodes 0, 1 and 4. The node 5 has the
minimum value, i.e., 9. Therefore, vertex 5 is selected.
Since the vertex 5 is selected, so we will consider all the direct paths from
vertex 5. The direct paths from vertex 5 are 5 to 8, and 5 to 6.
First, we consider the vertex 8. First, we calculate the distance between the
vertex 5 and 8. Consider the vertex 5 as 'x', and the vertex 8 as 'y'.
= (9 + 15) < 15
= 24 < 15
Since 24 is not less than 15 so we will not update the value d(8) from 15 to
24.
Now, we consider the vertex 6. First, we calculate the distance between the
vertex 5 and 6. Consider the vertex 5 as 'x', and the vertex 6 as 'y'.
= (9 + 2) < ∞
= 11 < ∞
Till now, nodes 0, 1, 4 and 5 have been selected. We will compare the nodes
except the selected nodes. The node 6 has the lowest value as compared to
other nodes. Therefore, vertex 6 is selected.
Since vertex 6 is selected, we consider all the direct paths from vertex 6. The
direct paths from vertex 6 are 6 to 2, 6 to 3, and 6 to 7.
First, we consider the vertex 2. Consider the vertex 6 as 'x', and the vertex 2
as 'y'.
= (11 + 4) < 12
= 15 < 12
Since 15 is not less than 12, we will not update d(2) from 12 to 15
Now we consider the vertex 3. Consider the vertex 6 as 'x', and the vertex 3
as 'y'.
= 25 < ∞
= 22 < ∞
Since node 2 is selected, so we consider all the direct paths from node 2.
The direct paths from node 2 are 2 to 8, 2 to 6, and 2 to 3.
First, we consider the vertex 8. Consider the vertex 2 as 'x' and 8 as 'y'.
= (12 + 2) < 15
= 14 < 15
Now, we consider the vertex 6. Consider the vertex 2 as 'x' and 6 as 'y'.
= (12 + 4) < 11
= 16 < 11
Since 16 is not less than 11 so we will not update d(6) from 11 to 16.
Now, we consider the vertex 3. Consider the vertex 2 as 'x' and 3 as 'y'.
= (12 + 7) < 25
= 19 < 25
Till now, nodes 0, 1, 2, 4, 5, and 6 have been selected. We compare all the
unvisited nodes, i.e., 3, 7, and 8. Among nodes 3, 7, and 8, node 8 has the
minimum value. The nodes which are directly connected to node 8 are 2, 4,
and 5. Since all the directly connected nodes are selected so we will not
consider any node for the updation.
The unvisited nodes are 3 and 7. Among the nodes 3 and 7, node 3 has the
minimum value, i.e., 19. Therefore, the node 3 is selected. The nodes which
are directly connected to the node 3 are 2, 6, and 7. Since the nodes 2 and 6
have been selected so we will consider these two nodes.
Now, we consider the vertex 7. Consider the vertex 3 as 'x' and 7 as 'y'.
= (19 + 9) < 21
= 28 < 21
Since 28 is not less than 21, so we will not update d(7) from 28 to 21.
A B C D E
∞ ∞ ∞ ∞ ∞
Since 0 is the minimum value in the above table, so we select vertex A and
added in the second row shown as below:
A B C D E
A 0 ∞ ∞ ∞ ∞
As we can observe in the above graph that there are two vertices directly
connected to the vertex A, i.e., B and C. The vertex A is not directly
connected to the vertex E, i.e., the edge is from E to A. Here we can calculate
the two distances, i.e., from A to B and A to C. The same formula will be
used as in the previous problem.
If(d(x) + c(x, y) < d(y))
A B C D E
A 0 ∞ ∞ ∞ ∞
10 5 ∞ ∞
As we can observe in the third row that 5 is the lowest value so vertex C will
be added in the third row.
Since the vertex C is selected, so we consider all the direct paths from the
vertex C. The direct paths from the vertex C are C to B, C to D, and C to E.
= (5 + 3) < ∞
=8<∞
Since 8 is less than the infinity so we update d(B) from ∞ to 8. Now the new
row will be inserted in which value 8 will be added under the B column.
A B C D E
A 0 ∞ ∞ ∞ ∞
10 5 ∞ ∞
= (5 + 9) < ∞
= 14 < ∞
Since 14 is less than the infinity so we update d(D) from ∞ to 14. The value
14 will be added under the D column.
A B C D E
A 0 ∞ ∞ ∞ ∞
C 10 5 ∞ ∞
8 14
= (5 + 2) < ∞
=7<∞
Since 14 is less than the infinity so we update d(D) from ∞ to 14. The value
14 will be added under the D column.
A B C D E
A 0 ∞ ∞ ∞ ∞
C 10 5 ∞ ∞
8 14 7
As we can observe in the above table that 7 is the minimum value among 8,
14, and 7. Therefore, the vertex E is added on the left as shown in the below
table:
A B C D E
A 0 ∞ ∞ ∞ ∞
C 10 5 ∞ ∞
E 8 14 7
The vertex E is selected so we consider all the direct paths from the vertex E.
The direct paths from the vertex E are E to A and E to D. Since the vertex A
is selected, so we will not consider the path from E to A.
Consider the path from E to D.
= (7 + 6) < 14
= 13 < 14
Since 13 is less than the infinity so we update d(D) from ∞ to 13. The value
13 will be added under the D column.
A B C D E
A 0 ∞ ∞ ∞ ∞
C 10 5 ∞ ∞
E 8 14 7
B 8 13
A B C D E
A 0 ∞ ∞ ∞ ∞
C 10 5 ∞ ∞
E 8 14 7
B 8 13
D 9
Hierarchical Routing
Step 1 − For example, the best path from 1A to 5C is via region 2, but
hierarchical routing of all traffic to region 5 goes via region 3 as it is better
for most of the other destinations of region 5.
Congestion Control
Token Bucket
Token bucket algorithm is one of the techniques for congestion control
algorithms. When too many packets are present in the network it
causes packet delay and loss of packet which degrades the
performance of the system. This situation is called congestion.
The network layer and transport layer share the responsibility for
handling congestions.
One of the most effective ways to control congestion is trying to reduce
the load that transport layer is placing on the network. To maintain
this network and transport layers have to work together.
The leaky bucket algorithm enforces output patterns at the average rate, no
matter how busy the traffic is. So, to deal with the more traffic, we need a
flexible algorithm so that the data is not lost. One such approach is the
token bucket algorithm.
Tunneling
Tunneling is an internetworking strategy that is used when source
and destination networks of same type are connected through a
network of different type.
In such a case, the packet from one network reaches the other
network via different kind of network that interconnects them.
To understand tunneling, let an Ethernet is to be connected to
another Ethernet via a WAN.
The IP packets are to be sent from host 1 of Ethernet 1 to host 2 of
Ethernet 2 via a WAN.
To send an IP packet to host 2, host 1 constructs the packet
containing the IP address of host 2.
It then inserts this packet into an Ethernet frame. This frame is
addressed to the multi-protocol router M1 and is placed on Ethernet.
When this packet reaches, multiprotocol router MI, it removes the IP
packet and insert it in the payload field of the WAN network layer
packet.
This WAN network layer packet is then addressed to multi-
protocol router M2.
When this packet reaches M2, it removes the IP packet and inserts it
into the Ethernet frame and sends it to host 2.
In the above process, IP packets do not have to deal with WAN, they
just travel from one end 0f the tunnel to the other end. The host 1
and host 2 on two Ethernet also do not have to deal with WAN.
The multi-protocol routers M1 & M2 understand about IP and WAN
packets.
INTERNET WORKING
FRAGMENTATION
Since there are 16 bits for total length in IP header so, the maximum size of
IP datagram = 216 – 1 = 65, 535 bytes.
It is done by the network layer at the destination side and is usually done at
routers.
Source side does not require fragmentation due to wise (good) segmentation
by transport layer i.e. instead of doing segmentation at the transport layer
and fragmentation at the network layer, the transport layer looks at
datagram data limit and frame data limit and does segmentation in such a
way that resulting data can easily fit in a frame without the need of
fragmentation.
Receiver identifies the frame with the identification (16 bits) field in the IP
header. Each fragment of a frame has the same identification number.
Receiver identifies the sequence of frames using the fragment offset (13
bits) field in the IP header
Overhead at the network layer is present due to the extra header introduced
due to fragmentation.
Fragment offset (13 bits) – use to identify the sequence of fragments in the
frame. It generally indicates a number of data bytes proceeding or ahead of
the fragment.
Maximum fragment offset possible = (65535 – 20) = 65515
So, we need ceil(log265515) = 16 bits for a fragment offset but the fragment
offset field has only 13 bits. So, to represent efficiently we need to scale
down the fragment offset field by 216/213 = 8 which acts as a scaling factor.
Hence, all fragments except the last fragment should have data in multiples
of 8 so that fragment offset ∈ N.
More fragments (MF = 1 bit) – tells if more fragments are ahead of this
fragment i.e. if MF = 1, more fragments are ahead of this fragment and if MF
= 0, it is the last fragment.
Reassembly of Fragments
It takes place only at the destination and not at routers since packets take
an independent path (datagram packet switching), so all may not meet at a
router and hence a need of fragmentation may arise again. The fragments
may arrive out of order also.
Algorithm
Repeat until MF = 0.
Efficiency –
IP PROTOCOLS
1. IPV4 2. IPV6
2. Header Length-
Header length is a 4 bit field that contains the length of the IP header.
It helps in knowing from where the actual data begins.
The length of IP header always lies in the range-[20 bytes , 60 bytes]
3. Type Of Service-
Type of service is a 8 bit field that is used for Quality of Service (QoS).
The datagram is marked for giving a certain treatment using this
field.
4. Total Length-
Total length is a 16 bit field that contains the total length of the
datagram (in bytes).
5. Identification-
a) DF Bit-
b)MF Bit-
7. Fragment Offset-
8. Time to Live-
9. Protocol-
Traffic Class (8-bits): The Traffic Class field indicates class or priority of
IPv6 packet which is similar to Service Field in IPv4 packet. It helps routers
to handle the traffic based on the priority of the packet. If congestion occurs
on the router then packets with the least priority will be discarded.
As of now, only 4-bits are being used (and the remaining bits are under
research), in which 0 to 7 are assigned to Congestion controlled traffic and 8
to 15 are assigned to Uncontrolled traffic.
Flow Label (20-bits): Flow Label field is used by a source to label the
packets belonging to the same flow in order to request special handling by
intermediate IPv6 routers, such as non-default quality of service or real-time
service. In order to distinguish the flow, an intermediate router can use the
source address, a destination address, and flow label of the packets.
Between a source and destination, multiple flows may exist because many
processes might be running at the same time. Routers or Host that does not
support the functionality of flow label field and for default router handling,
flow label field is set to 0. While setting up the flow label, the source is also
supposed to specify the lifetime of the flow.
Hop Limit (8-bits): Hop Limit field is the same as TTL in IPv4 packets. It
indicates the maximum number of intermediate nodes IPv6 packet is
allowed to travel. Its value gets decremented by one, by each node that
forwards the packet and the packet is discarded if the value decrements to
0. This is used to discard the packets that are stuck in an infinite loop
because of some routing error.
Types of IP Address-
1. Static IP Address-
IP Address Format-
IP Addressing-
Class A
The total no. of networks in class A is 27. and total no. of host is 224.
In class the leading bit is Zero(0) and the range of class A is 0 to 127
00000000.00000000.00000000.00000000
to
01111111.00000000.00000000.00000000
Class B
N/W ID Host ID
1 0 7 24
The total no. of networks in class B is 214. and total no. of host is
216
In class B the leading bits are 1,0 and the range of class B is 128
to 191
00000000.00000000.00000000.00000000
to
10111111.00000000.00000000.00000000
Class C
N/W ID Host ID
1 1 0 21 8
The total no. of networks in class C is 221. and total no. of host is
28
In class C the leading bits are 1, 1,0 and the range of class C is
192 to 223.
00000000.00000000.00000000.00000000
to
11011111.00000000.00000000.00000000
Class D
Host ID
1 1 1 0 28
In class D the leading bits are 1,1, 1,0 and the range of class D is
224 to 239
00000000.00000000.00000000.00000000
to
11101111.00000000.00000000.00000000
Class E
In class E the IP address are used for future use or research and
development purpose
It doesn’t possess any sub netting
In class E high order bit of the first octet is also set to 1,1,1,1 and
reaming 28bits determine as Host id.
Leading bit
Host ID
1 1 1 1 28
In class E the leading bits are 1,1, 1,1 and the range of class E is
239 to 255
So we are calculating the range of class E is
00000000.00000000.00000000.00000000
to
11111111.00000000.00000000.00000000
CIDR-Classless Addressing
Classless addressing is an include of IP address system
It allocate the IP address more effectively
It replace the old class full addressing system
It is also known as classless inter domain routing (CIDR)
CIDR BLOCK
< 32 bits>
Block ID Host ID
R-3: First IP address of block must be divisible by the size of the block
CIDR Notation
a.b.c.d/n i.e.182.0.1.2/28
Sol: It suggest that the 27 bits are identify as network id and reaming 5 bits
are identify as host id.
It suggests-
Remaining 5 bits are used for the identification of hosts in the network.
00010100.00001010.00011110.00100011 / 27
So,
Generally, the border router is configured for NAT i.e the router which have
one interface in local (inside) network and one interface in global (outside)
network. When a packet traverse outside the local (inside) network, then
NAT converts that local (private) IP address to a global (public) IP address.
When a packet enters the local network, the global (public) IP address is
converted to local (private) IP address.
If NAT run out of addresses, i.e., no address is left in the pool configured
then the packets will be dropped and an Internet Control Message Protocol
(ICMP) host unreachable packet to the destination is send.
Inside global address – IP address that represents one or more inside local
IP addresses to the outside world. This is the inside host as seen from the
outside network.
Outside local address – This is the actual IP address of the destination host
in the local network after translation.
Outside global address – This is the outside host as seen form the outside
network. It is the IP address of the outside destination host before
translation.
Advantages of NAT –
Subnet
It is a logical sub division of an IP address in networks
Sub netting
Ex:
Subnet Mask
Ex:
Subnet Binary Format
255 11111111
254 11111110
252 11111100
240 11110000
Complete transition from IPv4 to IPv6 might not be possible because IPv6 is
not backward compatible. This results in a situation where either a site is
on IPv6 or it is not. It is unlike implementation of other new technologies
where the newer one is backward compatible so the older system can still
work with the newer version without any additional changes.
A router can be installed with both IPv4 and IPv6 addresses configured on
its interfaces pointing to the network of relevant IP scheme
Tunneling
The above diagram depicts how two remote IPv4 networks can communicate
via a Tunnel, where the transit network was on IPv6. Vice versa is also
possible where the transit network is on IPv6 and the remote sites that
intend to communicate are on IPv4.
NAT Protocol Translation
ICMP
Error Reporting
Destination unreachable
Source Quench
Time Exceeded
Parameter problems
Redirection
ARP: Address resolution protocol
If the table does not consist of the MAC address of device B, then device A
sends an ARP broadcast message on the network to know which device has
that specific IP address and ask for the MAC address of that particular
device. Then the device that has matching IP address to the source address
sends an ARP response message that consists of the MAC address of the
device B. When device A obtains the MAC address of the device B, it will
store the information in the ARP cache (table). The ARP cache is used to
make the network more efficient. It stores the IP address of the device along
with its MAC address. The stored information is used when device A wants
to communicate with device B on a network, and it does not need to
broadcast a message on the network again. It will simply check the ARP
cache for the entries and then use it for communication.
DHCP: Dynamic Host Controller Protocol
Components of DHCP
DHCP Server: DHCP server is a networked device running the DCHP service
that holds IP addresses and related configuration information. This is
typically a server or a router but could be anything that acts as a host, such
as an SD-WAN appliance.
IP address pool: IP address pool is the range of addresses that are available
to DHCP clients. IP addresses are typically handed out sequentially from
lowest to the highest.
Lease: Lease is the length of time for which a DHCP client holds the IP
address information. When a lease expires, the client has to renew it.
DHCP relay: A host or router that listens for client messages being
broadcast on that network and then forwards them to a configured server.
The server then sends responses back to the relay agent that passes them
along to the client. DHCP relay can be used to centralize DHCP servers
instead of having a server on each subnet.
Benefits of DHCP